diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0c213e61c0..c6959d3089 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @github/copilot-sdk-java +* @github/copilot-sdk diff --git a/.github/actions/setup-copilot/action.yml b/.github/actions/setup-copilot/action.yml index dcc99b8a70..1288a1d89b 100644 --- a/.github/actions/setup-copilot/action.yml +++ b/.github/actions/setup-copilot/action.yml @@ -4,15 +4,36 @@ outputs: cli-path: description: "Path to the Copilot CLI executable" value: ${{ steps.cli-path.outputs.path }} + cli-version: + description: "Pinned @github/copilot version installed (read from pom.xml)" + value: ${{ steps.cli-version.outputs.version }} runs: using: "composite" steps: - - uses: actions/setup-node@v6 + - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v6 with: node-version: 22 - - name: Install Copilot CLI - run: npm install -g @github/copilot + - name: Read pinned @github/copilot version from pom.xml + id: cli-version shell: bash + # The version is the SINGLE SOURCE OF TRUTH for the Copilot CLI version + # used across all CI paths. It is kept in sync with the reference + # implementation pinned in .lastmerge by + # .github/scripts/reference-impl-sync/sync-cli-version-from-reference-impl.sh. + run: | + PROP="readonly-copilot-sdk-ref-impl-version-from-lastmerge-file-updated-by-reference-impl-sync" + VERSION=$(sed -n "s|.*<${PROP}>\(.*\).*|\1|p" pom.xml | head -n 1 | tr -d '[:space:]') + if [[ -z "$VERSION" || "$VERSION" == "PRIMER_TO_REPLACE" ]]; then + echo "::error::Could not read pinned @github/copilot version from pom.xml property <${PROP}>" >&2 + exit 1 + fi + echo "Pinned @github/copilot version: $VERSION" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + - name: Install Copilot CLI (pinned to pom.xml version) + shell: bash + env: + CLI_VERSION: ${{ steps.cli-version.outputs.version }} + run: npm install -g "@github/copilot@${CLI_VERSION}" - name: Set CLI path id: cli-path run: echo "path=$(which copilot)" >> $GITHUB_OUTPUT diff --git a/.github/actions/test-report/action.yml b/.github/actions/test-report/action.yml index 43d45f287a..52a093a68d 100644 --- a/.github/actions/test-report/action.yml +++ b/.github/actions/test-report/action.yml @@ -4,11 +4,15 @@ inputs: report-path: description: "Path to the test report XML files (glob pattern)" required: false - default: "target/surefire-reports/TEST-*.xml" + default: "target/surefire-reports*/TEST-*.xml" jacoco-path: description: "Path to the JaCoCo XML report" required: false default: "target/site/jacoco-coverage/jacoco.xml" + jacoco-csv-path: + description: "Path to the JaCoCo CSV report" + required: false + default: "target/site/jacoco-coverage/jacoco.csv" check-name: description: "Name for the check run" required: false @@ -22,10 +26,7 @@ runs: echo "## πŸ§ͺ Copilot Java SDK :: Test Results" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY - REPORT_DIR=$(dirname "${{ inputs.report-path }}") - REPORT_PATTERN=$(basename "${{ inputs.report-path }}") - - if [ -d "$REPORT_DIR" ]; then + if ls ${{ inputs.report-path }} 1>/dev/null 2>&1; then TESTS_RUN=$(grep -h "tests=" ${{ inputs.report-path }} 2>/dev/null | sed 's/.*tests="\([0-9]*\)".*/\1/' | awk '{s+=$1} END {print s}') FAILURES=$(grep -h "failures=" ${{ inputs.report-path }} 2>/dev/null | sed 's/.*failures="\([0-9]*\)".*/\1/' | awk '{s+=$1} END {print s}') ERRORS=$(grep -h "errors=" ${{ inputs.report-path }} 2>/dev/null | sed 's/.*errors="\([0-9]*\)".*/\1/' | awk '{s+=$1} END {print s}') @@ -83,6 +84,7 @@ runs: shell: bash run: | JACOCO_XML="${{ inputs.jacoco-path }}" + JACOCO_CSV="${{ inputs.jacoco-csv-path }}" if [ -f "$JACOCO_XML" ]; then echo "" >> $GITHUB_STEP_SUMMARY @@ -142,6 +144,36 @@ runs: echo "| πŸ“ Lines | ${LINE_COVERED:-0} | ${LINE_MISSED:-0} | ${LINE_PCT}% |" >> $GITHUB_STEP_SUMMARY echo "| πŸ”§ Methods | ${METHOD_COVERED:-0} | ${METHOD_MISSED:-0} | ${METHOD_PCT}% |" >> $GITHUB_STEP_SUMMARY echo "| πŸ“¦ Classes | ${CLASS_COVERED:-0} | ${CLASS_MISSED:-0} | ${CLASS_PCT}% |" >> $GITHUB_STEP_SUMMARY + + if [ -f "$JACOCO_CSV" ]; then + extract_instruction_scope() { + local scope=$1 + awk -F',' -v scope="$scope" -v generated_prefix="com.github.copilot.sdk.generated" ' + NR > 1 { + is_generated = index($2, generated_prefix) == 1 + if ((scope == "generated" && is_generated) || + (scope == "handwritten" && !is_generated)) { + missed += $4 + covered += $5 + } + } + END { print covered + 0 "," missed + 0 } + ' "$JACOCO_CSV" + } + + IFS=, read -r HANDWRITTEN_COVERED HANDWRITTEN_MISSED <<< "$(extract_instruction_scope handwritten)" + IFS=, read -r GENERATED_COVERED GENERATED_MISSED <<< "$(extract_instruction_scope generated)" + HANDWRITTEN_PCT=$(calc_pct "${HANDWRITTEN_COVERED:-0}" "${HANDWRITTEN_MISSED:-0}") + GENERATED_PCT=$(calc_pct "${GENERATED_COVERED:-0}" "${GENERATED_MISSED:-0}") + + echo "" >> $GITHUB_STEP_SUMMARY + echo "### Coverage by Code Origin (Instructions)" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "| Origin | Covered | Missed | Coverage |" >> $GITHUB_STEP_SUMMARY + echo "|--------|---------|--------|----------|" >> $GITHUB_STEP_SUMMARY + echo "| ✍️ Handwritten | ${HANDWRITTEN_COVERED:-0} | ${HANDWRITTEN_MISSED:-0} | ${HANDWRITTEN_PCT}% |" >> $GITHUB_STEP_SUMMARY + echo "| πŸ€– Generated | ${GENERATED_COVERED:-0} | ${GENERATED_MISSED:-0} | ${GENERATED_PCT}% |" >> $GITHUB_STEP_SUMMARY + fi else echo "" >> $GITHUB_STEP_SUMMARY echo "## πŸ“Š Code Coverage" >> $GITHUB_STEP_SUMMARY diff --git a/.github/aw/actions-lock.json b/.github/aw/actions-lock.json index 1b8b4b56b1..71291dd03b 100644 --- a/.github/aw/actions-lock.json +++ b/.github/aw/actions-lock.json @@ -1,5 +1,15 @@ { "entries": { + "actions/checkout@v6.0.2": { + "repo": "actions/checkout", + "version": "v6.0.2", + "sha": "de0fac2e4500dabe0009e67214ff5f5447ce83dd" + }, + "actions/download-artifact@v8.0.1": { + "repo": "actions/download-artifact", + "version": "v8.0.1", + "sha": "3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c" + }, "actions/github-script@v8": { "repo": "actions/github-script", "version": "v8", @@ -10,6 +20,11 @@ "version": "v9", "sha": "373c709c69115d41ff229c7e5df9f8788daa9553" }, + "actions/github-script@v9.0.0": { + "repo": "actions/github-script", + "version": "v9.0.0", + "sha": "3a2844b7e9c422d3c10d287c895573f7108da1b3" + }, "actions/setup-java@v4": { "repo": "actions/setup-java", "version": "v4", @@ -20,10 +35,15 @@ "version": "v4", "sha": "49933ea5288caeca8642d1e84afbd3f7d6820020" }, - "github/gh-aw-actions/setup@v0.68.3": { + "actions/upload-artifact@v7.0.1": { + "repo": "actions/upload-artifact", + "version": "v7.0.1", + "sha": "043fb46d1a93c77aae656e7c1c64a875d1fc6a0a" + }, + "github/gh-aw-actions/setup@v0.74.4": { "repo": "github/gh-aw-actions/setup", - "version": "v0.68.3", - "sha": "ba90f2186d7ad780ec640f364005fa24e797b360" + "version": "v0.74.4", + "sha": "d3abfe96a194bce3a523ed2093ddedd5704cdf62" }, "github/gh-aw/actions/setup@v0.51.6": { "repo": "github/gh-aw/actions/setup", diff --git a/.github/badges/jacoco-generated.svg b/.github/badges/jacoco-generated.svg new file mode 100644 index 0000000000..9422a5629e --- /dev/null +++ b/.github/badges/jacoco-generated.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + coverage generated + coverage generated + 72.8% + 72.8% + + diff --git a/.github/badges/jacoco-handwritten.svg b/.github/badges/jacoco-handwritten.svg new file mode 100644 index 0000000000..c7f675e6e9 --- /dev/null +++ b/.github/badges/jacoco-handwritten.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + coverage handwritten + coverage handwritten + 82.5% + 82.5% + + diff --git a/.github/badges/jacoco.svg b/.github/badges/jacoco.svg index 812e6354a7..bcfcc44d75 100644 --- a/.github/badges/jacoco.svg +++ b/.github/badges/jacoco.svg @@ -1,18 +1,18 @@ - + - + - - - + + + - coverage - coverage - 86.4% - 86.4% + coverage + coverage + 78.3% + 78.3% diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index d029784219..7b304f2677 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -222,6 +222,8 @@ Test method names are converted to lowercase snake_case for snapshot filenames t - **DO NOT** modify test snapshots in `target/copilot-sdk/test/snapshots/` - these come from reference implementation - **DO NOT** alter the Eclipse formatter configuration in `pom.xml` without team consensus - **DO NOT** remove or skip Checkstyle or Spotless checks +- **YOU MUST ALWAYS** run `gh aw compile ` after editing any `.github/workflows/*.md` agentic workflow source file to regenerate the corresponding `.lock.yml`. The lock file contains a content hash of the frontmatter β€” any edit to the `.md` without recompiling will cause the workflow to fail at runtime with a "lock file out of sync" error. +- **DO NOT** edit `.github/workflows/*.lock.yml` directly β€” these are auto-generated by `gh aw compile` from the `.md` source files. ### Security Guidelines diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c77d00796c..04d5ab5f47 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,12 +1,34 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file - version: 2 updates: - - package-ecosystem: "" # See documentation for possible values - directory: "/" # Location of package manifests + - package-ecosystem: "github-actions" + directory: "/" schedule: interval: "weekly" + ignore: + # gh-aw generated files β€” action SHAs are managed by `gh aw compile` + # via .github/aw/actions-lock.json, not by Dependabot. + # Dependabot's find-and-replace breaks lockfile metadata headers. + - dependency-name: "actions/github-script" + - dependency-name: "github/gh-aw-actions" + # Major version bumps may have breaking changes and must be + # evaluated and applied manually. + - dependency-name: "*" + update-types: ["version-update:semver-major"] + groups: + github-actions: + patterns: + - "*" + - package-ecosystem: "maven" + directory: "/" + schedule: + interval: "weekly" + ignore: + # Major version bumps often drop Java 17 support or have breaking + # API changes. These must be evaluated and applied manually. + - dependency-name: "*" + update-types: ["version-update:semver-major"] + groups: + maven-deps: + patterns: + - "*" diff --git a/.github/prompts/coding-agent-merge-reference-impl-instructions.md b/.github/prompts/coding-agent-merge-reference-impl-instructions.md index c93af9a1a5..5ae1621db6 100644 --- a/.github/prompts/coding-agent-merge-reference-impl-instructions.md +++ b/.github/prompts/coding-agent-merge-reference-impl-instructions.md @@ -1,5 +1,5 @@ - - + + Follow the agentic-merge-reference-impl prompt at .github/prompts/agentic-merge-reference-impl.prompt.md to port reference implementation changes to the Java SDK. diff --git a/.github/scripts/generate-coverage-badge.sh b/.github/scripts/generate-coverage-badge.sh index 1d124d9474..324b3194fb 100755 --- a/.github/scripts/generate-coverage-badge.sh +++ b/.github/scripts/generate-coverage-badge.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Generates an SVG coverage badge from a JaCoCo CSV report. +# Generates SVG coverage badges from a JaCoCo CSV report. # # Usage: generate-coverage-badge.sh [jacoco.csv] [output-dir] # jacoco.csv - Path to JaCoCo CSV report (default: target/site/jacoco-coverage/jacoco.csv) @@ -8,39 +8,64 @@ set -euo pipefail CSV="${1:-target/site/jacoco-coverage/jacoco.csv}" BADGES_DIR="${2:-.github/badges}" +GENERATED_PREFIX="com.github.copilot.sdk.generated" if [ ! -f "$CSV" ]; then echo "⚠️ No JaCoCo CSV report found at $CSV" exit 0 fi -# Sum INSTRUCTION_MISSED and INSTRUCTION_COVERED across all rows (skip header) -read -r missed covered <<< "$(awk -F',' 'NR>1 { m+=$4; c+=$5 } END { print m, c }' "$CSV")" -total=$((missed + covered)) -if [ "$total" -eq 0 ]; then - pct="0" -else - pct=$(awk "BEGIN { printf \"%.1f\", ($covered / $total) * 100 }") - # Drop trailing .0 - pct=$(echo "$pct" | sed 's/\.0$//') -fi -echo "Coverage: ${pct}%" +calc_totals() { + local scope=$1 + awk -F',' -v scope="$scope" -v generated_prefix="$GENERATED_PREFIX" ' + NR > 1 { + is_generated = index($2, generated_prefix) == 1 + if (scope == "overall" || + (scope == "generated" && is_generated) || + (scope == "handwritten" && !is_generated)) { + missed += $4 + covered += $5 + } + } + END { print missed + 0, covered + 0 } + ' "$CSV" +} -# Choose badge color based on coverage -color="#e05d44" # red <60 -if awk "BEGIN{exit!($pct>=100)}"; then color="#4c1" # bright green -elif awk "BEGIN{exit!($pct>=90)}"; then color="#97ca00" # green -elif awk "BEGIN{exit!($pct>=80)}"; then color="#a4a61d" # yellow-green -elif awk "BEGIN{exit!($pct>=70)}"; then color="#dfb317" # yellow -elif awk "BEGIN{exit!($pct>=60)}"; then color="#fe7d37" # orange -fi +format_pct() { + local missed=$1 + local covered=$2 + local total=$((missed + covered)) + if [ "$total" -eq 0 ]; then + echo "0" + else + awk "BEGIN { printf \"%.1f\", ($covered / $total) * 100 }" | sed 's/\.0$//' + fi +} -# Generate SVG badge -mkdir -p "$BADGES_DIR" -label="coverage" -value="${pct}%" -lw=62; vw=46; tw=$((lw + vw)) -cat > "${BADGES_DIR}/jacoco.svg" <=100)}"; then color="#4c1" # bright green + elif awk "BEGIN{exit!($pct>=90)}"; then color="#97ca00" # green + elif awk "BEGIN{exit!($pct>=80)}"; then color="#a4a61d" # yellow-green + elif awk "BEGIN{exit!($pct>=70)}"; then color="#dfb317" # yellow + elif awk "BEGIN{exit!($pct>=60)}"; then color="#fe7d37" # orange + fi + echo "$color" +} + +generate_badge() { + local label=$1 + local value=$2 + local output=$3 + local pct=${value%\%} + local color + color=$(pick_color "$pct") + local lw=$(( ${#label} * 7 + 12 )) + local vw=$(( ${#value} * 7 + 16 )) + local tw=$((lw + vw)) + + cat > "$output" < @@ -60,5 +85,24 @@ cat > "${BADGES_DIR}/jacoco.svg" < EOF +} + +mkdir -p "$BADGES_DIR" + +read -r overall_missed overall_covered <<< "$(calc_totals overall)" +read -r handwritten_missed handwritten_covered <<< "$(calc_totals handwritten)" +read -r generated_missed generated_covered <<< "$(calc_totals generated)" + +overall_pct=$(format_pct "$overall_missed" "$overall_covered") +handwritten_pct=$(format_pct "$handwritten_missed" "$handwritten_covered") +generated_pct=$(format_pct "$generated_missed" "$generated_covered") + +echo "Overall coverage: ${overall_pct}%" +echo "Handwritten coverage: ${handwritten_pct}%" +echo "Generated coverage: ${generated_pct}%" + +generate_badge "coverage" "${overall_pct}%" "${BADGES_DIR}/jacoco.svg" +generate_badge "coverage handwritten" "${handwritten_pct}%" "${BADGES_DIR}/jacoco-handwritten.svg" +generate_badge "coverage generated" "${generated_pct}%" "${BADGES_DIR}/jacoco-generated.svg" -echo "Badge generated at ${BADGES_DIR}/jacoco.svg" +echo "Badges generated in ${BADGES_DIR}" diff --git a/.github/scripts/reference-impl-sync/merge-reference-impl-finish.sh b/.github/scripts/reference-impl-sync/merge-reference-impl-finish.sh index 480d43bc0a..2dda8da07f 100755 --- a/.github/scripts/reference-impl-sync/merge-reference-impl-finish.sh +++ b/.github/scripts/reference-impl-sync/merge-reference-impl-finish.sh @@ -5,8 +5,12 @@ # Finalises a reference implementation merge: # 1. Runs format + test + build (via format-and-test.sh) # 2. Updates .lastmerge to reference implementation HEAD -# 3. Commits the .lastmerge update -# 4. Pushes the branch to origin +# 3. Syncs the @github/copilot version property in pom.xml from the +# cloned reference implementation's nodejs/package.json +# 4. Syncs scripts/codegen/package.json to the same @github/copilot +# version so the code generator uses matching schemas +# 5. Commits the .lastmerge + pom.xml + codegen package updates +# 6. Pushes the branch to origin # # Usage: ./.github/scripts/reference-impl-sync/merge-reference-impl-finish.sh # ./.github/scripts/reference-impl-sync/merge-reference-impl-finish.sh --skip-tests @@ -48,8 +52,22 @@ echo "β–Έ Updating .lastmerge…" NEW_COMMIT=$(cd "$REFERENCE_IMPL_DIR" && git rev-parse origin/main) echo "$NEW_COMMIT" > "$ROOT_DIR/.lastmerge" -git add .lastmerge -git commit -m "Update .lastmerge to $NEW_COMMIT" +# ── 2b. Sync pom.xml @github/copilot version ───────────────── +# Keeps the canonical CLI version in pom.xml aligned with what the +# reference implementation pinned in .lastmerge depends on. +echo "β–Έ Syncing @github/copilot version in pom.xml from reference implementation…" +"$ROOT_DIR/.github/scripts/reference-impl-sync/sync-cli-version-from-reference-impl.sh" "$REFERENCE_IMPL_DIR" + +# ── 2c. Sync scripts/codegen @github/copilot version ───────── +# Keeps scripts/codegen/package.json in lockstep so the code generator +# uses schemas from the same CLI version that the tests run against. +# This eliminates the gap where Dependabot could race ahead of the +# reference implementation sync. +echo "β–Έ Syncing @github/copilot version in scripts/codegen/package.json…" +"$ROOT_DIR/.github/scripts/reference-impl-sync/sync-codegen-version.sh" "$REFERENCE_IMPL_DIR" + +git add .lastmerge pom.xml scripts/codegen/package.json scripts/codegen/package-lock.json +git commit -m "Update .lastmerge to $NEW_COMMIT, sync pom.xml CLI version, and update scripts/codegen @github/copilot version" # ── 3. Push branch ─────────────────────────────────────────── echo "β–Έ Pushing branch $BRANCH_NAME to origin…" diff --git a/.github/scripts/reference-impl-sync/sync-cli-version-from-reference-impl.sh b/.github/scripts/reference-impl-sync/sync-cli-version-from-reference-impl.sh new file mode 100755 index 0000000000..1d15d8aee9 --- /dev/null +++ b/.github/scripts/reference-impl-sync/sync-cli-version-from-reference-impl.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +# ────────────────────────────────────────────────────────────── +# sync-cli-version-from-reference-impl.sh +# +# Reads the @github/copilot version specifier from the cloned +# reference implementation's nodejs/package.json, and updates the +# corresponding property in pom.xml: +# +# +# +# This keeps the canonical Copilot CLI version (declared in pom.xml) +# in sync with whatever the reference implementation pinned in +# .lastmerge depends on. All workflows that install the Copilot CLI +# (build-test.yml β€” implicitly via cloned SDK, run-smoke-test.yml and +# update-copilot-dependency.yml β€” via the setup-copilot action) read +# this single property so every CI path uses the same CLI version. +# +# Usage: +# ./sync-cli-version-from-reference-impl.sh +# +# Or, when invoked from merge-reference-impl-finish.sh, sources +# REFERENCE_IMPL_DIR from the .merge-env file. +# ────────────────────────────────────────────────────────────── +set -euo pipefail + +# Locate the repo root by walking up from this script until we find a pom.xml. +# This is resilient to the script being moved to a different depth under +# .github/scripts/ in the future. +find_repo_root() { + local dir + dir="$(cd "$(dirname "$0")" && pwd)" + while [[ "$dir" != "/" ]]; do + if [[ -f "$dir/pom.xml" ]]; then + echo "$dir" + return 0 + fi + dir="$(dirname "$dir")" + done + echo "❌ Could not locate repo root (no pom.xml found above $(dirname "$0"))" >&2 + return 1 +} +ROOT_DIR="$(find_repo_root)" + +REFERENCE_IMPL_DIR="${1:-${REFERENCE_IMPL_DIR:-}}" +if [[ -z "$REFERENCE_IMPL_DIR" ]]; then + echo "❌ Usage: $0 " >&2 + echo " or set REFERENCE_IMPL_DIR in the environment." >&2 + exit 1 +fi + +PKG_JSON="$REFERENCE_IMPL_DIR/nodejs/package.json" +if [[ ! -f "$PKG_JSON" ]]; then + echo "❌ Cannot find $PKG_JSON" >&2 + exit 1 +fi + +# node is always available since the reference implementation uses npm. +CLI_VERSION=$(node -e \ + "const fs=require('fs');const p=JSON.parse(fs.readFileSync(process.argv[1],'utf8'));const v=(p.dependencies&&p.dependencies['@github/copilot'])||(p.devDependencies&&p.devDependencies['@github/copilot']);process.stdout.write(v||'');" \ + "$PKG_JSON") + +if [[ -z "$CLI_VERSION" ]]; then + echo "❌ Could not extract @github/copilot version from $PKG_JSON" >&2 + exit 1 +fi + +POM="$ROOT_DIR/pom.xml" +PROP="readonly-copilot-sdk-ref-impl-version-from-lastmerge-file-updated-by-reference-impl-sync" + +if ! grep -q "<${PROP}>" "$POM"; then + echo "❌ Property <${PROP}> not found in $POM" >&2 + exit 1 +fi + +# Use a portable sed invocation (works on both BSD/macOS and GNU/Linux). +TMP="$(mktemp)" +sed -E "s|<${PROP}>[^<]*|<${PROP}>${CLI_VERSION}|" "$POM" > "$TMP" +mv "$TMP" "$POM" + +echo "β–Έ Updated pom.xml: <${PROP}> = ${CLI_VERSION}" diff --git a/.github/scripts/reference-impl-sync/sync-codegen-version.sh b/.github/scripts/reference-impl-sync/sync-codegen-version.sh new file mode 100755 index 0000000000..f3baa0ab5e --- /dev/null +++ b/.github/scripts/reference-impl-sync/sync-codegen-version.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env bash +# ────────────────────────────────────────────────────────────── +# sync-codegen-version.sh +# +# Updates the @github/copilot dependency in scripts/codegen/package.json +# to match the version used by the reference implementation. This keeps +# the code generator schemas in lockstep with the CLI version used for +# testing, eliminating the gap where Dependabot could race ahead. +# +# Usage: +# ./sync-codegen-version.sh +# +# Or, when invoked from merge-reference-impl-finish.sh, the directory +# is passed as $1. +# ────────────────────────────────────────────────────────────── +set -euo pipefail + +# Locate the repo root by walking up from this script until we find a pom.xml. +find_repo_root() { + local dir + dir="$(cd "$(dirname "$0")" && pwd)" + while [[ "$dir" != "/" ]]; do + if [[ -f "$dir/pom.xml" ]]; then + echo "$dir" + return 0 + fi + dir="$(dirname "$dir")" + done + echo "❌ Could not locate repo root (no pom.xml found above $(dirname "$0"))" >&2 + return 1 +} +ROOT_DIR="$(find_repo_root)" + +REFERENCE_IMPL_DIR="${1:-${REFERENCE_IMPL_DIR:-}}" +if [[ -z "$REFERENCE_IMPL_DIR" ]]; then + echo "❌ Usage: $0 " >&2 + echo " or set REFERENCE_IMPL_DIR in the environment." >&2 + exit 1 +fi + +PKG_JSON="$REFERENCE_IMPL_DIR/nodejs/package.json" +if [[ ! -f "$PKG_JSON" ]]; then + echo "❌ Cannot find $PKG_JSON" >&2 + exit 1 +fi + +# Extract the @github/copilot version from the reference implementation. +CLI_VERSION=$(node -e \ + "const fs=require('fs');const p=JSON.parse(fs.readFileSync(process.argv[1],'utf8'));const v=(p.dependencies&&p.dependencies['@github/copilot'])||(p.devDependencies&&p.devDependencies['@github/copilot']);process.stdout.write(v||'');" \ + "$PKG_JSON") + +if [[ -z "$CLI_VERSION" ]]; then + echo "❌ Could not extract @github/copilot version from $PKG_JSON" >&2 + exit 1 +fi + +CODEGEN_DIR="$ROOT_DIR/scripts/codegen" +CODEGEN_PKG="$CODEGEN_DIR/package.json" + +if [[ ! -f "$CODEGEN_PKG" ]]; then + echo "❌ Cannot find $CODEGEN_PKG" >&2 + exit 1 +fi + +# Update scripts/codegen/package.json with the new version and regenerate the lock file. +# Write the version string directly into package.json to preserve the exact specifier +# used by the reference implementation (e.g. '^1.0.43-0'). npm install normalises +# caret ranges and would silently strip the prerelease suffix, causing a mismatch +# with pom.xml. +echo "β–Έ Updating scripts/codegen/package.json: @github/copilot β†’ ${CLI_VERSION}" +cd "$CODEGEN_DIR" +node -e " +const fs = require('fs'); +const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); +pkg.dependencies['@github/copilot'] = process.argv[1]; +fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n'); +" "$CLI_VERSION" +npm install +echo "β–Έ Updated scripts/codegen to @github/copilot@${CLI_VERSION}" diff --git a/.github/scripts/release/test-update-changelog.sh b/.github/scripts/release/test-update-changelog.sh index ade87d6a94..b5fc8486b7 100755 --- a/.github/scripts/release/test-update-changelog.sh +++ b/.github/scripts/release/test-update-changelog.sh @@ -33,10 +33,10 @@ run_test() { if $test_func; then echo -e "${GREEN}PASSED${NC}" - ((passed++)) + passed=$((passed + 1)) else echo -e "${RED}FAILED${NC}" - ((failed++)) + failed=$((failed + 1)) fi } @@ -180,6 +180,71 @@ EOF fi } +# Test 6: Beta-java version format (e.g., 1.0.0-beta-java.N) +test_beta_java_version() { + local test_file="${TEST_DIR}/test6.md" + cat > "$test_file" << 'EOF' +# Changelog + +## [Unreleased] + +### Added +- New feature + +## [1.0.0-beta-java.1] - 2026-05-01 + +[Unreleased]: https://github.com/test/repo/compare/v1.0.0-beta-java.1...HEAD +[1.0.0-beta-java.1]: https://github.com/test/repo/compare/v0.3.0-java.2...v1.0.0-beta-java.1 +[0.3.0-java.2]: https://github.com/test/repo/releases/tag/0.3.0-java.2 +EOF + + CHANGELOG_FILE="$test_file" bash "$UPDATE_SCRIPT" 1.0.0-beta-java.2 > /dev/null 2>&1 + + # The [Unreleased] link should now point to v1.0.0-beta-java.2 + # [1.0.0-beta-java.2] should compare from v1.0.0-beta-java.1 + if grep -q "\[Unreleased\]: https://github.com/test/repo/compare/v1.0.0-beta-java.2...HEAD" "$test_file" && \ + grep -q "\[1.0.0-beta-java.2\]: https://github.com/test/repo/compare/v1.0.0-beta-java.1...v1.0.0-beta-java.2" "$test_file"; then + return 0 + else + return 1 + fi +} + +# Test 7: No duplicate [Unreleased] links when existing [Unreleased] link is present +test_no_duplicate_unreleased_links() { + local test_file="${TEST_DIR}/test7.md" + cat > "$test_file" << 'EOF' +# Changelog + +## [Unreleased] + +### Added +- New feature + +## [1.0.0-beta-java.2] - 2026-05-08 + +## [1.0.0-beta-java.1] - 2026-05-05 + +[Unreleased]: https://github.com/test/repo/compare/v1.0.0-beta-java.2...HEAD +[1.0.0-beta-java.2]: https://github.com/test/repo/compare/v1.0.0-beta-java.1...v1.0.0-beta-java.2 +[1.0.0-beta-java.1]: https://github.com/test/repo/compare/v0.3.0-java.2...v1.0.0-beta-java.1 +[0.3.0-java.2]: https://github.com/test/repo/releases/tag/0.3.0-java.2 +EOF + + CHANGELOG_FILE="$test_file" bash "$UPDATE_SCRIPT" 1.0.0-beta-java.3 > /dev/null 2>&1 + + # Count [Unreleased] link definitions - there should be exactly one + local unreleased_count + unreleased_count=$(grep -c "^\[Unreleased\]:" "$test_file") + if [ "$unreleased_count" -eq 1 ] && \ + grep -q "\[Unreleased\]: https://github.com/test/repo/compare/v1.0.0-beta-java.3...HEAD" "$test_file" && \ + grep -q "\[1.0.0-beta-java.3\]: https://github.com/test/repo/compare/v1.0.0-beta-java.2...v1.0.0-beta-java.3" "$test_file"; then + return 0 + else + return 1 + fi +} + # Run all tests echo "Running CHANGELOG update script tests..." echo "" @@ -189,6 +254,8 @@ run_test "Handle CHANGELOG without Unreleased link" test_no_unreleased_link run_test "Preserve content structure" test_preserve_content run_test "Error handling - no Unreleased section" test_no_unreleased_section run_test "Multiple version handling" test_multiple_versions +run_test "Beta-java version format (e.g., 1.0.0-beta-java.N)" test_beta_java_version +run_test "No duplicate [Unreleased] links when existing link is present" test_no_duplicate_unreleased_links echo "" echo "==========================================" diff --git a/.github/scripts/release/update-changelog.sh b/.github/scripts/release/update-changelog.sh index ff35dec722..e21d03774e 100755 --- a/.github/scripts/release/update-changelog.sh +++ b/.github/scripts/release/update-changelog.sh @@ -45,6 +45,7 @@ BEGIN { links_section = 0 first_version_link = "" repo_url = "" + unreleased_link_handled = 0 } # Track if we are in the links section at the bottom @@ -53,7 +54,7 @@ BEGIN { } # Capture the repository URL from the first version link -links_section && repo_url == "" && /^\[[0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?\]:/ { +links_section && repo_url == "" && /^\[[0-9]+\.[0-9]+\.[0-9]+(-(beta-)?java(-preview)?\.[0-9]+)?\]:/ { match($0, /(https:\/\/github\.com\/[^\/]+\/[^\/]+)\//, arr) if (arr[1] != "") { repo_url = arr[1] @@ -86,28 +87,30 @@ skip_old_reference_impl && /^[[:space:]]*$/ { next } skip_old_reference_impl && /^> \*\*Reference implementation sync:\*\*/ { next } skip_old_reference_impl && !/^[[:space:]]*$/ && !/^> \*\*Reference implementation sync:\*\*/ { skip_old_reference_impl = 0 } -# Capture the first version link to get the previous version -links_section && first_version_link == "" && /^\[[0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?\]:/ { - match($0, /\[([0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?)\]:/, arr) - if (arr[1] != "" && repo_url != "") { - first_version_link = arr[1] - # Insert Unreleased and new version links before first version link - print "[Unreleased]: " repo_url "/compare/v" version "...HEAD" - print "[" version "]: " repo_url "/compare/v" arr[1] "...v" version - } -} - -# Update existing [Unreleased] link if present +# Update existing [Unreleased] link if present (must be checked before the first-version-link block) links_section && /^\[Unreleased\]:/ { # Get the previous version and repo URL from the existing link - match($0, /(https:\/\/github\.com\/[^\/]+\/[^\/]+)\/compare\/v([0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?)\.\.\.HEAD/, arr) + match($0, /(https:\/\/github\.com\/[^\/]+\/[^\/]+)\/compare\/v([0-9]+\.[0-9]+\.[0-9]+(-(beta-)?java(-preview)?\.[0-9]+)?)\.\.\.HEAD/, arr) if (arr[1] != "" && arr[2] != "") { print "[Unreleased]: " arr[1] "/compare/v" version "...HEAD" print "[" version "]: " arr[1] "/compare/v" arr[2] "...v" version + unreleased_link_handled = 1 next } } +# Capture the first version link to get the previous version +# Only fires if the [Unreleased] link was not already handled above +links_section && first_version_link == "" && !unreleased_link_handled && /^\[[0-9]+\.[0-9]+\.[0-9]+(-(beta-)?java(-preview)?\.[0-9]+)?\]:/ { + match($0, /\[([0-9]+\.[0-9]+\.[0-9]+(-(beta-)?java(-preview)?\.[0-9]+)?)\]:/, arr) + if (arr[1] != "" && repo_url != "") { + first_version_link = arr[1] + # Insert Unreleased and new version links before first version link + print "[Unreleased]: " repo_url "/compare/v" version "...HEAD" + print "[" version "]: " repo_url "/compare/v" arr[1] "...v" version + } +} + # Print all other lines unchanged { print } ' "$CHANGELOG_FILE" > "$TEMP_FILE" diff --git a/.github/workflows/agentics-maintenance.yml b/.github/workflows/agentics-maintenance.yml index bb7a31d5d0..aa47e2f9b1 100644 --- a/.github/workflows/agentics-maintenance.yml +++ b/.github/workflows/agentics-maintenance.yml @@ -1,4 +1,3 @@ -# # ___ _ _ # / _ \ | | (_) # | |_| | __ _ ___ _ __ | |_ _ ___ @@ -13,7 +12,7 @@ # \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \ # \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/ # -# This file was automatically generated by pkg/workflow/maintenance_workflow.go (v0.51.6). DO NOT EDIT. +# This file was automatically generated by pkg/workflow/maintenance_workflow.go (v0.68.3). DO NOT EDIT. # # To regenerate this workflow, run: # gh aw compile @@ -37,12 +36,52 @@ on: schedule: - cron: "37 0 * * *" # Daily (based on minimum expires: 6 days) workflow_dispatch: + inputs: + operation: + description: 'Optional maintenance operation to run' + required: false + type: choice + default: '' + options: + - '' + - 'disable' + - 'enable' + - 'update' + - 'upgrade' + - 'safe_outputs' + - 'create_labels' + - 'clean_cache_memories' + - 'validate' + run_url: + description: 'Run URL or run ID to replay safe outputs from (e.g. https://github.com/owner/repo/actions/runs/12345 or 12345). Required when operation is safe_outputs.' + required: false + type: string + default: '' + workflow_call: + inputs: + operation: + description: 'Optional maintenance operation to run (disable, enable, update, upgrade, safe_outputs, create_labels, clean_cache_memories, validate)' + required: false + type: string + default: '' + run_url: + description: 'Run URL or run ID to replay safe outputs from (e.g. https://github.com/owner/repo/actions/runs/12345 or 12345). Required when operation is safe_outputs.' + required: false + type: string + default: '' + outputs: + operation_completed: + description: 'The maintenance operation that was completed (empty when none ran or a scheduled job ran)' + value: ${{ jobs.run_operation.outputs.operation || inputs.operation }} + applied_run_url: + description: 'The run URL that safe outputs were applied from' + value: ${{ jobs.apply_safe_outputs.outputs.run_url }} permissions: {} jobs: close-expired-entities: - if: ${{ !github.event.repository.fork }} + if: ${{ (!(github.event.repository.fork)) && (github.event_name != 'workflow_dispatch' && github.event_name != 'workflow_call' || inputs.operation == '') }} runs-on: ubuntu-slim permissions: discussions: write @@ -50,33 +89,245 @@ jobs: pull-requests: write steps: - name: Setup Scripts - uses: github/gh-aw/actions/setup@33cd6c7f1fee588654ef19def2e6a4174be66197 # v0.51.6 + uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 with: - destination: /opt/gh-aw/actions + destination: ${{ runner.temp }}/gh-aw/actions - name: Close expired discussions - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 with: script: | - const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/close_expired_discussions.cjs'); + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/close_expired_discussions.cjs'); await main(); - name: Close expired issues - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 with: script: | - const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/close_expired_issues.cjs'); + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/close_expired_issues.cjs'); await main(); - name: Close expired pull requests - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/close_expired_pull_requests.cjs'); + await main(); + + cleanup-cache-memory: + if: ${{ (!(github.event.repository.fork)) && (github.event_name != 'workflow_dispatch' && github.event_name != 'workflow_call' || inputs.operation == '' || inputs.operation == 'clean_cache_memories') }} + runs-on: ubuntu-slim + permissions: + actions: write + steps: + - name: Setup Scripts + uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 + with: + destination: ${{ runner.temp }}/gh-aw/actions + + - name: Cleanup outdated cache-memory entries + uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/cleanup_cache_memory.cjs'); + await main(); + + run_operation: + if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation != '' && inputs.operation != 'safe_outputs' && inputs.operation != 'create_labels' && inputs.operation != 'clean_cache_memories' && inputs.operation != 'validate' && (!(github.event.repository.fork)) }} + runs-on: ubuntu-slim + permissions: + actions: write + contents: write + pull-requests: write + outputs: + operation: ${{ steps.record.outputs.operation }} + steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Setup Scripts + uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 + with: + destination: ${{ runner.temp }}/gh-aw/actions + + - name: Check admin/maintainer permissions + uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/check_team_member.cjs'); + await main(); + + - name: Install gh-aw + uses: github/gh-aw-actions/setup-cli@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 + with: + version: v0.68.3 + + - name: Run operation + uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_AW_OPERATION: ${{ inputs.operation }} + GH_AW_CMD_PREFIX: gh aw + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/run_operation_update_upgrade.cjs'); + await main(); + + - name: Record outputs + id: record + run: echo "operation=${{ inputs.operation }}" >> "$GITHUB_OUTPUT" + + apply_safe_outputs: + if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'safe_outputs' && (!(github.event.repository.fork)) }} + runs-on: ubuntu-slim + permissions: + actions: read + contents: write + discussions: write + issues: write + pull-requests: write + outputs: + run_url: ${{ steps.record.outputs.run_url }} + steps: + - name: Checkout actions folder + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + sparse-checkout: | + actions + persist-credentials: false + + - name: Setup Scripts + uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 + with: + destination: ${{ runner.temp }}/gh-aw/actions + + - name: Check admin/maintainer permissions + uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/check_team_member.cjs'); + await main(); + + - name: Apply Safe Outputs + uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_AW_RUN_URL: ${{ inputs.run_url }} + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/apply_safe_outputs_replay.cjs'); + await main(); + + - name: Record outputs + id: record + run: echo "run_url=${{ inputs.run_url }}" >> "$GITHUB_OUTPUT" + + create_labels: + if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'create_labels' && (!(github.event.repository.fork)) }} + runs-on: ubuntu-slim + permissions: + contents: read + issues: write + steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Setup Scripts + uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 + with: + destination: ${{ runner.temp }}/gh-aw/actions + + - name: Check admin/maintainer permissions + uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/check_team_member.cjs'); + await main(); + + - name: Install gh-aw + uses: github/gh-aw-actions/setup-cli@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 + with: + version: v0.68.3 + + - name: Create missing labels + uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + env: + GH_AW_CMD_PREFIX: gh aw + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/create_labels.cjs'); + await main(); + + validate_workflows: + if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'validate' && (!(github.event.repository.fork)) }} + runs-on: ubuntu-latest + permissions: + contents: read + issues: write + steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Setup Scripts + uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 + with: + destination: ${{ runner.temp }}/gh-aw/actions + + - name: Check admin/maintainer permissions + uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/check_team_member.cjs'); + await main(); + + - name: Install gh-aw + uses: github/gh-aw-actions/setup-cli@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 + with: + version: v0.68.3 + + - name: Validate workflows and file issue on findings + uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + env: + GH_AW_CMD_PREFIX: gh aw with: + github-token: ${{ secrets.GITHUB_TOKEN }} script: | - const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/close_expired_pull_requests.cjs'); + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/run_validate_workflows.cjs'); await main(); diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 1a5817a0e6..29fd1fd119 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -46,7 +46,7 @@ jobs: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 with: node-version: 22 - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 @@ -89,14 +89,48 @@ jobs: COPILOT_CLI_PATH: ${{ steps.setup-copilot.outputs.path }} run: mvn verify + - name: Validate reference-impl-sync completeness + if: >- + github.event_name == 'pull_request' && + contains(github.event.pull_request.labels.*.name, 'reference-impl-sync') + run: | + git fetch origin main --depth=1 + CHANGED=$(git diff --name-only origin/main...HEAD) + + # 1. .lastmerge must be updated (proves finish script ran) + if echo "$CHANGED" | grep -q '^\\.lastmerge$'; then + echo "βœ… .lastmerge was updated (finish script ran)" + else + echo "❌ .lastmerge was not updated. The merge-reference-impl-finish.sh script" + echo " must be run before this PR can merge. This script updates .lastmerge," + echo " syncs the CLI version in pom.xml, and syncs scripts/codegen/package.json." + exit 1 + fi + + # 2. If codegen inputs changed, generated output must also have changed + if echo "$CHANGED" | grep -q '^scripts/codegen/'; then + if echo "$CHANGED" | grep -q '^src/generated/java/'; then + echo "βœ… Codegen inputs changed and generated files were regenerated" + else + echo "❌ scripts/codegen/ was updated but src/generated/java/ has no changes." + echo " The Codegen Check workflow should regenerate these files automatically." + echo " If it hasn't run yet, wait for it to complete and push regenerated files." + echo " Or run manually: cd scripts/codegen && npm ci && npm run generate" + exit 1 + fi + else + echo "βœ… No codegen input changes β€” regeneration not needed" + fi + - name: Upload test results for site generation if: success() && github.ref == 'refs/heads/main' - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: name: test-results-for-site path: | target/jacoco-test-results/sdk-tests.exec target/surefire-reports/ + target/surefire-reports-isolated/ retention-days: 1 - name: Generate JaCoCo badge @@ -105,7 +139,7 @@ jobs: - name: Create PR for JaCoCo badge update if: success() && github.ref == 'refs/heads/main' - uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7 + uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v7 with: commit-message: "Update JaCoCo coverage badge" title: "Update JaCoCo coverage badge" diff --git a/.github/workflows/codegen-agentic-fix.lock.yml b/.github/workflows/codegen-agentic-fix.lock.yml new file mode 100644 index 0000000000..f5ab2030d5 --- /dev/null +++ b/.github/workflows/codegen-agentic-fix.lock.yml @@ -0,0 +1,1376 @@ +# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"70880e5fb9ec78342cf56974b2414d8cf0a516533e201e437835164543ef58c0","compiler_version":"v0.71.5","strict":true,"agent_id":"copilot"} +# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_CI_TRIGGER_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"373c709c69115d41ff229c7e5df9f8788daa9553","version":"v9"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"b8068426813005612b960b5ab0b8bd2c27142323","version":"v0.71.5"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.40","digest":"sha256:14ff567e8d9d4c2fbc5e55c973488381c71d7e0fdbe72d30ee7b8a738fd86504","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.25.40@sha256:14ff567e8d9d4c2fbc5e55c973488381c71d7e0fdbe72d30ee7b8a738fd86504"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.40","digest":"sha256:2883ca3e5ae9f330cafdd9345bfd4ae17fc8da36c96d4c9a1f76e922b4c45280","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.40@sha256:2883ca3e5ae9f330cafdd9345bfd4ae17fc8da36c96d4c9a1f76e922b4c45280"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.40","digest":"sha256:b084f4a2c771f584ee68084ced52fa6b3245197a1889645d817462d307d3ac51","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.25.40@sha256:b084f4a2c771f584ee68084ced52fa6b3245197a1889645d817462d307d3ac51"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.6","digest":"sha256:2bb8eef86006a4c5963c55616a9c51c32f27bfdecb023b8aa6f91f6718d9171c","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.6@sha256:2bb8eef86006a4c5963c55616a9c51c32f27bfdecb023b8aa6f91f6718d9171c"},{"image":"ghcr.io/github/github-mcp-server:v1.0.3","digest":"sha256:2ac27ef03461ef2b877031b838a7d1fd7f12b12d4ace7796d8cad91446d55959","pinned_image":"ghcr.io/github/github-mcp-server:v1.0.3@sha256:2ac27ef03461ef2b877031b838a7d1fd7f12b12d4ace7796d8cad91446d55959"},{"image":"node:lts-alpine","digest":"sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f","pinned_image":"node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f"}]} +# ___ _ _ +# / _ \ | | (_) +# | |_| | __ _ ___ _ __ | |_ _ ___ +# | _ |/ _` |/ _ \ '_ \| __| |/ __| +# | | | | (_| | __/ | | | |_| | (__ +# \_| |_/\__, |\___|_| |_|\__|_|\___| +# __/ | +# _ _ |___/ +# | | | | / _| | +# | | | | ___ _ __ _ __| |_| | _____ ____ +# | |/\| |/ _ \ '__| |/ /| _| |/ _ \ \ /\ / / ___| +# \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \ +# \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/ +# +# This file was automatically generated by gh-aw (v0.71.5). DO NOT EDIT. +# +# To update this file, edit the corresponding .md file and run: +# gh aw compile +# Not all edits will cause changes to this file. +# +# For more information: https://github.github.com/gh-aw/introduction/overview/ +# +# Agentic fix for codegen-related build/test failures. Invoked when +# mvn verify fails after code generation changes. +# +# Secrets used: +# - COPILOT_GITHUB_TOKEN +# - GH_AW_CI_TRIGGER_TOKEN +# - GH_AW_GITHUB_MCP_SERVER_TOKEN +# - GH_AW_GITHUB_TOKEN +# - GITHUB_TOKEN +# +# Custom actions used: +# - actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 +# - actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 +# - actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 +# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 +# - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 +# - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 +# - github/gh-aw-actions/setup@b8068426813005612b960b5ab0b8bd2c27142323 # v0.71.5 +# +# Container images used: +# - ghcr.io/github/gh-aw-firewall/agent:0.25.40@sha256:14ff567e8d9d4c2fbc5e55c973488381c71d7e0fdbe72d30ee7b8a738fd86504 +# - ghcr.io/github/gh-aw-firewall/api-proxy:0.25.40@sha256:2883ca3e5ae9f330cafdd9345bfd4ae17fc8da36c96d4c9a1f76e922b4c45280 +# - ghcr.io/github/gh-aw-firewall/squid:0.25.40@sha256:b084f4a2c771f584ee68084ced52fa6b3245197a1889645d817462d307d3ac51 +# - ghcr.io/github/gh-aw-mcpg:v0.3.6@sha256:2bb8eef86006a4c5963c55616a9c51c32f27bfdecb023b8aa6f91f6718d9171c +# - ghcr.io/github/github-mcp-server:v1.0.3@sha256:2ac27ef03461ef2b877031b838a7d1fd7f12b12d4ace7796d8cad91446d55959 +# - node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f + +name: "Codegen Agentic Fix" +"on": + workflow_dispatch: + inputs: + aw_context: + default: "" + description: Agent caller context (used internally by Agentic Workflows). + required: false + type: string + branch: + description: Branch to fix + required: true + type: string + error_summary: + description: Summary of mvn verify failures + required: true + type: string + pr_number: + description: PR number to push fixes to + required: true + type: string + +permissions: {} + +concurrency: + group: "gh-aw-${{ github.workflow }}-${{ github.ref || github.run_id }}" + +run-name: "Codegen Agentic Fix" + +jobs: + activation: + runs-on: ubuntu-slim + permissions: + actions: read + contents: read + outputs: + comment_id: "" + comment_repo: "" + engine_id: ${{ steps.generate_aw_info.outputs.engine_id }} + lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }} + model: ${{ steps.generate_aw_info.outputs.model }} + secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }} + setup-trace-id: ${{ steps.setup.outputs.trace-id }} + stale_lock_file_failed: ${{ steps.check-lock-file.outputs.stale_lock_file_failed == 'true' }} + steps: + - name: Setup Scripts + id: setup + uses: github/gh-aw-actions/setup@b8068426813005612b960b5ab0b8bd2c27142323 # v0.71.5 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Codegen Agentic Fix" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/codegen-agentic-fix.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.40" + - name: Generate agentic run info + id: generate_aw_info + env: + GH_AW_INFO_ENGINE_ID: "copilot" + GH_AW_INFO_ENGINE_NAME: "GitHub Copilot CLI" + GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || 'claude-sonnet-4.6' }} + GH_AW_INFO_VERSION: "1.0.40" + GH_AW_INFO_AGENT_VERSION: "1.0.40" + GH_AW_INFO_CLI_VERSION: "v0.71.5" + GH_AW_INFO_WORKFLOW_NAME: "Codegen Agentic Fix" + GH_AW_INFO_EXPERIMENTAL: "false" + GH_AW_INFO_SUPPORTS_TOOLS_ALLOWLIST: "true" + GH_AW_INFO_STAGED: "false" + GH_AW_INFO_ALLOWED_DOMAINS: '["defaults","github"]' + GH_AW_INFO_FIREWALL_ENABLED: "true" + GH_AW_INFO_AWF_VERSION: "v0.25.40" + GH_AW_INFO_AWMG_VERSION: "" + GH_AW_INFO_FIREWALL_TYPE: "squid" + GH_AW_COMPILED_STRICT: "true" + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/generate_aw_info.cjs'); + await main(core, context); + - name: Validate COPILOT_GITHUB_TOKEN secret + id: validate-secret + run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_multi_secret.sh" COPILOT_GITHUB_TOKEN 'GitHub Copilot CLI' https://github.github.com/gh-aw/reference/engines/#github-copilot-default + env: + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + - name: Checkout .github and .agents folders + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + sparse-checkout: | + .github + .agents + .claude + .codex + .crush + .gemini + .opencode + .pi + sparse-checkout-cone-mode: true + fetch-depth: 1 + - name: Save agent config folders for base branch restoration + env: + GH_AW_AGENT_FOLDERS: ".agents .claude .codex .crush .gemini .github .opencode .pi" + GH_AW_AGENT_FILES: ".crush.json AGENTS.md CLAUDE.md GEMINI.md PI.md opencode.jsonc" + # poutine:ignore untrusted_checkout_exec + run: bash "${RUNNER_TEMP}/gh-aw/actions/save_base_github_folders.sh" + - name: Check workflow lock file + id: check-lock-file + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_WORKFLOW_FILE: "codegen-agentic-fix.lock.yml" + GH_AW_CONTEXT_WORKFLOW_REF: "${{ github.workflow_ref }}" + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/check_workflow_timestamp_api.cjs'); + await main(); + - name: Check compile-agentic version + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_COMPILED_VERSION: "v0.71.5" + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/check_version_updates.cjs'); + await main(); + - name: Create prompt with built-in context + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_SAFE_OUTPUTS: ${{ runner.temp }}/gh-aw/safeoutputs/outputs.jsonl + GH_AW_GITHUB_ACTOR: ${{ github.actor }} + GH_AW_GITHUB_EVENT_COMMENT_ID: ${{ github.event.comment.id }} + GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: ${{ github.event.discussion.number }} + GH_AW_GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }} + GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} + GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} + GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} + GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }} + GH_AW_INPUTS_BRANCH: ${{ inputs.branch }} + GH_AW_INPUTS_ERROR_SUMMARY: ${{ inputs.error_summary }} + GH_AW_INPUTS_PR_NUMBER: ${{ inputs.pr_number }} + # poutine:ignore untrusted_checkout_exec + run: | + bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh" + { + cat << 'GH_AW_PROMPT_d94a435f1fbdc38f_EOF' + + GH_AW_PROMPT_d94a435f1fbdc38f_EOF + cat "${RUNNER_TEMP}/gh-aw/prompts/xpia.md" + cat "${RUNNER_TEMP}/gh-aw/prompts/temp_folder_prompt.md" + cat "${RUNNER_TEMP}/gh-aw/prompts/markdown.md" + cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md" + cat << 'GH_AW_PROMPT_d94a435f1fbdc38f_EOF' + + Tools: add_comment(max:5), push_to_pull_request_branch, missing_tool, missing_data, noop + GH_AW_PROMPT_d94a435f1fbdc38f_EOF + cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_push_to_pr_branch.md" + cat << 'GH_AW_PROMPT_d94a435f1fbdc38f_EOF' + + GH_AW_PROMPT_d94a435f1fbdc38f_EOF + cat "${RUNNER_TEMP}/gh-aw/prompts/mcp_cli_tools_prompt.md" + cat << 'GH_AW_PROMPT_d94a435f1fbdc38f_EOF' + + The following GitHub context information is available for this workflow: + {{#if __GH_AW_GITHUB_ACTOR__ }} + - **actor**: __GH_AW_GITHUB_ACTOR__ + {{/if}} + {{#if __GH_AW_GITHUB_REPOSITORY__ }} + - **repository**: __GH_AW_GITHUB_REPOSITORY__ + {{/if}} + {{#if __GH_AW_GITHUB_WORKSPACE__ }} + - **workspace**: __GH_AW_GITHUB_WORKSPACE__ + {{/if}} + {{#if __GH_AW_GITHUB_EVENT_ISSUE_NUMBER__ }} + - **issue-number**: #__GH_AW_GITHUB_EVENT_ISSUE_NUMBER__ + {{/if}} + {{#if __GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER__ }} + - **discussion-number**: #__GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER__ + {{/if}} + {{#if __GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER__ }} + - **pull-request-number**: #__GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER__ + {{/if}} + {{#if __GH_AW_GITHUB_EVENT_COMMENT_ID__ }} + - **comment-id**: __GH_AW_GITHUB_EVENT_COMMENT_ID__ + {{/if}} + {{#if __GH_AW_GITHUB_RUN_ID__ }} + - **workflow-run-id**: __GH_AW_GITHUB_RUN_ID__ + {{/if}} + + + GH_AW_PROMPT_d94a435f1fbdc38f_EOF + cat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md" + cat << 'GH_AW_PROMPT_d94a435f1fbdc38f_EOF' + + {{#runtime-import .github/workflows/codegen-agentic-fix.md}} + GH_AW_PROMPT_d94a435f1fbdc38f_EOF + } > "$GH_AW_PROMPT" + - name: Interpolate variables and render templates + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_ENGINE_ID: "copilot" + GH_AW_INPUTS_BRANCH: ${{ inputs.branch }} + GH_AW_INPUTS_ERROR_SUMMARY: ${{ inputs.error_summary }} + GH_AW_INPUTS_PR_NUMBER: ${{ inputs.pr_number }} + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/interpolate_prompt.cjs'); + await main(); + - name: Substitute placeholders + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_GITHUB_ACTOR: ${{ github.actor }} + GH_AW_GITHUB_EVENT_COMMENT_ID: ${{ github.event.comment.id }} + GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: ${{ github.event.discussion.number }} + GH_AW_GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }} + GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} + GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} + GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} + GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }} + GH_AW_INPUTS_BRANCH: ${{ inputs.branch }} + GH_AW_INPUTS_ERROR_SUMMARY: ${{ inputs.error_summary }} + GH_AW_INPUTS_PR_NUMBER: ${{ inputs.pr_number }} + GH_AW_MCP_CLI_SERVERS_LIST: '- `safeoutputs` β€” run `safeoutputs --help` to see available tools' + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + + const substitutePlaceholders = require('${{ runner.temp }}/gh-aw/actions/substitute_placeholders.cjs'); + + // Call the substitution function + return await substitutePlaceholders({ + file: process.env.GH_AW_PROMPT, + substitutions: { + GH_AW_GITHUB_ACTOR: process.env.GH_AW_GITHUB_ACTOR, + GH_AW_GITHUB_EVENT_COMMENT_ID: process.env.GH_AW_GITHUB_EVENT_COMMENT_ID, + GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: process.env.GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER, + GH_AW_GITHUB_EVENT_ISSUE_NUMBER: process.env.GH_AW_GITHUB_EVENT_ISSUE_NUMBER, + GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: process.env.GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER, + GH_AW_GITHUB_REPOSITORY: process.env.GH_AW_GITHUB_REPOSITORY, + GH_AW_GITHUB_RUN_ID: process.env.GH_AW_GITHUB_RUN_ID, + GH_AW_GITHUB_WORKSPACE: process.env.GH_AW_GITHUB_WORKSPACE, + GH_AW_INPUTS_BRANCH: process.env.GH_AW_INPUTS_BRANCH, + GH_AW_INPUTS_ERROR_SUMMARY: process.env.GH_AW_INPUTS_ERROR_SUMMARY, + GH_AW_INPUTS_PR_NUMBER: process.env.GH_AW_INPUTS_PR_NUMBER, + GH_AW_MCP_CLI_SERVERS_LIST: process.env.GH_AW_MCP_CLI_SERVERS_LIST + } + }); + - name: Validate prompt placeholders + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + # poutine:ignore untrusted_checkout_exec + run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_prompt_placeholders.sh" + - name: Print prompt + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + # poutine:ignore untrusted_checkout_exec + run: bash "${RUNNER_TEMP}/gh-aw/actions/print_prompt_summary.sh" + - name: Upload activation artifact + if: success() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: activation + include-hidden-files: true + path: | + /tmp/gh-aw/aw_info.json + /tmp/gh-aw/aw-prompts/prompt.txt + /tmp/gh-aw/github_rate_limits.jsonl + /tmp/gh-aw/base + if-no-files-found: ignore + retention-days: 1 + + agent: + needs: activation + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + env: + DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} + GH_AW_ASSETS_ALLOWED_EXTS: "" + GH_AW_ASSETS_BRANCH: "" + GH_AW_ASSETS_MAX_SIZE_KB: 0 + GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs + GH_AW_WORKFLOW_ID_SANITIZED: codegenagenticfix + outputs: + agentic_engine_timeout: ${{ steps.detect-copilot-errors.outputs.agentic_engine_timeout || 'false' }} + checkout_pr_success: ${{ steps.checkout-pr.outputs.checkout_pr_success || 'true' }} + effective_tokens: ${{ steps.parse-mcp-gateway.outputs.effective_tokens }} + has_patch: ${{ steps.collect_output.outputs.has_patch }} + inference_access_error: ${{ steps.detect-copilot-errors.outputs.inference_access_error || 'false' }} + mcp_policy_error: ${{ steps.detect-copilot-errors.outputs.mcp_policy_error || 'false' }} + model: ${{ needs.activation.outputs.model }} + model_not_supported_error: ${{ steps.detect-copilot-errors.outputs.model_not_supported_error || 'false' }} + output: ${{ steps.collect_output.outputs.output }} + output_types: ${{ steps.collect_output.outputs.output_types }} + setup-trace-id: ${{ steps.setup.outputs.trace-id }} + steps: + - name: Setup Scripts + id: setup + uses: github/gh-aw-actions/setup@b8068426813005612b960b5ab0b8bd2c27142323 # v0.71.5 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + trace-id: ${{ needs.activation.outputs.setup-trace-id }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Codegen Agentic Fix" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/codegen-agentic-fix.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.40" + - name: Set runtime paths + id: set-runtime-paths + run: | + { + echo "GH_AW_SAFE_OUTPUTS=${RUNNER_TEMP}/gh-aw/safeoutputs/outputs.jsonl" + echo "GH_AW_SAFE_OUTPUTS_CONFIG_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" + echo "GH_AW_SAFE_OUTPUTS_TOOLS_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/tools.json" + } >> "$GITHUB_OUTPUT" + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - name: Create gh-aw temp directory + run: bash "${RUNNER_TEMP}/gh-aw/actions/create_gh_aw_tmp_dir.sh" + - name: Configure gh CLI for GitHub Enterprise + run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_gh_for_ghe.sh" + env: + GH_TOKEN: ${{ github.token }} + - name: Configure Git credentials + env: + REPO_NAME: ${{ github.repository }} + SERVER_URL: ${{ github.server_url }} + GITHUB_TOKEN: ${{ github.token }} + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + git config --global am.keepcr true + # Re-authenticate git with GitHub token + SERVER_URL_STRIPPED="${SERVER_URL#https://}" + git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git" + echo "Git configured with standard GitHub Actions identity" + - name: Checkout PR branch + id: checkout-pr + if: | + github.event.pull_request || github.event.issue.pull_request + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + with: + github-token: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/checkout_pr_branch.cjs'); + await main(); + - name: Install GitHub Copilot CLI + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.40 + env: + GH_HOST: github.com + - name: Install AWF binary + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.25.40 + - name: Determine automatic lockdown mode for GitHub MCP Server + id: determine-automatic-lockdown + uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + env: + GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} + GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }} + with: + script: | + const determineAutomaticLockdown = require('${{ runner.temp }}/gh-aw/actions/determine_automatic_lockdown.cjs'); + await determineAutomaticLockdown(github, context, core); + - name: Download activation artifact + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: activation + path: /tmp/gh-aw + - name: Restore agent config folders from base branch + if: steps.checkout-pr.outcome == 'success' + env: + GH_AW_AGENT_FOLDERS: ".agents .claude .codex .crush .gemini .github .opencode .pi" + GH_AW_AGENT_FILES: ".crush.json AGENTS.md CLAUDE.md GEMINI.md PI.md opencode.jsonc" + run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_base_github_folders.sh" + - name: Download container images + run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.40@sha256:14ff567e8d9d4c2fbc5e55c973488381c71d7e0fdbe72d30ee7b8a738fd86504 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.40@sha256:2883ca3e5ae9f330cafdd9345bfd4ae17fc8da36c96d4c9a1f76e922b4c45280 ghcr.io/github/gh-aw-firewall/squid:0.25.40@sha256:b084f4a2c771f584ee68084ced52fa6b3245197a1889645d817462d307d3ac51 ghcr.io/github/gh-aw-mcpg:v0.3.6@sha256:2bb8eef86006a4c5963c55616a9c51c32f27bfdecb023b8aa6f91f6718d9171c ghcr.io/github/github-mcp-server:v1.0.3@sha256:2ac27ef03461ef2b877031b838a7d1fd7f12b12d4ace7796d8cad91446d55959 node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f + - name: Generate Safe Outputs Config + run: | + mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs" + mkdir -p /tmp/gh-aw/safeoutputs + mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs + cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_b6e7bb90508de076_EOF' + {"add_comment":{"max":5,"target":"*"},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"false"},"push_to_pull_request_branch":{"if_no_changes":"warn","labels":["dependencies"],"max_patch_size":1024,"protect_top_level_dot_folders":true,"protected_files":["package.json","bun.lockb","bunfig.toml","deno.json","deno.jsonc","deno.lock","global.json","NuGet.Config","Directory.Packages.props","mix.exs","mix.lock","go.mod","go.sum","stack.yaml","stack.yaml.lock","pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties","package-lock.json","yarn.lock","pnpm-lock.yaml","npm-shrinkwrap.json","requirements.txt","Pipfile","Pipfile.lock","pyproject.toml","setup.py","setup.cfg","Gemfile","Gemfile.lock","uv.lock","CODEOWNERS","DESIGN.md","README.md","CONTRIBUTING.md","CHANGELOG.md","SECURITY.md","CODE_OF_CONDUCT.md","AGENTS.md","CLAUDE.md","GEMINI.md"],"target":"*"},"report_incomplete":{}} + GH_AW_SAFE_OUTPUTS_CONFIG_b6e7bb90508de076_EOF + - name: Generate Safe Outputs Tools + env: + GH_AW_TOOLS_META_JSON: | + { + "description_suffixes": { + "add_comment": " CONSTRAINTS: Maximum 5 comment(s) can be added. Target: *. Supports reply_to_id for discussion threading." + }, + "repo_params": {}, + "dynamic_tools": [] + } + GH_AW_VALIDATION_JSON: | + { + "add_comment": { + "defaultMax": 1, + "fields": { + "body": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 65000 + }, + "item_number": { + "issueOrPRNumber": true + }, + "reply_to_id": { + "type": "string", + "maxLength": 256 + }, + "repo": { + "type": "string", + "maxLength": 256 + } + } + }, + "missing_data": { + "defaultMax": 20, + "fields": { + "alternatives": { + "type": "string", + "sanitize": true, + "maxLength": 256 + }, + "context": { + "type": "string", + "sanitize": true, + "maxLength": 256 + }, + "data_type": { + "type": "string", + "sanitize": true, + "maxLength": 128 + }, + "reason": { + "type": "string", + "sanitize": true, + "maxLength": 256 + } + } + }, + "missing_tool": { + "defaultMax": 20, + "fields": { + "alternatives": { + "type": "string", + "sanitize": true, + "maxLength": 512 + }, + "reason": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 256 + }, + "tool": { + "type": "string", + "sanitize": true, + "maxLength": 128 + } + } + }, + "noop": { + "defaultMax": 1, + "fields": { + "message": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 65000 + } + } + }, + "push_to_pull_request_branch": { + "defaultMax": 1, + "fields": { + "branch": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 256 + }, + "message": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 65000 + }, + "pull_request_number": { + "issueOrPRNumber": true + } + } + }, + "report_incomplete": { + "defaultMax": 5, + "fields": { + "details": { + "type": "string", + "sanitize": true, + "maxLength": 65000 + }, + "reason": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 1024 + } + } + } + } + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/generate_safe_outputs_tools.cjs'); + await main(); + - name: Generate Safe Outputs MCP Server Config + id: safe-outputs-config + run: | + # Generate a secure random API key (360 bits of entropy, 40+ chars) + # Mask immediately to prevent timing vulnerabilities + API_KEY=$(openssl rand -base64 45 | tr -d '/+=') + echo "::add-mask::${API_KEY}" + + PORT=3001 + + # Set outputs for next steps + { + echo "safe_outputs_api_key=${API_KEY}" + echo "safe_outputs_port=${PORT}" + } >> "$GITHUB_OUTPUT" + + echo "Safe Outputs MCP server will run on port ${PORT}" + + - name: Start Safe Outputs MCP HTTP Server + id: safe-outputs-start + env: + DEBUG: '*' + GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} + GH_AW_SAFE_OUTPUTS_PORT: ${{ steps.safe-outputs-config.outputs.safe_outputs_port }} + GH_AW_SAFE_OUTPUTS_API_KEY: ${{ steps.safe-outputs-config.outputs.safe_outputs_api_key }} + GH_AW_SAFE_OUTPUTS_TOOLS_PATH: ${{ runner.temp }}/gh-aw/safeoutputs/tools.json + GH_AW_SAFE_OUTPUTS_CONFIG_PATH: ${{ runner.temp }}/gh-aw/safeoutputs/config.json + GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs + run: | + # Environment variables are set above to prevent template injection + export DEBUG + export GH_AW_SAFE_OUTPUTS + export GH_AW_SAFE_OUTPUTS_PORT + export GH_AW_SAFE_OUTPUTS_API_KEY + export GH_AW_SAFE_OUTPUTS_TOOLS_PATH + export GH_AW_SAFE_OUTPUTS_CONFIG_PATH + export GH_AW_MCP_LOG_DIR + + bash "${RUNNER_TEMP}/gh-aw/actions/start_safe_outputs_server.sh" + + - name: Start MCP Gateway + id: start-mcp-gateway + env: + GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} + GH_AW_SAFE_OUTPUTS_API_KEY: ${{ steps.safe-outputs-start.outputs.api_key }} + GH_AW_SAFE_OUTPUTS_PORT: ${{ steps.safe-outputs-start.outputs.port }} + GITHUB_MCP_GUARD_MIN_INTEGRITY: ${{ steps.determine-automatic-lockdown.outputs.min_integrity }} + GITHUB_MCP_GUARD_REPOS: ${{ steps.determine-automatic-lockdown.outputs.repos }} + GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + run: | + set -eo pipefail + mkdir -p "${RUNNER_TEMP}/gh-aw/mcp-config" + + # Export gateway environment variables for MCP config and gateway script + export MCP_GATEWAY_PORT="8080" + export MCP_GATEWAY_DOMAIN="host.docker.internal" + export MCP_GATEWAY_HOST_DOMAIN="localhost" + MCP_GATEWAY_API_KEY=$(openssl rand -base64 45 | tr -d '/+=') + echo "::add-mask::${MCP_GATEWAY_API_KEY}" + export MCP_GATEWAY_API_KEY + export MCP_GATEWAY_PAYLOAD_DIR="/tmp/gh-aw/mcp-payloads" + mkdir -p "${MCP_GATEWAY_PAYLOAD_DIR}" + export MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD="524288" + export DEBUG="*" + + export GH_AW_ENGINE="copilot" + MCP_GATEWAY_UID=$(id -u 2>/dev/null || echo '0') + MCP_GATEWAY_GID=$(id -g 2>/dev/null || echo '0') + DOCKER_SOCK_GID=$(stat -c '%g' /var/run/docker.sock 2>/dev/null || echo '0') + export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host --add-host host.docker.internal:127.0.0.1 --user '"${MCP_GATEWAY_UID}"':'"${MCP_GATEWAY_GID}"' --group-add '"${DOCKER_SOCK_GID}"' -v /var/run/docker.sock:/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_GUARD_MIN_INTEGRITY -e GITHUB_MCP_GUARD_REPOS -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.3.6' + + mkdir -p /home/runner/.copilot + GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node) + cat << GH_AW_MCP_CONFIG_f8f308e27510535f_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs" + { + "mcpServers": { + "github": { + "type": "stdio", + "container": "ghcr.io/github/github-mcp-server:v1.0.3", + "env": { + "GITHUB_HOST": "\${GITHUB_SERVER_URL}", + "GITHUB_PERSONAL_ACCESS_TOKEN": "\${GITHUB_MCP_SERVER_TOKEN}", + "GITHUB_READ_ONLY": "1", + "GITHUB_TOOLSETS": "context,repos" + }, + "guard-policies": { + "allow-only": { + "min-integrity": "$GITHUB_MCP_GUARD_MIN_INTEGRITY", + "repos": "$GITHUB_MCP_GUARD_REPOS" + } + } + }, + "safeoutputs": { + "type": "http", + "url": "http://host.docker.internal:$GH_AW_SAFE_OUTPUTS_PORT", + "headers": { + "Authorization": "\${GH_AW_SAFE_OUTPUTS_API_KEY}" + }, + "guard-policies": { + "write-sink": { + "accept": [ + "*" + ] + } + } + } + }, + "gateway": { + "port": $MCP_GATEWAY_PORT, + "domain": "${MCP_GATEWAY_DOMAIN}", + "apiKey": "${MCP_GATEWAY_API_KEY}", + "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}" + } + } + GH_AW_MCP_CONFIG_f8f308e27510535f_EOF + - name: Mount MCP servers as CLIs + id: mount-mcp-clis + continue-on-error: true + env: + MCP_GATEWAY_API_KEY: ${{ steps.start-mcp-gateway.outputs.gateway-api-key }} + MCP_GATEWAY_DOMAIN: ${{ steps.start-mcp-gateway.outputs.gateway-domain }} + MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }} + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('${{ runner.temp }}/gh-aw/actions/mount_mcp_as_cli.cjs'); + await main(); + - name: Clean credentials + continue-on-error: true + run: bash "${RUNNER_TEMP}/gh-aw/actions/clean_git_credentials.sh" + - name: Audit pre-agent workspace + id: pre_agent_audit + continue-on-error: true + run: bash "${RUNNER_TEMP}/gh-aw/actions/audit_pre_agent_workspace.sh" + - name: Execute GitHub Copilot CLI + id: agentic_execution + # Copilot CLI tool arguments (sorted): + timeout-minutes: 60 + run: | + set -o pipefail + touch /tmp/gh-aw/agent-step-summary.md + GH_AW_NODE_BIN=$(command -v node 2>/dev/null || true) + export GH_AW_NODE_BIN + (umask 177 && touch /tmp/gh-aw/agent-stdio.log) + printf '%s\n' '{"$schema":"https://github.com/github/gh-aw-firewall/releases/download/v0.25.40/awf-config.schema.json","network":{"allowDomains":["*.githubusercontent.com","api.business.githubcopilot.com","api.enterprise.githubcopilot.com","api.github.com","api.githubcopilot.com","api.individual.githubcopilot.com","api.snapcraft.io","archive.ubuntu.com","azure.archive.ubuntu.com","codeload.github.com","crl.geotrust.com","crl.globalsign.com","crl.identrust.com","crl.sectigo.com","crl.thawte.com","crl.usertrust.com","crl.verisign.com","crl3.digicert.com","crl4.digicert.com","crls.ssl.com","docs.github.com","github-cloud.githubusercontent.com","github-cloud.s3.amazonaws.com","github.blog","github.com","github.githubassets.com","host.docker.internal","json-schema.org","json.schemastore.org","keyserver.ubuntu.com","lfs.github.com","objects.githubusercontent.com","ocsp.digicert.com","ocsp.geotrust.com","ocsp.globalsign.com","ocsp.identrust.com","ocsp.sectigo.com","ocsp.ssl.com","ocsp.thawte.com","ocsp.usertrust.com","ocsp.verisign.com","packagecloud.io","packages.cloud.google.com","packages.microsoft.com","ppa.launchpad.net","raw.githubusercontent.com","registry.npmjs.org","s.symcb.com","s.symcd.com","security.ubuntu.com","telemetry.enterprise.githubcopilot.com","ts-crl.ws.symantec.com","ts-ocsp.ws.symantec.com","www.googleapis.com"]},"apiProxy":{"enabled":true,"models":{"auto":["large"],"deep-research":["copilot/deep-research*","google/deep-research*"],"gemini-flash":["copilot/gemini-*flash*","google/gemini-*flash*"],"gemini-pro":["copilot/gemini-*pro*","google/gemini-*pro*"],"gpt-4.1":["copilot/gpt-4.1*","openai/gpt-4.1*"],"gpt-5":["copilot/gpt-5*","openai/gpt-5*"],"gpt-5-codex":["copilot/gpt-5*codex*","openai/gpt-5*codex*"],"gpt-5-mini":["copilot/gpt-5*mini*","openai/gpt-5*mini*"],"gpt-5-nano":["copilot/gpt-5*nano*","openai/gpt-5*nano*"],"gpt-5-pro":["copilot/gpt-5*pro*","openai/gpt-5*pro*"],"haiku":["copilot/*haiku*","anthropic/*haiku*"],"large":["sonnet","gpt-5-pro","gpt-5","gemini-pro"],"mini":["haiku","gpt-5-mini","gpt-5-nano","gemini-flash"],"opus":["copilot/*opus*","anthropic/*opus*"],"reasoning":["copilot/o1*","copilot/o3*","copilot/o4*","openai/o1*","openai/o3*","openai/o4*"],"small":["mini"],"sonnet":["copilot/*sonnet*","anthropic/*sonnet*"]}},"container":{"imageTag":"0.25.40,squid=sha256:b084f4a2c771f584ee68084ced52fa6b3245197a1889645d817462d307d3ac51,agent=sha256:14ff567e8d9d4c2fbc5e55c973488381c71d7e0fdbe72d30ee7b8a738fd86504,api-proxy=sha256:2883ca3e5ae9f330cafdd9345bfd4ae17fc8da36c96d4c9a1f76e922b4c45280,cli-proxy=sha256:3e7152911d4b4b7b97beef9d3d7d924ff7902227e86001ef3838fb728d5d514c"}}' > "${RUNNER_TEMP}/gh-aw/awf-config.json" && cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json + # shellcheck disable=SC1003 + sudo -E awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" --env-all --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --allow-host-ports 80,443,8080 --skip-pull \ + -- /bin/bash -c 'export PATH="${RUNNER_TEMP}/gh-aw/mcp-cli/bin:$PATH" && export PATH="$(find /opt/hostedtoolcache /home/runner/work/_tool -maxdepth 4 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || echo node)"; fi; "$GH_AW_NODE_EXEC" ${RUNNER_TEMP}/gh-aw/actions/copilot_harness.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log + env: + COPILOT_AGENT_RUNNER_TYPE: STANDALONE + COPILOT_API_KEY: dummy-byok-key-for-offline-mode + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || 'claude-sonnet-4.6' }} + GH_AW_MCP_CONFIG: /home/runner/.copilot/mcp-config.json + GH_AW_PHASE: agent + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} + GH_AW_VERSION: v0.71.5 + GITHUB_API_URL: ${{ github.api_url }} + GITHUB_AW: true + GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows + GITHUB_HEAD_REF: ${{ github.head_ref }} + GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + GITHUB_REF_NAME: ${{ github.ref_name }} + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md + GITHUB_WORKSPACE: ${{ github.workspace }} + GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com + GIT_AUTHOR_NAME: github-actions[bot] + GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com + GIT_COMMITTER_NAME: github-actions[bot] + XDG_CONFIG_HOME: /home/runner + - name: Detect Copilot errors + id: detect-copilot-errors + if: always() + continue-on-error: true + run: node "${RUNNER_TEMP}/gh-aw/actions/detect_copilot_errors.cjs" + - name: Configure Git credentials + env: + REPO_NAME: ${{ github.repository }} + SERVER_URL: ${{ github.server_url }} + GITHUB_TOKEN: ${{ github.token }} + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + git config --global am.keepcr true + # Re-authenticate git with GitHub token + SERVER_URL_STRIPPED="${SERVER_URL#https://}" + git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git" + echo "Git configured with standard GitHub Actions identity" + - name: Copy Copilot session state files to logs + if: always() + continue-on-error: true + run: bash "${RUNNER_TEMP}/gh-aw/actions/copy_copilot_session_state.sh" + - name: Stop MCP Gateway + if: always() + continue-on-error: true + env: + MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }} + MCP_GATEWAY_API_KEY: ${{ steps.start-mcp-gateway.outputs.gateway-api-key }} + GATEWAY_PID: ${{ steps.start-mcp-gateway.outputs.gateway-pid }} + run: | + bash "${RUNNER_TEMP}/gh-aw/actions/stop_mcp_gateway.sh" "$GATEWAY_PID" + - name: Redact secrets in logs + if: always() + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/redact_secrets.cjs'); + await main(); + env: + GH_AW_SECRET_NAMES: 'COPILOT_GITHUB_TOKEN,GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' + SECRET_COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }} + SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} + SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Append agent step summary + if: always() + run: bash "${RUNNER_TEMP}/gh-aw/actions/append_agent_step_summary.sh" + - name: Copy Safe Outputs + if: always() + env: + GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} + run: | + mkdir -p /tmp/gh-aw + cp "$GH_AW_SAFE_OUTPUTS" /tmp/gh-aw/safeoutputs.jsonl 2>/dev/null || true + - name: Ingest agent output + id: collect_output + if: always() + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} + GH_AW_ALLOWED_DOMAINS: "*.githubusercontent.com,api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,codeload.github.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,docs.github.com,github-cloud.githubusercontent.com,github-cloud.s3.amazonaws.com,github.blog,github.com,github.githubassets.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,lfs.github.com,objects.githubusercontent.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com" + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_API_URL: ${{ github.api_url }} + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/collect_ndjson_output.cjs'); + await main(); + - name: Parse agent logs for step summary + if: always() + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: /tmp/gh-aw/sandbox/agent/logs/ + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_copilot_log.cjs'); + await main(); + - name: Parse MCP Gateway logs for step summary + if: always() + id: parse-mcp-gateway + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_mcp_gateway_log.cjs'); + await main(); + - name: Print firewall logs + if: always() + continue-on-error: true + env: + AWF_LOGS_DIR: /tmp/gh-aw/sandbox/firewall/logs + run: | + # Fix permissions on firewall logs/audit dirs so they can be uploaded as artifacts + # AWF runs with sudo, creating files owned by root + sudo chmod -R a+r /tmp/gh-aw/sandbox/firewall 2>/dev/null || true + # Only run awf logs summary if awf command exists (it may not be installed if workflow failed before install step) + if command -v awf &> /dev/null; then + awf logs summary | tee -a "$GITHUB_STEP_SUMMARY" + else + echo 'AWF binary not installed, skipping firewall log summary' + fi + - name: Parse token usage for step summary + if: always() + continue-on-error: true + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_token_usage.cjs'); + await main(); + - name: Print AWF reflect summary + if: always() + continue-on-error: true + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/awf_reflect_summary.cjs'); + await main(); + - name: Write agent output placeholder if missing + if: always() + run: | + if [ ! -f /tmp/gh-aw/agent_output.json ]; then + echo '{"items":[]}' > /tmp/gh-aw/agent_output.json + fi + - name: Upload agent artifacts + if: always() + continue-on-error: true + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: agent + path: | + /tmp/gh-aw/aw-prompts/prompt.txt + /tmp/gh-aw/sandbox/agent/logs/ + /tmp/gh-aw/redacted-urls.log + /tmp/gh-aw/mcp-logs/ + /tmp/gh-aw/agent_usage.json + /tmp/gh-aw/agent-stdio.log + /tmp/gh-aw/pre-agent-audit.txt + /tmp/gh-aw/agent/ + /tmp/gh-aw/github_rate_limits.jsonl + /tmp/gh-aw/safeoutputs.jsonl + /tmp/gh-aw/agent_output.json + /tmp/gh-aw/aw-*.patch + /tmp/gh-aw/aw-*.bundle + /tmp/gh-aw/awf-config.json + /tmp/gh-aw/sandbox/firewall/logs/ + /tmp/gh-aw/sandbox/firewall/audit/ + /tmp/gh-aw/sandbox/firewall/awf-reflect.json + if-no-files-found: ignore + + conclusion: + needs: + - activation + - agent + - detection + - safe_outputs + if: > + always() && (needs.agent.result != 'skipped' || needs.activation.outputs.lockdown_check_failed == 'true' || + needs.activation.outputs.stale_lock_file_failed == 'true') + runs-on: ubuntu-slim + permissions: + contents: write + discussions: write + issues: write + pull-requests: write + concurrency: + group: "gh-aw-conclusion-codegen-agentic-fix" + cancel-in-progress: false + outputs: + incomplete_count: ${{ steps.report_incomplete.outputs.incomplete_count }} + noop_message: ${{ steps.noop.outputs.noop_message }} + tools_reported: ${{ steps.missing_tool.outputs.tools_reported }} + total_count: ${{ steps.missing_tool.outputs.total_count }} + steps: + - name: Setup Scripts + id: setup + uses: github/gh-aw-actions/setup@b8068426813005612b960b5ab0b8bd2c27142323 # v0.71.5 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + trace-id: ${{ needs.activation.outputs.setup-trace-id }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Codegen Agentic Fix" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/codegen-agentic-fix.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.40" + - name: Download agent output artifact + id: download-agent-output + continue-on-error: true + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: agent + path: /tmp/gh-aw/ + - name: Setup agent output environment variable + id: setup-agent-output-env + if: steps.download-agent-output.outcome == 'success' + run: | + mkdir -p /tmp/gh-aw/ + find "/tmp/gh-aw/" -type f -print + echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT" + - name: Process no-op messages + id: noop + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} + GH_AW_NOOP_MAX: "1" + GH_AW_WORKFLOW_NAME: "Codegen Agentic Fix" + GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }} + GH_AW_NOOP_REPORT_AS_ISSUE: "false" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_noop_message.cjs'); + await main(); + - name: Log detection run + id: detection_runs + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} + GH_AW_WORKFLOW_NAME: "Codegen Agentic Fix" + GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }} + GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }} + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_detection_runs.cjs'); + await main(); + - name: Record missing tool + id: missing_tool + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} + GH_AW_MISSING_TOOL_CREATE_ISSUE: "true" + GH_AW_WORKFLOW_NAME: "Codegen Agentic Fix" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/missing_tool.cjs'); + await main(); + - name: Record incomplete + id: report_incomplete + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} + GH_AW_REPORT_INCOMPLETE_CREATE_ISSUE: "true" + GH_AW_WORKFLOW_NAME: "Codegen Agentic Fix" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/report_incomplete_handler.cjs'); + await main(); + - name: Handle agent failure + id: handle_agent_failure + if: always() + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} + GH_AW_WORKFLOW_NAME: "Codegen Agentic Fix" + GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }} + GH_AW_WORKFLOW_ID: "codegen-agentic-fix" + GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168" + GH_AW_ENGINE_ID: "copilot" + GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} + GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} + GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }} + GH_AW_MCP_POLICY_ERROR: ${{ needs.agent.outputs.mcp_policy_error }} + GH_AW_AGENTIC_ENGINE_TIMEOUT: ${{ needs.agent.outputs.agentic_engine_timeout }} + GH_AW_MODEL_NOT_SUPPORTED_ERROR: ${{ needs.agent.outputs.model_not_supported_error }} + GH_AW_ENGINE_API_HOSTS: "api.enterprise.githubcopilot.com,api.githubcopilot.com,api.business.githubcopilot.com,api.individual.githubcopilot.com" + GH_AW_CODE_PUSH_FAILURE_ERRORS: ${{ needs.safe_outputs.outputs.code_push_failure_errors }} + GH_AW_CODE_PUSH_FAILURE_COUNT: ${{ needs.safe_outputs.outputs.code_push_failure_count }} + GH_AW_LOCKDOWN_CHECK_FAILED: ${{ needs.activation.outputs.lockdown_check_failed }} + GH_AW_STALE_LOCK_FILE_FAILED: ${{ needs.activation.outputs.stale_lock_file_failed }} + GH_AW_GROUP_REPORTS: "false" + GH_AW_FAILURE_REPORT_AS_ISSUE: "true" + GH_AW_MISSING_TOOL_REPORT_AS_FAILURE: "true" + GH_AW_MISSING_DATA_REPORT_AS_FAILURE: "true" + GH_AW_TIMEOUT_MINUTES: "60" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_agent_failure.cjs'); + await main(); + + detection: + needs: + - activation + - agent + if: > + always() && needs.agent.result != 'skipped' && (needs.agent.outputs.output_types != '' || needs.agent.outputs.has_patch == 'true') + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }} + detection_reason: ${{ steps.detection_conclusion.outputs.reason }} + detection_success: ${{ steps.detection_conclusion.outputs.success }} + steps: + - name: Setup Scripts + id: setup + uses: github/gh-aw-actions/setup@b8068426813005612b960b5ab0b8bd2c27142323 # v0.71.5 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + trace-id: ${{ needs.activation.outputs.setup-trace-id }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Codegen Agentic Fix" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/codegen-agentic-fix.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.40" + - name: Download agent output artifact + id: download-agent-output + continue-on-error: true + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: agent + path: /tmp/gh-aw/ + - name: Setup agent output environment variable + id: setup-agent-output-env + if: steps.download-agent-output.outcome == 'success' + run: | + mkdir -p /tmp/gh-aw/ + find "/tmp/gh-aw/" -type f -print + echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT" + - name: Checkout repository for patch context + if: needs.agent.outputs.has_patch == 'true' + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + # --- Threat Detection --- + - name: Clean stale firewall files from agent artifact + run: | + rm -rf /tmp/gh-aw/sandbox/firewall/logs + rm -rf /tmp/gh-aw/sandbox/firewall/audit + - name: Download container images + run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.40@sha256:14ff567e8d9d4c2fbc5e55c973488381c71d7e0fdbe72d30ee7b8a738fd86504 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.40@sha256:2883ca3e5ae9f330cafdd9345bfd4ae17fc8da36c96d4c9a1f76e922b4c45280 ghcr.io/github/gh-aw-firewall/squid:0.25.40@sha256:b084f4a2c771f584ee68084ced52fa6b3245197a1889645d817462d307d3ac51 + - name: Check if detection needed + id: detection_guard + if: always() + env: + OUTPUT_TYPES: ${{ needs.agent.outputs.output_types }} + HAS_PATCH: ${{ needs.agent.outputs.has_patch }} + run: | + if [[ -n "$OUTPUT_TYPES" || "$HAS_PATCH" == "true" ]]; then + echo "run_detection=true" >> "$GITHUB_OUTPUT" + echo "Detection will run: output_types=$OUTPUT_TYPES, has_patch=$HAS_PATCH" + else + echo "run_detection=false" >> "$GITHUB_OUTPUT" + echo "Detection skipped: no agent outputs or patches to analyze" + fi + - name: Clear MCP Config for detection + if: always() && steps.detection_guard.outputs.run_detection == 'true' + run: | + rm -f "${RUNNER_TEMP}/gh-aw/mcp-config/mcp-servers.json" + rm -f /home/runner/.copilot/mcp-config.json + rm -f "$GITHUB_WORKSPACE/.gemini/settings.json" + - name: Prepare threat detection files + if: always() && steps.detection_guard.outputs.run_detection == 'true' + run: | + mkdir -p /tmp/gh-aw/threat-detection/aw-prompts + cp /tmp/gh-aw/aw-prompts/prompt.txt /tmp/gh-aw/threat-detection/aw-prompts/prompt.txt 2>/dev/null || true + cp /tmp/gh-aw/agent_output.json /tmp/gh-aw/threat-detection/agent_output.json 2>/dev/null || true + for f in /tmp/gh-aw/aw-*.patch; do + [ -f "$f" ] && cp "$f" /tmp/gh-aw/threat-detection/ 2>/dev/null || true + done + for f in /tmp/gh-aw/aw-*.bundle; do + [ -f "$f" ] && cp "$f" /tmp/gh-aw/threat-detection/ 2>/dev/null || true + done + echo "Prepared threat detection files:" + ls -la /tmp/gh-aw/threat-detection/ 2>/dev/null || true + - name: Setup threat detection + if: always() && steps.detection_guard.outputs.run_detection == 'true' + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + WORKFLOW_NAME: "Codegen Agentic Fix" + WORKFLOW_DESCRIPTION: "Agentic fix for codegen-related build/test failures. Invoked when\nmvn verify fails after code generation changes." + HAS_PATCH: ${{ needs.agent.outputs.has_patch }} + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/setup_threat_detection.cjs'); + await main(); + - name: Ensure threat-detection directory and log + if: always() && steps.detection_guard.outputs.run_detection == 'true' + run: | + mkdir -p /tmp/gh-aw/threat-detection + touch /tmp/gh-aw/threat-detection/detection.log + - name: Setup Node.js + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: '24' + package-manager-cache: false + - name: Install GitHub Copilot CLI + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.40 + env: + GH_HOST: github.com + - name: Install AWF binary + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.25.40 + - name: Execute GitHub Copilot CLI + if: always() && steps.detection_guard.outputs.run_detection == 'true' + continue-on-error: true + id: detection_agentic_execution + # Copilot CLI tool arguments (sorted): + timeout-minutes: 20 + run: | + set -o pipefail + touch /tmp/gh-aw/agent-step-summary.md + GH_AW_NODE_BIN=$(command -v node 2>/dev/null || true) + export GH_AW_NODE_BIN + (umask 177 && touch /tmp/gh-aw/threat-detection/detection.log) + printf '%s\n' '{"$schema":"https://github.com/github/gh-aw-firewall/releases/download/v0.25.40/awf-config.schema.json","network":{"allowDomains":["api.business.githubcopilot.com","api.enterprise.githubcopilot.com","api.github.com","api.githubcopilot.com","api.individual.githubcopilot.com","github.com","host.docker.internal","telemetry.enterprise.githubcopilot.com"]},"apiProxy":{"enabled":true},"container":{"imageTag":"0.25.40,squid=sha256:b084f4a2c771f584ee68084ced52fa6b3245197a1889645d817462d307d3ac51,agent=sha256:14ff567e8d9d4c2fbc5e55c973488381c71d7e0fdbe72d30ee7b8a738fd86504,api-proxy=sha256:2883ca3e5ae9f330cafdd9345bfd4ae17fc8da36c96d4c9a1f76e922b4c45280,cli-proxy=sha256:3e7152911d4b4b7b97beef9d3d7d924ff7902227e86001ef3838fb728d5d514c"}}' > "${RUNNER_TEMP}/gh-aw/awf-config.json" && cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json + # shellcheck disable=SC1003 + sudo -E awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" --env-all --exclude-env COPILOT_GITHUB_TOKEN --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --allow-host-ports 80,443,8080 --skip-pull \ + -- /bin/bash -c 'export PATH="$(find /opt/hostedtoolcache /home/runner/work/_tool -maxdepth 4 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || echo node)"; fi; "$GH_AW_NODE_EXEC" ${RUNNER_TEMP}/gh-aw/actions/copilot_harness.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log + env: + COPILOT_AGENT_RUNNER_TYPE: STANDALONE + COPILOT_API_KEY: dummy-byok-key-for-offline-mode + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_MODEL: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || 'claude-sonnet-4.6' }} + GH_AW_PHASE: detection + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_VERSION: v0.71.5 + GITHUB_API_URL: ${{ github.api_url }} + GITHUB_AW: true + GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows + GITHUB_HEAD_REF: ${{ github.head_ref }} + GITHUB_REF_NAME: ${{ github.ref_name }} + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md + GITHUB_WORKSPACE: ${{ github.workspace }} + GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com + GIT_AUTHOR_NAME: github-actions[bot] + GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com + GIT_COMMITTER_NAME: github-actions[bot] + XDG_CONFIG_HOME: /home/runner + - name: Upload threat detection log + if: always() && steps.detection_guard.outputs.run_detection == 'true' + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: detection + path: /tmp/gh-aw/threat-detection/detection.log + if-no-files-found: ignore + - name: Parse and conclude threat detection + id: detection_conclusion + if: always() + continue-on-error: true + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }} + GH_AW_DETECTION_CONTINUE_ON_ERROR: "true" + with: + script: | + try { + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_threat_detection_results.cjs'); + await main(); + } catch (loadErr) { + const continueOnError = process.env.GH_AW_DETECTION_CONTINUE_ON_ERROR !== 'false'; + const msg = 'ERR_SYSTEM: \u274C Unexpected error loading threat detection module: ' + (loadErr && loadErr.message ? loadErr.message : String(loadErr)); + core.error(msg); + core.setOutput('reason', 'parse_error'); + if (continueOnError) { + core.warning('\u26A0\uFE0F ' + msg); + core.setOutput('conclusion', 'warning'); + core.setOutput('success', 'false'); + } else { + core.setOutput('conclusion', 'failure'); + core.setOutput('success', 'false'); + core.setFailed(msg); + } + } + + safe_outputs: + needs: + - activation + - agent + - detection + if: (!cancelled()) && needs.agent.result != 'skipped' && needs.detection.result == 'success' + runs-on: ubuntu-slim + permissions: + contents: write + discussions: write + issues: write + pull-requests: write + timeout-minutes: 15 + env: + GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/codegen-agentic-fix" + GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }} + GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }} + GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens }} + GH_AW_ENGINE_ID: "copilot" + GH_AW_ENGINE_MODEL: ${{ needs.agent.outputs.model }} + GH_AW_ENGINE_VERSION: "1.0.40" + GH_AW_WORKFLOW_ID: "codegen-agentic-fix" + GH_AW_WORKFLOW_NAME: "Codegen Agentic Fix" + outputs: + code_push_failure_count: ${{ steps.process_safe_outputs.outputs.code_push_failure_count }} + code_push_failure_errors: ${{ steps.process_safe_outputs.outputs.code_push_failure_errors }} + comment_id: ${{ steps.process_safe_outputs.outputs.comment_id }} + comment_url: ${{ steps.process_safe_outputs.outputs.comment_url }} + create_discussion_error_count: ${{ steps.process_safe_outputs.outputs.create_discussion_error_count }} + create_discussion_errors: ${{ steps.process_safe_outputs.outputs.create_discussion_errors }} + process_safe_outputs_processed_count: ${{ steps.process_safe_outputs.outputs.processed_count }} + process_safe_outputs_temporary_id_map: ${{ steps.process_safe_outputs.outputs.temporary_id_map }} + push_commit_sha: ${{ steps.process_safe_outputs.outputs.push_commit_sha }} + push_commit_url: ${{ steps.process_safe_outputs.outputs.push_commit_url }} + steps: + - name: Setup Scripts + id: setup + uses: github/gh-aw-actions/setup@b8068426813005612b960b5ab0b8bd2c27142323 # v0.71.5 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + trace-id: ${{ needs.activation.outputs.setup-trace-id }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Codegen Agentic Fix" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/codegen-agentic-fix.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.40" + - name: Download agent output artifact + id: download-agent-output + continue-on-error: true + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: agent + path: /tmp/gh-aw/ + - name: Setup agent output environment variable + id: setup-agent-output-env + if: steps.download-agent-output.outcome == 'success' + run: | + mkdir -p /tmp/gh-aw/ + find "/tmp/gh-aw/" -type f -print + echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT" + - name: Download patch artifact + continue-on-error: true + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: agent + path: /tmp/gh-aw/ + - name: Checkout repository + if: (!cancelled()) && needs.agent.result != 'skipped' && contains(needs.agent.outputs.output_types, 'push_to_pull_request_branch') + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ github.base_ref || github.event.pull_request.base.ref || github.ref_name || github.event.repository.default_branch }} + token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + persist-credentials: false + fetch-depth: 1 + - name: Configure Git credentials + if: (!cancelled()) && needs.agent.result != 'skipped' && contains(needs.agent.outputs.output_types, 'push_to_pull_request_branch') + env: + REPO_NAME: ${{ github.repository }} + SERVER_URL: ${{ github.server_url }} + GIT_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + git config --global am.keepcr true + # Re-authenticate git with GitHub token + SERVER_URL_STRIPPED="${SERVER_URL#https://}" + git remote set-url origin "https://x-access-token:${GIT_TOKEN}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git" + echo "Git configured with standard GitHub Actions identity" + - name: Configure GH_HOST for enterprise compatibility + id: ghes-host-config + shell: bash + run: | + # Derive GH_HOST from GITHUB_SERVER_URL so the gh CLI targets the correct + # GitHub instance (GHES/GHEC). On github.com this is a harmless no-op. + GH_HOST="${GITHUB_SERVER_URL#https://}" + GH_HOST="${GH_HOST#http://}" + echo "GH_HOST=${GH_HOST}" >> "$GITHUB_ENV" + - name: Process Safe Outputs + id: process_safe_outputs + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} + GH_AW_ALLOWED_DOMAINS: "*.githubusercontent.com,api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,codeload.github.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,docs.github.com,github-cloud.githubusercontent.com,github-cloud.s3.amazonaws.com,github.blog,github.com,github.githubassets.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,lfs.github.com,objects.githubusercontent.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com" + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_API_URL: ${{ github.api_url }} + GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":5,\"target\":\"*\"},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"false\"},\"push_to_pull_request_branch\":{\"if_no_changes\":\"warn\",\"labels\":[\"dependencies\"],\"max_patch_size\":1024,\"protect_top_level_dot_folders\":true,\"protected_files\":[\"package.json\",\"bun.lockb\",\"bunfig.toml\",\"deno.json\",\"deno.jsonc\",\"deno.lock\",\"global.json\",\"NuGet.Config\",\"Directory.Packages.props\",\"mix.exs\",\"mix.lock\",\"go.mod\",\"go.sum\",\"stack.yaml\",\"stack.yaml.lock\",\"pom.xml\",\"build.gradle\",\"build.gradle.kts\",\"settings.gradle\",\"settings.gradle.kts\",\"gradle.properties\",\"package-lock.json\",\"yarn.lock\",\"pnpm-lock.yaml\",\"npm-shrinkwrap.json\",\"requirements.txt\",\"Pipfile\",\"Pipfile.lock\",\"pyproject.toml\",\"setup.py\",\"setup.cfg\",\"Gemfile\",\"Gemfile.lock\",\"uv.lock\",\"CODEOWNERS\",\"DESIGN.md\",\"README.md\",\"CONTRIBUTING.md\",\"CHANGELOG.md\",\"SECURITY.md\",\"CODE_OF_CONDUCT.md\",\"AGENTS.md\",\"CLAUDE.md\",\"GEMINI.md\"],\"target\":\"*\"},\"report_incomplete\":{}}" + GH_AW_CI_TRIGGER_TOKEN: ${{ secrets.GH_AW_CI_TRIGGER_TOKEN }} + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/safe_output_handler_manager.cjs'); + await main(); + - name: Upload Safe Outputs Items + if: always() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: safe-outputs-items + path: | + /tmp/gh-aw/safe-output-items.jsonl + /tmp/gh-aw/temporary-id-map.json + if-no-files-found: ignore + diff --git a/.github/workflows/codegen-agentic-fix.md b/.github/workflows/codegen-agentic-fix.md new file mode 100644 index 0000000000..b4aa0a8f20 --- /dev/null +++ b/.github/workflows/codegen-agentic-fix.md @@ -0,0 +1,245 @@ +--- +description: | + Agentic fix for codegen-related build/test failures. Invoked when + mvn verify fails after code generation changes. + +on: + workflow_dispatch: + inputs: + branch: + description: 'Branch to fix' + required: true + type: string + pr_number: + description: 'PR number to push fixes to' + required: true + type: string + error_summary: + description: 'Summary of mvn verify failures' + required: true + type: string + +permissions: + contents: read + actions: read + +timeout-minutes: 60 + +network: + allowed: + - defaults + - github + +tools: + github: + toolsets: [context, repos] + +safe-outputs: + push-to-pull-request-branch: + target: "*" + labels: [dependencies] + add-comment: + target: "*" + max: 5 + noop: + report-as-issue: false +--- +# Codegen Agentic Fix + +You are an automation agent that fixes Java compilation and test failures caused by code generation changes in the `copilot-sdk-java` repository. + +## Context + +A Dependabot PR bumped the `@github/copilot` npm dependency in `scripts/codegen/package.json`. The `codegen-check` workflow ran the code generator (`scripts/codegen/java.ts`) against the new schemas and `mvn verify` subsequently failed. Your job is to fix **both** the code generator script (if needed) and the handwritten SDK/test source code so the build passes. + +**❌❌❌ YOU MUST NEVER EDIT any of the java source code in `src/generated/` directly.** βœ…βœ…Rather, the way to affect changes in these files is to change the code generator script and re-generate the classes in `src/generated`. + +The branch to fix is: `${{ inputs.branch }}` +The PR number is: `${{ inputs.pr_number }}` + +The error summary from the failing build is: +``` +${{ inputs.error_summary }} +``` + +## Architecture overview + +The code generator (`scripts/codegen/java.ts`) reads JSON schemas from `node_modules/@github/copilot/schemas/` and produces Java source files under `src/generated/java/`. These generated types are consumed by handwritten code in `src/main/java/` (primarily `CopilotSession.java`) and tested by handwritten tests in `src/test/java/`. + +When `@github/copilot` is bumped, the schemas may change in ways the code generator does not yet handle. Common schema changes include: + +- **`$ref` references**: Inline nested type definitions replaced with `$ref` pointers to `#/definitions/` entries. The code generator must resolve these references and emit standalone Java types instead of nested records. +- **Field type changes**: Numeric fields changing between `double`, `Long`, `int`, etc. +- **Renamed fields/properties**: JSON property names changing (e.g. `input` β†’ `inputTokens`). +- **New types or events**: Entirely new schemas or event types added. +- **Structural changes**: Properties moving between objects, new required fields, changed enum values. + +## Instructions + +Follow these steps exactly. You have a maximum of **3 attempts** to get `mvn verify` passing. + +### Step 0: Setup + +Check out the branch and ensure the environment is ready: + +```bash +git checkout "${{ inputs.branch }}" +git pull origin "${{ inputs.branch }}" +``` + +Set up the Java 17 environment and verify Maven and Node.js are available: + +```bash +java -version +mvn --version +node --version +``` + +Install codegen dependencies: + +```bash +cd scripts/codegen && npm ci && cd ../.. +``` + +### Step 1: Reproduce the failure + +Run `mvn verify` to see the current errors: + +```bash +mvn verify 2>&1 | tee /tmp/mvn-verify.log +``` + +Review the full log at `/tmp/mvn-verify.log` if the tail output is insufficient. The earliest errors are often the root cause. + +If `mvn verify` succeeds (exit code 0), there is nothing to fix. Call the `noop` safe-output with message "mvn verify already passes on branch ${{ inputs.branch }}. No fixes needed." and stop. + +### Step 2: Diagnose the root cause + +Before making fixes, determine whether the failure is caused by: + +**(A) The code generator not handling new schema patterns.** Signs: +- Generated types are missing fields that the handwritten code references +- Generated types have wrong field types (e.g. `double` instead of `Long`) +- Types that used to be nested records are now missing (because `$ref` moved them to `#/definitions/`) +- New schemas exist but no corresponding Java types were generated + +**(B) Handwritten code referencing old generated type names/shapes.** Signs: +- Compilation errors in `src/main/java/` or `src/test/java/` referencing types that no longer exist +- Test data using old JSON field names + +Often **both** (A) and (B) apply: the codegen needs fixing first, then handwritten code needs updating. + +To diagnose, compare the current schemas with the generated output: + +```bash +# List available schemas +ls node_modules/@github/copilot/schemas/ + +# Check for $ref usage in schemas (indicates the codegen may need $ref resolution) +grep -r '"$ref"' node_modules/@github/copilot/schemas/ | head -20 + +# Look at a specific schema that relates to failing types +cat node_modules/@github/copilot/schemas/.json | head -80 +``` + +### Step 3: Fix the code generator (if needed) + +If the diagnosis shows the code generator does not handle the new schema format: + +1. **Read `scripts/codegen/java.ts`** to understand the current generation logic. + +2. **Fix `scripts/codegen/java.ts`** to handle the new schema patterns. Common fixes include: + - Adding `$ref` resolution to dereference `#/definitions/` pointers + - Generating standalone types for definitions instead of nested records + - Fixing type mappings for changed field types + +3. **Re-run code generation** to produce updated generated files: + ```bash + cd scripts/codegen && npm run generate && cd ../.. + ``` + +4. **Verify the generated output** looks reasonable: + ```bash + git diff --stat src/generated/java/ + ``` + +**You may ONLY modify `scripts/codegen/java.ts`.** Do not modify `package.json`, `package-lock.json`, or any other file under `scripts/codegen/`. + +### Step 4: Fix handwritten code (up to 3 attempts) + +For each attempt: + +1. **Read the errors carefully.** Look for: + - Compilation errors (missing methods, type mismatches, import issues) + - Test failures (assertion errors, runtime exceptions) + - The specific files and line numbers mentioned in the errors + +2. **Read the generated types** to understand what changed. Check the generated files that the handwritten code references: + ```bash + # Example: check what a generated type looks like now + cat src/generated/java/com/github/copilot/sdk/generated/rpc/.java + ``` + +3. **Fix the affected source files.** You may modify files under: + - `src/main/java/` β€” handwritten SDK source code + - `src/test/java/` β€” handwritten test code + + Common fixes: + - Update type references from old nested types to new standalone types (e.g. `SessionMcpListResultServersItem` β†’ `McpServer`) + - Fix constructor arguments for changed field types (`double` β†’ `Long`) + - Update JSON keys in test data to match renamed schema properties + - Add/remove imports for renamed/relocated types + +4. **Run formatting after making changes:** + ```bash + mvn spotless:apply + ``` + +5. **Verify the fix:** + ```bash + mvn verify 2>&1 | tee /tmp/mvn-verify.log + ``` + + If the output is long, check `/tmp/mvn-verify.log` for the full error details β€” root causes often appear early in the log. + +6. If `mvn verify` passes, proceed to Step 5. + If it fails and you have attempts remaining, go back to sub-step 1. + +### Step 5: Push fixes + +After `mvn verify` passes, commit all changes and use the `push-to-pull-request-branch` safe-output tool to push to PR #${{ inputs.pr_number }}: + +```bash +git add -A +git commit -m "Fix codegen and build failures after @github/copilot update + +Automated fix applied by codegen-agentic-fix workflow." +``` + +Then call the `push-to-pull-request-branch` tool to push your commits to the PR branch. + +### Step 6: Failure handling + +If all 3 attempts fail: + +1. Call the `add-comment` tool on PR #${{ inputs.pr_number }} explaining: + - What errors remain + - What fixes were attempted + - Whether the issue is in the code generator or handwritten code + - That manual intervention is needed + +2. Call the `noop` safe-output with a message summarizing the failure. + +Do **NOT** push broken code. + +## Important constraints + +- **NEVER** hand-edit files under `src/generated/java/` β€” these are auto-generated. They are updated by running `cd scripts/codegen && npm run generate`. +- **NEVER** modify `pom.xml` β€” build config is not in scope +- **NEVER** modify `scripts/codegen/package.json` or `scripts/codegen/package-lock.json` β€” dependency versions are not in scope +- **NEVER** modify files under `.github/` β€” workflow files are not in scope +- You **MAY** modify `scripts/codegen/java.ts` to fix the code generator +- You **MAY** modify files under `src/main/java/` and `src/test/java/` to fix handwritten code +- Always run `mvn spotless:apply` before committing to ensure code formatting +- Maximum 3 fix attempts before reporting failure via `noop` +- Only push if `mvn verify` passes diff --git a/.github/workflows/codegen-check.yml b/.github/workflows/codegen-check.yml index 675629c1e0..95e9365782 100644 --- a/.github/workflows/codegen-check.yml +++ b/.github/workflows/codegen-check.yml @@ -11,8 +11,19 @@ on: - '.github/workflows/codegen-check.yml' workflow_dispatch: +# Permissions: contents: write and pull-requests: write are needed to push +# regenerated files back to PR branches. actions: write is needed to trigger +# the agentic fix workflow via gh workflow run. +# +# Dependabot PR caveat: Workflows triggered by pull_request from Dependabot +# run with a read-only GITHUB_TOKEN regardless of declared permissions. +# The push step uses continue-on-error to handle this gracefully β€” if the +# push fails (Dependabot), the agentic fix workflow will handle pushing +# via its own push-to-pull-request-branch safe-output. permissions: - contents: read + contents: write + pull-requests: write + actions: write jobs: check: @@ -20,8 +31,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + # For PRs, check out the PR head so we can push back to it + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 with: node-version: 22 @@ -34,11 +49,143 @@ jobs: run: npm run generate - name: Check for uncommitted changes + id: check-changes run: | if [ -n "$(git status --porcelain)" ]; then - echo "::error::Generated files are out of date. Run 'cd scripts/codegen && npm run generate' and commit the changes." + echo "changed=true" >> "$GITHUB_OUTPUT" + echo "Generated files are out of date." git diff --stat - git diff - exit 1 + else + echo "changed=false" >> "$GITHUB_OUTPUT" + echo "βœ… Generated files are up-to-date" fi - echo "βœ… Generated files are up-to-date" + + # --- On push to main: fail if generated files are stale (existing behavior) --- + - name: Fail on stale generated files (push to main) + if: steps.check-changes.outputs.changed == 'true' && github.event_name != 'pull_request' + run: | + echo "::error::Generated files are out of date. Run 'cd scripts/codegen && npm run generate' and commit the changes." + git diff + exit 1 + + # --- On PR: commit regenerated files back and verify build --- + - name: Commit and push regenerated files to PR branch + id: push-regen + if: steps.check-changes.outputs.changed == 'true' && github.event_name == 'pull_request' + continue-on-error: true + env: + GH_TOKEN: ${{ github.token }} + HEAD_REF: ${{ github.head_ref }} + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add -A + git commit -m "Regenerate codegen output + + Auto-committed by codegen-check workflow." + git push origin "HEAD:$HEAD_REF" + + - name: Fail if regenerated files could not be pushed + if: steps.push-regen.outcome == 'failure' + run: | + echo "::error::Could not push regenerated files to the PR branch. This is expected for Dependabot PRs (read-only token) and fork PRs." + echo "To fix: check out this PR branch locally, run 'cd scripts/codegen && npm run generate', commit, and push." + exit 1 + + - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + if: steps.push-regen.outcome == 'success' + with: + java-version: "17" + distribution: "microsoft" + cache: "maven" + + - name: Run mvn verify + id: mvn-verify + if: steps.push-regen.outcome == 'success' + continue-on-error: true + env: + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + run: | + set -o pipefail + mvn verify 2>&1 | tee /tmp/mvn-verify-output.txt + echo "exit_code=$?" >> "$GITHUB_OUTPUT" + + - name: Capture error summary + id: error-summary + if: steps.mvn-verify.outcome == 'failure' + run: | + SUMMARY=$(tail -80 /tmp/mvn-verify-output.txt) + echo "$SUMMARY" > /tmp/error-summary.txt + echo "has_errors=true" >> "$GITHUB_OUTPUT" + + - name: Trigger agentic fix workflow + id: trigger-fix + if: steps.error-summary.outputs.has_errors == 'true' && steps.push-regen.outcome == 'success' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + BRANCH: ${{ github.head_ref }} + run: | + ERROR_SUMMARY=$(cat /tmp/error-summary.txt) + + # Ensure PR has dependencies label (required by codegen-agentic-fix safe-output) + gh pr edit "$PR_NUMBER" --add-label dependencies + + gh workflow run codegen-agentic-fix.lock.yml \ + -f branch="$BRANCH" \ + -f pr_number="$PR_NUMBER" \ + -f error_summary="$ERROR_SUMMARY" + echo "Triggered codegen-agentic-fix workflow on branch $BRANCH for PR #$PR_NUMBER" + + - name: Wait for agentic fix to complete + if: steps.trigger-fix.outcome == 'success' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: ${{ github.head_ref }} + run: | + echo "Waiting for agentic fix workflow to start..." + sleep 30 + + for i in $(seq 1 60); do + RUN_ID=$(gh run list \ + --workflow=codegen-agentic-fix.lock.yml \ + --branch="$BRANCH" \ + --limit=1 \ + --json databaseId,status \ + --jq '.[0].databaseId') + + STATUS=$(gh run list \ + --workflow=codegen-agentic-fix.lock.yml \ + --branch="$BRANCH" \ + --limit=1 \ + --json databaseId,status \ + --jq '.[0].status') + + if [ "$STATUS" = "completed" ]; then + echo "Agentic fix workflow run $RUN_ID completed." + CONCLUSION=$(gh run view "$RUN_ID" --json conclusion --jq .conclusion) + echo "Conclusion: $CONCLUSION" + break + fi + + echo "Run $RUN_ID status: $STATUS (attempt $i/60)" + sleep 30 + done + + if [ "$STATUS" != "completed" ]; then + echo "::warning::Agentic fix workflow did not complete within 30 minutes." + fi + + - name: Fetch latest changes after agentic fix + if: steps.trigger-fix.outcome == 'success' + env: + HEAD_REF: ${{ github.head_ref }} + run: | + git fetch origin "$HEAD_REF" + git reset --hard "origin/$HEAD_REF" + + - name: Final mvn verify after agentic fix + if: steps.trigger-fix.outcome == 'success' + env: + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + run: mvn verify diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 1456294576..b53c9e8699 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -24,12 +24,12 @@ jobs: # Install GitHub CLI and gh-aw extension for Copilot Agent interaction - name: Install gh-aw extension - uses: github/gh-aw/actions/setup-cli@7a970851c1090295e55a16e549c61ba1ce227f16 # v0.42.17 + uses: github/gh-aw/actions/setup-cli@0feed75a980b06f247abbbf80127f8eb2c19e2c5 # v0.74.8 with: - version: v0.42.17 + version: v0.68.3 # Setup Node.js - - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 with: node-version: 22 diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml index 02a515117d..91e3b9e5b4 100644 --- a/.github/workflows/deploy-site.yml +++ b/.github/workflows/deploy-site.yml @@ -293,13 +293,13 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Setup Pages - uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5 + uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 - name: Upload artifact - uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4 + uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 with: path: 'site' - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4 + uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 diff --git a/.github/workflows/publish-maven.yml b/.github/workflows/publish-maven.yml index 540da6ae75..cc612389b7 100644 --- a/.github/workflows/publish-maven.yml +++ b/.github/workflows/publish-maven.yml @@ -80,11 +80,15 @@ jobs: # Determine next development version if [ -n "${{ inputs.developmentVersion }}" ]; then DEV_VERSION="${{ inputs.developmentVersion }}" + if [[ "$DEV_VERSION" != *-SNAPSHOT ]]; then + echo "::error::developmentVersion '${DEV_VERSION}' must end with '-SNAPSHOT' (e.g., '${DEV_VERSION}-SNAPSHOT'). The maven-release-plugin requires the next development version to be a snapshot." + exit 1 + fi else - # Split version: supports both "0.1.32" and "0.1.32-java.0" formats + # Split version: supports "0.1.32", "0.1.32-java.0", and "0.1.32-java-preview.0" formats # Validate RELEASE_VERSION format explicitly to provide clear errors - if ! echo "$RELEASE_VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?$'; then - echo "Error: RELEASE_VERSION '$RELEASE_VERSION' is invalid. Expected format: M.M.P or M.M.P-java.N (e.g., 1.2.3 or 1.2.3-java.0)." >&2 + if ! echo "$RELEASE_VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-(beta-)?java(-preview)?\.[0-9]+)?$'; then + echo "Error: RELEASE_VERSION '$RELEASE_VERSION' is invalid. Expected format: M.M.P, M.M.P-java.N, M.M.P-java-preview.N, M.M.P-beta-java.N, or M.M.P-beta-java-preview.N (e.g., 1.2.3, 1.2.3-java.0, 1.2.3-java-preview.0, 1.2.3-beta-java.0, or 1.2.3-beta-java-preview.0)." >&2 exit 1 fi # Extract the base M.M.P portion (before any qualifier) @@ -117,21 +121,21 @@ jobs: # Update CHANGELOG.md with release version and Reference implementation sync hash ./.github/scripts/release/update-changelog.sh "${VERSION}" "${REFERENCE_IMPL_HASH}" - # Update version in README.md (supports versions like 1.0.0 and 0.1.32-java.0) - sed -i "s|[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\.[0-9][0-9]*\)\{0,1\}|${VERSION}|g" README.md - sed -i "s|copilot-sdk-java:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\.[0-9][0-9]*\)\{0,1\}|copilot-sdk-java:${VERSION}|g" README.md + # Update version in README.md (supports any version qualifier like -java.N, -java-preview.N, -beta-java.N) + sed -i "s|[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-[a-z][a-z0-9-]*\.[0-9][0-9]*\)*|${VERSION}|g" README.md + sed -i "s|copilot-sdk-java:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-[a-z][a-z0-9-]*\.[0-9][0-9]*\)*|copilot-sdk-java:${VERSION}|g" README.md # Update snapshot version in README.md DEV_VERSION="${{ steps.versions.outputs.dev_version }}" - sed -i "s|[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\.[0-9][0-9]*\)\{0,1\}-SNAPSHOT|${DEV_VERSION}|g" README.md + sed -i "s|[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-[a-z][a-z0-9-]*\.[0-9][0-9]*\)*-SNAPSHOT|${DEV_VERSION}|g" README.md # Update version in jbang-example.java - sed -i "s|copilot-sdk-java:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\.[0-9][0-9]*\)\{0,1\}|copilot-sdk-java:${VERSION}|g" jbang-example.java + sed -i "s|copilot-sdk-java:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-[a-z][a-z0-9-]*\.[0-9][0-9]*\)*|copilot-sdk-java:${VERSION}|g" jbang-example.java sed -i 's|copilot-sdk-java:${project\.version}|copilot-sdk-java:'"${VERSION}"'|g' jbang-example.java # Update version in cookbook files (hardcoded for direct GitHub browsing and JBang usage) find src/site/markdown/cookbook -name "*.md" -type f -exec \ - sed -i "s|copilot-sdk-java:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\.[0-9][0-9]*\)\{0,1\}|copilot-sdk-java:${VERSION}|g" {} \; + sed -i "s|copilot-sdk-java:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-[a-z][a-z0-9-]*\.[0-9][0-9]*\)*|copilot-sdk-java:${VERSION}|g" {} \; # Commit the documentation changes before release:prepare (requires clean working directory) git add CHANGELOG.md README.md jbang-example.java src/site/markdown/cookbook/ @@ -202,7 +206,7 @@ jobs: # Get the previous tag for generating notes PREV_TAG=$(git tag --list 'v*' --sort=-version:refname \ - | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?$' \ + | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-java(-preview)?\.[0-9]+)?$' \ | grep -Fxv "${CURRENT_TAG}" \ | head -n 1) diff --git a/.github/workflows/weekly-reference-impl-sync.lock.yml b/.github/workflows/reference-impl-sync.lock.yml similarity index 64% rename from .github/workflows/weekly-reference-impl-sync.lock.yml rename to .github/workflows/reference-impl-sync.lock.yml index 49bfd3ac0f..98fd0d0d0b 100644 --- a/.github/workflows/weekly-reference-impl-sync.lock.yml +++ b/.github/workflows/reference-impl-sync.lock.yml @@ -1,5 +1,5 @@ -# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"54f733578d3011b148c7aff09a0e72085d787a777a996488f08aeffdf52ec93b","compiler_version":"v0.68.3","strict":true,"agent_id":"copilot"} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_AGENT_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"373c709c69115d41ff229c7e5df9f8788daa9553","version":"v9"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba90f2186d7ad780ec640f364005fa24e797b360","version":"v0.68.3"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.20"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.20"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.20"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.2.19"},{"image":"ghcr.io/github/github-mcp-server:v0.32.0"},{"image":"node:lts-alpine"}]} +# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"d3b88eb52d0d4007c7a64118dfa3866bcbba7589a38004bb5c47695bee9e7ac7","compiler_version":"v0.74.4","strict":true,"agent_id":"copilot"} +# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_AGENT_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"373c709c69115d41ff229c7e5df9f8788daa9553","version":"v9"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"d3abfe96a194bce3a523ed2093ddedd5704cdf62","version":"v0.74.4"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.46"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.46"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.46"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.9","digest":"sha256:64828b42a4482f58fab16509d7f8f495a6d97c972a98a68aff20543531ac0388","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.9@sha256:64828b42a4482f58fab16509d7f8f495a6d97c972a98a68aff20543531ac0388"},{"image":"ghcr.io/github/github-mcp-server:v1.0.4"},{"image":"node:lts-alpine","digest":"sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f","pinned_image":"node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f"}]} # ___ _ _ # / _ \ | | (_) # | |_| | __ _ ___ _ __ | |_ _ ___ @@ -14,7 +14,7 @@ # \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \ # \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/ # -# This file was automatically generated by gh-aw (v0.68.3). DO NOT EDIT. +# This file was automatically generated by gh-aw (v0.74.4). DO NOT EDIT. # # To update this file, edit the corresponding .md file and run: # gh aw compile @@ -22,7 +22,7 @@ # # For more information: https://github.github.com/gh-aw/introduction/overview/ # -# Weekly reference implementation sync workflow. Checks for new commits in the official +# Reference implementation sync workflow. Checks for new commits in the official # Copilot SDK (github/copilot-sdk) and assigns to Copilot to port changes. # # Secrets used: @@ -36,22 +36,24 @@ # - actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 # - actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 # - actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 +# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 +# - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 -# - github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 +# - github/gh-aw-actions/setup@d3abfe96a194bce3a523ed2093ddedd5704cdf62 # v0.74.4 # # Container images used: -# - ghcr.io/github/gh-aw-firewall/agent:0.25.20 -# - ghcr.io/github/gh-aw-firewall/api-proxy:0.25.20 -# - ghcr.io/github/gh-aw-firewall/squid:0.25.20 -# - ghcr.io/github/gh-aw-mcpg:v0.2.19 -# - ghcr.io/github/github-mcp-server:v0.32.0 -# - node:lts-alpine +# - ghcr.io/github/gh-aw-firewall/agent:0.25.46 +# - ghcr.io/github/gh-aw-firewall/api-proxy:0.25.46 +# - ghcr.io/github/gh-aw-firewall/squid:0.25.46 +# - ghcr.io/github/gh-aw-mcpg:v0.3.9@sha256:64828b42a4482f58fab16509d7f8f495a6d97c972a98a68aff20543531ac0388 +# - ghcr.io/github/github-mcp-server:v1.0.4 +# - node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f -name: "Weekly Reference Implementation Sync" -"on": +name: "Reference Implementation Sync" +on: schedule: - - cron: "40 11 * * 0" - # Friendly format: weekly (scattered) + - cron: "25 2 * * 5" + # Friendly format: weekly on friday (scattered) workflow_dispatch: inputs: aw_context: @@ -65,7 +67,7 @@ permissions: {} concurrency: group: "gh-aw-${{ github.workflow }}" -run-name: "Weekly Reference Implementation Sync" +run-name: "Reference Implementation Sync" jobs: activation: @@ -76,38 +78,46 @@ jobs: outputs: comment_id: "" comment_repo: "" + engine_id: ${{ steps.generate_aw_info.outputs.engine_id }} lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }} model: ${{ steps.generate_aw_info.outputs.model }} secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }} + setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }} + setup-span-id: ${{ steps.setup.outputs.span-id }} setup-trace-id: ${{ steps.setup.outputs.trace-id }} stale_lock_file_failed: ${{ steps.check-lock-file.outputs.stale_lock_file_failed == 'true' }} steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 + uses: github/gh-aw-actions/setup@d3abfe96a194bce3a523ed2093ddedd5704cdf62 # v0.74.4 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Reference Implementation Sync" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/reference-impl-sync.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.48" + GH_AW_INFO_ENGINE_ID: "copilot" - name: Generate agentic run info id: generate_aw_info env: GH_AW_INFO_ENGINE_ID: "copilot" GH_AW_INFO_ENGINE_NAME: "GitHub Copilot CLI" - GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || 'auto' }} - GH_AW_INFO_VERSION: "1.0.21" - GH_AW_INFO_AGENT_VERSION: "1.0.21" - GH_AW_INFO_CLI_VERSION: "v0.68.3" - GH_AW_INFO_WORKFLOW_NAME: "Weekly Reference Implementation Sync" + GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || 'claude-sonnet-4.6' }} + GH_AW_INFO_VERSION: "1.0.48" + GH_AW_INFO_AGENT_VERSION: "1.0.48" + GH_AW_INFO_CLI_VERSION: "v0.74.4" + GH_AW_INFO_WORKFLOW_NAME: "Reference Implementation Sync" GH_AW_INFO_EXPERIMENTAL: "false" GH_AW_INFO_SUPPORTS_TOOLS_ALLOWLIST: "true" GH_AW_INFO_STAGED: "false" GH_AW_INFO_ALLOWED_DOMAINS: '["defaults","github"]' GH_AW_INFO_FIREWALL_ENABLED: "true" - GH_AW_INFO_AWF_VERSION: "v0.25.20" + GH_AW_INFO_AWF_VERSION: "v0.25.46" GH_AW_INFO_AWMG_VERSION: "" GH_AW_INFO_FIREWALL_TYPE: "squid" GH_AW_COMPILED_STRICT: "true" - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); @@ -126,13 +136,25 @@ jobs: sparse-checkout: | .github .agents + .claude + .codex + .crush + .gemini + .opencode + .pi sparse-checkout-cone-mode: true fetch-depth: 1 + - name: Save agent config folders for base branch restoration + env: + GH_AW_AGENT_FOLDERS: ".agents .claude .codex .crush .gemini .github .opencode .pi" + GH_AW_AGENT_FILES: ".crush.json AGENTS.md CLAUDE.md GEMINI.md PI.md opencode.jsonc" + # poutine:ignore untrusted_checkout_exec + run: bash "${RUNNER_TEMP}/gh-aw/actions/save_base_github_folders.sh" - name: Check workflow lock file id: check-lock-file - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: - GH_AW_WORKFLOW_FILE: "weekly-reference-impl-sync.lock.yml" + GH_AW_WORKFLOW_FILE: "reference-impl-sync.lock.yml" GH_AW_CONTEXT_WORKFLOW_REF: "${{ github.workflow_ref }}" with: script: | @@ -141,9 +163,9 @@ jobs: const { main } = require('${{ runner.temp }}/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); - name: Check compile-agentic version - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: - GH_AW_COMPILED_VERSION: "v0.68.3" + GH_AW_COMPILED_VERSION: "v0.74.4" with: script: | const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); @@ -154,11 +176,11 @@ jobs: env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt GH_AW_SAFE_OUTPUTS: ${{ runner.temp }}/gh-aw/safeoutputs/outputs.jsonl + GH_AW_EXPR_1A3A194A: ${{ github.event.discussion.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'discussion' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} + GH_AW_EXPR_463A214A: ${{ github.event.pull_request.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'pull_request' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} + GH_AW_EXPR_802A9F6A: ${{ github.event.issue.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'issue' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} + GH_AW_EXPR_FF1D34CE: ${{ github.event.comment.id || fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').comment_id }} GH_AW_GITHUB_ACTOR: ${{ github.actor }} - GH_AW_GITHUB_EVENT_COMMENT_ID: ${{ github.event.comment.id }} - GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: ${{ github.event.discussion.number }} - GH_AW_GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }} - GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }} @@ -166,56 +188,60 @@ jobs: run: | bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh" { - cat << 'GH_AW_PROMPT_9a049ffd9b204d97_EOF' + cat << 'GH_AW_PROMPT_5937f7f329fed3c9_EOF' - GH_AW_PROMPT_9a049ffd9b204d97_EOF + GH_AW_PROMPT_5937f7f329fed3c9_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/xpia.md" cat "${RUNNER_TEMP}/gh-aw/prompts/temp_folder_prompt.md" cat "${RUNNER_TEMP}/gh-aw/prompts/markdown.md" cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md" - cat << 'GH_AW_PROMPT_9a049ffd9b204d97_EOF' + cat << 'GH_AW_PROMPT_5937f7f329fed3c9_EOF' - Tools: add_comment(max:10), create_issue, close_issue(max:10), assign_to_agent, missing_tool, missing_data, noop + Tools: add_comment(max:10), create_issue, close_issue(max:10), close_pull_request(max:10), assign_to_agent, missing_tool, missing_data, noop + GH_AW_PROMPT_5937f7f329fed3c9_EOF + cat "${RUNNER_TEMP}/gh-aw/prompts/mcp_cli_tools_prompt.md" + cat << 'GH_AW_PROMPT_5937f7f329fed3c9_EOF' The following GitHub context information is available for this workflow: - {{#if __GH_AW_GITHUB_ACTOR__ }} + {{#if github.actor}} - **actor**: __GH_AW_GITHUB_ACTOR__ {{/if}} - {{#if __GH_AW_GITHUB_REPOSITORY__ }} + {{#if github.repository}} - **repository**: __GH_AW_GITHUB_REPOSITORY__ {{/if}} - {{#if __GH_AW_GITHUB_WORKSPACE__ }} + {{#if github.workspace}} - **workspace**: __GH_AW_GITHUB_WORKSPACE__ {{/if}} - {{#if __GH_AW_GITHUB_EVENT_ISSUE_NUMBER__ }} - - **issue-number**: #__GH_AW_GITHUB_EVENT_ISSUE_NUMBER__ + {{#if github.event.issue.number || (github.aw.context.item_type == 'issue' && github.aw.context.item_number)}} + - **issue-number**: #__GH_AW_EXPR_802A9F6A__ {{/if}} - {{#if __GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER__ }} - - **discussion-number**: #__GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER__ + {{#if github.event.discussion.number || (github.aw.context.item_type == 'discussion' && github.aw.context.item_number)}} + - **discussion-number**: #__GH_AW_EXPR_1A3A194A__ {{/if}} - {{#if __GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER__ }} - - **pull-request-number**: #__GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER__ + {{#if github.event.pull_request.number || (github.aw.context.item_type == 'pull_request' && github.aw.context.item_number)}} + - **pull-request-number**: #__GH_AW_EXPR_463A214A__ {{/if}} - {{#if __GH_AW_GITHUB_EVENT_COMMENT_ID__ }} - - **comment-id**: __GH_AW_GITHUB_EVENT_COMMENT_ID__ + {{#if github.event.comment.id || github.aw.context.comment_id}} + - **comment-id**: __GH_AW_EXPR_FF1D34CE__ {{/if}} - {{#if __GH_AW_GITHUB_RUN_ID__ }} + {{#if github.run_id}} - **workflow-run-id**: __GH_AW_GITHUB_RUN_ID__ {{/if}} - GH_AW_PROMPT_9a049ffd9b204d97_EOF + GH_AW_PROMPT_5937f7f329fed3c9_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md" - cat << 'GH_AW_PROMPT_9a049ffd9b204d97_EOF' + cat << 'GH_AW_PROMPT_5937f7f329fed3c9_EOF' - {{#runtime-import .github/workflows/weekly-reference-impl-sync.md}} - GH_AW_PROMPT_9a049ffd9b204d97_EOF + {{#runtime-import .github/workflows/reference-impl-sync.md}} + GH_AW_PROMPT_5937f7f329fed3c9_EOF } > "$GH_AW_PROMPT" - name: Interpolate variables and render templates - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_ENGINE_ID: "copilot" with: script: | const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); @@ -223,17 +249,18 @@ jobs: const { main } = require('${{ runner.temp }}/gh-aw/actions/interpolate_prompt.cjs'); await main(); - name: Substitute placeholders - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_EXPR_1A3A194A: ${{ github.event.discussion.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'discussion' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} + GH_AW_EXPR_463A214A: ${{ github.event.pull_request.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'pull_request' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} + GH_AW_EXPR_802A9F6A: ${{ github.event.issue.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'issue' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} + GH_AW_EXPR_FF1D34CE: ${{ github.event.comment.id || fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').comment_id }} GH_AW_GITHUB_ACTOR: ${{ github.actor }} - GH_AW_GITHUB_EVENT_COMMENT_ID: ${{ github.event.comment.id }} - GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: ${{ github.event.discussion.number }} - GH_AW_GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }} - GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }} + GH_AW_MCP_CLI_SERVERS_LIST: '- `safeoutputs` β€” run `safeoutputs --help` to see available tools' with: script: | const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); @@ -245,14 +272,15 @@ jobs: return await substitutePlaceholders({ file: process.env.GH_AW_PROMPT, substitutions: { + GH_AW_EXPR_1A3A194A: process.env.GH_AW_EXPR_1A3A194A, + GH_AW_EXPR_463A214A: process.env.GH_AW_EXPR_463A214A, + GH_AW_EXPR_802A9F6A: process.env.GH_AW_EXPR_802A9F6A, + GH_AW_EXPR_FF1D34CE: process.env.GH_AW_EXPR_FF1D34CE, GH_AW_GITHUB_ACTOR: process.env.GH_AW_GITHUB_ACTOR, - GH_AW_GITHUB_EVENT_COMMENT_ID: process.env.GH_AW_GITHUB_EVENT_COMMENT_ID, - GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: process.env.GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER, - GH_AW_GITHUB_EVENT_ISSUE_NUMBER: process.env.GH_AW_GITHUB_EVENT_ISSUE_NUMBER, - GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: process.env.GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER, GH_AW_GITHUB_REPOSITORY: process.env.GH_AW_GITHUB_REPOSITORY, GH_AW_GITHUB_RUN_ID: process.env.GH_AW_GITHUB_RUN_ID, - GH_AW_GITHUB_WORKSPACE: process.env.GH_AW_GITHUB_WORKSPACE + GH_AW_GITHUB_WORKSPACE: process.env.GH_AW_GITHUB_WORKSPACE, + GH_AW_MCP_CLI_SERVERS_LIST: process.env.GH_AW_MCP_CLI_SERVERS_LIST } }); - name: Validate prompt placeholders @@ -270,10 +298,15 @@ jobs: uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: activation + include-hidden-files: true path: | /tmp/gh-aw/aw_info.json /tmp/gh-aw/aw-prompts/prompt.txt + /tmp/gh-aw/aw-prompts/prompt-template.txt + /tmp/gh-aw/aw-prompts/prompt-import-tree.json /tmp/gh-aw/github_rate_limits.jsonl + /tmp/gh-aw/base + /tmp/gh-aw/.github/agents if-no-files-found: ignore retention-days: 1 @@ -284,6 +317,7 @@ jobs: actions: read contents: read issues: read + pull-requests: read concurrency: group: "gh-aw-copilot-${{ github.workflow }}" env: @@ -292,11 +326,12 @@ jobs: GH_AW_ASSETS_BRANCH: "" GH_AW_ASSETS_MAX_SIZE_KB: 0 GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs - GH_AW_WORKFLOW_ID_SANITIZED: weeklyreferenceimplsync + GH_AW_WORKFLOW_ID_SANITIZED: referenceimplsync outputs: agentic_engine_timeout: ${{ steps.detect-copilot-errors.outputs.agentic_engine_timeout || 'false' }} checkout_pr_success: ${{ steps.checkout-pr.outputs.checkout_pr_success || 'true' }} effective_tokens: ${{ steps.parse-mcp-gateway.outputs.effective_tokens }} + effective_tokens_rate_limit_error: ${{ steps.parse-mcp-gateway.outputs.effective_tokens_rate_limit_error || 'false' }} has_patch: ${{ steps.collect_output.outputs.has_patch }} inference_access_error: ${{ steps.detect-copilot-errors.outputs.inference_access_error || 'false' }} mcp_policy_error: ${{ steps.detect-copilot-errors.outputs.mcp_policy_error || 'false' }} @@ -304,15 +339,23 @@ jobs: model_not_supported_error: ${{ steps.detect-copilot-errors.outputs.model_not_supported_error || 'false' }} output: ${{ steps.collect_output.outputs.output }} output_types: ${{ steps.collect_output.outputs.output_types }} + setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }} + setup-span-id: ${{ steps.setup.outputs.span-id }} setup-trace-id: ${{ steps.setup.outputs.trace-id }} steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 + uses: github/gh-aw-actions/setup@d3abfe96a194bce3a523ed2093ddedd5704cdf62 # v0.74.4 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} trace-id: ${{ needs.activation.outputs.setup-trace-id }} + parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Reference Implementation Sync" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/reference-impl-sync.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.48" + GH_AW_INFO_ENGINE_ID: "copilot" - name: Set runtime paths id: set-runtime-paths run: | @@ -348,7 +391,7 @@ jobs: id: checkout-pr if: | github.event.pull_request || github.event.issue.pull_request - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} with: @@ -359,11 +402,11 @@ jobs: const { main } = require('${{ runner.temp }}/gh-aw/actions/checkout_pr_branch.cjs'); await main(); - name: Install GitHub Copilot CLI - run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.21 + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.48 env: GH_HOST: github.com - name: Install AWF binary - run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.25.20 + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.25.46 - name: Determine automatic lockdown mode for GitHub MCP Server id: determine-automatic-lockdown uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 @@ -374,17 +417,33 @@ jobs: script: | const determineAutomaticLockdown = require('${{ runner.temp }}/gh-aw/actions/determine_automatic_lockdown.cjs'); await determineAutomaticLockdown(github, context, core); + - name: Download activation artifact + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: activation + path: /tmp/gh-aw + - name: Restore agent config folders from base branch + if: steps.checkout-pr.outcome == 'success' + env: + GH_AW_AGENT_FOLDERS: ".agents .claude .codex .crush .gemini .github .opencode .pi" + GH_AW_AGENT_FILES: ".crush.json AGENTS.md CLAUDE.md GEMINI.md PI.md opencode.jsonc" + run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_base_github_folders.sh" + - name: Restore inline sub-agents from activation artifact + env: + GH_AW_SUB_AGENT_DIR: ".github/agents" + GH_AW_SUB_AGENT_EXT: ".agent.md" + run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_sub_agents.sh" - name: Download container images - run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.20 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.20 ghcr.io/github/gh-aw-firewall/squid:0.25.20 ghcr.io/github/gh-aw-mcpg:v0.2.19 ghcr.io/github/github-mcp-server:v0.32.0 node:lts-alpine - - name: Write Safe Outputs Config + run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.46 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.46 ghcr.io/github/gh-aw-firewall/squid:0.25.46 ghcr.io/github/gh-aw-mcpg:v0.3.9@sha256:64828b42a4482f58fab16509d7f8f495a6d97c972a98a68aff20543531ac0388 ghcr.io/github/github-mcp-server:v1.0.4 node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f + - name: Generate Safe Outputs Config run: | mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs" mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs - cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_2a317c5680ea1925_EOF' - {"add_comment":{"max":10,"target":"*"},"assign_to_agent":{"max":1,"model":"claude-opus-4.6","name":"copilot","target":"*"},"close_issue":{"max":10,"required_labels":["reference-impl-sync"],"target":"*"},"create_issue":{"assignees":["copilot-swe-agent"],"expires":144,"labels":["reference-impl-sync"],"max":1,"title_prefix":"[reference-impl-sync] "},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"false"},"report_incomplete":{}} - GH_AW_SAFE_OUTPUTS_CONFIG_2a317c5680ea1925_EOF - - name: Write Safe Outputs Tools + cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_8434d42e1eaff150_EOF' + {"add_comment":{"max":10,"target":"*"},"assign_to_agent":{"max":1,"model":"claude-opus-4.6","name":"copilot","target":"*"},"close_issue":{"max":10,"required_labels":["reference-impl-sync"],"target":"*"},"close_pull_request":{"max":10,"target":"*"},"create_issue":{"expires":144,"labels":["reference-impl-sync"],"max":1,"title_prefix":"[reference-impl-sync] "},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"false"},"report_incomplete":{}} + GH_AW_SAFE_OUTPUTS_CONFIG_8434d42e1eaff150_EOF + - name: Generate Safe Outputs Tools env: GH_AW_TOOLS_META_JSON: | { @@ -392,7 +451,8 @@ jobs: "add_comment": " CONSTRAINTS: Maximum 10 comment(s) can be added. Target: *. Supports reply_to_id for discussion threading.", "assign_to_agent": " CONSTRAINTS: Maximum 1 issue(s) can be assigned to agent.", "close_issue": " CONSTRAINTS: Maximum 10 issue(s) can be closed. Target: *.", - "create_issue": " CONSTRAINTS: Maximum 1 issue(s) can be created. Title will be prefixed with \"[reference-impl-sync] \". Labels [\"reference-impl-sync\"] will be automatically added. Assignees [\"copilot-swe-agent\"] will be automatically assigned." + "close_pull_request": " CONSTRAINTS: Maximum 10 pull request(s) can be closed. Target: *.", + "create_issue": " CONSTRAINTS: Maximum 1 issue(s) can be created. Title will be prefixed with \"[reference-impl-sync] \". Labels [\"reference-impl-sync\"] will be automatically added." }, "repo_params": {}, "dynamic_tools": [] @@ -464,6 +524,24 @@ jobs: } } }, + "close_pull_request": { + "defaultMax": 1, + "fields": { + "body": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 65000 + }, + "pull_request_number": { + "optionalPositiveInteger": true + }, + "repo": { + "type": "string", + "maxLength": 256 + } + } + }, "create_issue": { "defaultMax": 1, "fields": { @@ -473,6 +551,9 @@ jobs: "sanitize": true, "maxLength": 65000 }, + "fields": { + "type": "array" + }, "labels": { "type": "array", "itemType": "string", @@ -571,7 +652,7 @@ jobs: } } } - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); @@ -629,11 +710,12 @@ jobs: GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} run: | set -eo pipefail - mkdir -p /tmp/gh-aw/mcp-config + mkdir -p "${RUNNER_TEMP}/gh-aw/mcp-config" # Export gateway environment variables for MCP config and gateway script - export MCP_GATEWAY_PORT="80" + export MCP_GATEWAY_PORT="8080" export MCP_GATEWAY_DOMAIN="host.docker.internal" + export MCP_GATEWAY_HOST_DOMAIN="localhost" MCP_GATEWAY_API_KEY=$(openssl rand -base64 45 | tr -d '/+=') echo "::add-mask::${MCP_GATEWAY_API_KEY}" export MCP_GATEWAY_API_KEY @@ -643,20 +725,29 @@ jobs: export DEBUG="*" export GH_AW_ENGINE="copilot" - export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host -v /var/run/docker.sock:/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_GUARD_MIN_INTEGRITY -e GITHUB_MCP_GUARD_REPOS -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.2.19' + MCP_GATEWAY_UID=$(id -u 2>/dev/null || echo '0') + MCP_GATEWAY_GID=$(id -g 2>/dev/null || echo '0') + case "${DOCKER_HOST:-}" in + unix://* ) DOCKER_SOCK_PATH="${DOCKER_HOST#unix://}" ;; + /* ) DOCKER_SOCK_PATH="$DOCKER_HOST" ;; + * ) DOCKER_SOCK_PATH=/var/run/docker.sock ;; + esac + DOCKER_SOCK_GID=$(stat -c '%g' "$DOCKER_SOCK_PATH" 2>/dev/null || echo '0') + export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host --add-host host.docker.internal:127.0.0.1 --user '"${MCP_GATEWAY_UID}"':'"${MCP_GATEWAY_GID}"' --group-add '"${DOCKER_SOCK_GID}"' -v '"${DOCKER_SOCK_PATH}"':/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e DOCKER_HOST=unix:///var/run/docker.sock -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_GUARD_MIN_INTEGRITY -e GITHUB_MCP_GUARD_REPOS -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.3.9' mkdir -p /home/runner/.copilot - cat << GH_AW_MCP_CONFIG_ee30822602a32ffa_EOF | bash "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.sh" + GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node) + cat << GH_AW_MCP_CONFIG_91f5ce417df04baa_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs" { "mcpServers": { "github": { "type": "stdio", - "container": "ghcr.io/github/github-mcp-server:v0.32.0", + "container": "ghcr.io/github/github-mcp-server:v1.0.4", "env": { "GITHUB_HOST": "\${GITHUB_SERVER_URL}", "GITHUB_PERSONAL_ACCESS_TOKEN": "\${GITHUB_MCP_SERVER_TOKEN}", "GITHUB_READ_ONLY": "1", - "GITHUB_TOOLSETS": "context,repos,issues" + "GITHUB_TOOLSETS": "context,repos,issues,pull_requests" }, "guard-policies": { "allow-only": { @@ -687,37 +778,61 @@ jobs: "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}" } } - GH_AW_MCP_CONFIG_ee30822602a32ffa_EOF - - name: Download activation artifact - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + GH_AW_MCP_CONFIG_91f5ce417df04baa_EOF + - name: Mount MCP servers as CLIs + id: mount-mcp-clis + continue-on-error: true + env: + MCP_GATEWAY_API_KEY: ${{ steps.start-mcp-gateway.outputs.gateway-api-key }} + MCP_GATEWAY_DOMAIN: ${{ steps.start-mcp-gateway.outputs.gateway-domain }} + MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }} + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: - name: activation - path: /tmp/gh-aw - - name: Clean git credentials + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('${{ runner.temp }}/gh-aw/actions/mount_mcp_as_cli.cjs'); + await main(); + - name: Clean credentials continue-on-error: true run: bash "${RUNNER_TEMP}/gh-aw/actions/clean_git_credentials.sh" + - name: Audit pre-agent workspace + id: pre_agent_audit + continue-on-error: true + run: bash "${RUNNER_TEMP}/gh-aw/actions/audit_pre_agent_workspace.sh" - name: Execute GitHub Copilot CLI id: agentic_execution # Copilot CLI tool arguments (sorted): timeout-minutes: 20 run: | set -o pipefail + printf '%s' "$(date +%s%3N)" > /tmp/gh-aw/agent_cli_start_ms.txt touch /tmp/gh-aw/agent-step-summary.md + GH_AW_NODE_BIN=$(command -v node 2>/dev/null || true) + export GH_AW_NODE_BIN (umask 177 && touch /tmp/gh-aw/agent-stdio.log) + printf '%s\n' '{"$schema":"https://github.com/github/gh-aw-firewall/releases/download/v0.25.46/awf-config.schema.json","network":{"allowDomains":["*.githubusercontent.com","api.business.githubcopilot.com","api.enterprise.githubcopilot.com","api.github.com","api.githubcopilot.com","api.individual.githubcopilot.com","api.snapcraft.io","archive.ubuntu.com","azure.archive.ubuntu.com","codeload.github.com","crl.geotrust.com","crl.globalsign.com","crl.identrust.com","crl.sectigo.com","crl.thawte.com","crl.usertrust.com","crl.verisign.com","crl3.digicert.com","crl4.digicert.com","crls.ssl.com","docs.github.com","github-cloud.githubusercontent.com","github-cloud.s3.amazonaws.com","github.blog","github.com","github.githubassets.com","host.docker.internal","json-schema.org","json.schemastore.org","keyserver.ubuntu.com","lfs.github.com","objects.githubusercontent.com","ocsp.digicert.com","ocsp.geotrust.com","ocsp.globalsign.com","ocsp.identrust.com","ocsp.sectigo.com","ocsp.ssl.com","ocsp.thawte.com","ocsp.usertrust.com","ocsp.verisign.com","packagecloud.io","packages.cloud.google.com","packages.microsoft.com","ppa.launchpad.net","raw.githubusercontent.com","registry.npmjs.org","s.symcb.com","s.symcd.com","security.ubuntu.com","telemetry.enterprise.githubcopilot.com","ts-crl.ws.symantec.com","ts-ocsp.ws.symantec.com","www.googleapis.com"]},"apiProxy":{"enabled":true,"enableTokenSteering":true,"maxRuns":500,"maxEffectiveTokens":25000000,"models":{"auto":["large"],"coding":["copilot/gpt-5*codex*","openai/gpt-5*codex*","gpt-5-codex"],"deep-research":["copilot/deep-research*","copilot/o3-deep-research*","copilot/o4-mini-deep-research*","google/deep-research*","gemini/deep-research*","openai/o3-deep-research*","openai/o4-mini-deep-research*"],"gemini-flash":["copilot/gemini-*flash*","google/gemini-*flash*","gemini/gemini-*flash*"],"gemini-flash-lite":["copilot/gemini-*flash*lite*","google/gemini-*flash*lite*","gemini/gemini-*flash*lite*"],"gemini-pro":["copilot/gemini-*pro*","google/gemini-*pro*","gemini/gemini-*pro*"],"gemma":["copilot/gemma*","google/gemma*","gemini/gemma*"],"gpt-4.1":["copilot/gpt-4.1*","openai/gpt-4.1*"],"gpt-5":["copilot/gpt-5*","openai/gpt-5*"],"gpt-5-codex":["copilot/gpt-5*codex*","openai/gpt-5*codex*"],"gpt-5-mini":["copilot/gpt-5*mini*","openai/gpt-5*mini*"],"gpt-5-nano":["copilot/gpt-5*nano*","openai/gpt-5*nano*"],"gpt-5-pro":["copilot/gpt-5*pro*","openai/gpt-5*pro*"],"haiku":["copilot/*haiku*","anthropic/*haiku*"],"large":["sonnet","gpt-5-pro","gpt-5","gemini-pro"],"mini":["haiku","gpt-5-mini","gpt-5-nano","gemini-flash-lite"],"opus":["copilot/*opus*","anthropic/*opus*"],"reasoning":["copilot/o1*","copilot/o3*","copilot/o4*","openai/o1*","openai/o3*","openai/o4*"],"small":["mini"],"sonnet":["copilot/*sonnet*","anthropic/*sonnet*"],"vision":["copilot/gemini-*image*","gemini/gemini-*image*","copilot/gemini-*flash*","gemini/gemini-*flash*"]}},"container":{"imageTag":"0.25.46"}}' > "${RUNNER_TEMP}/gh-aw/awf-config.json" && cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json + GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="" + if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then + GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="--docker-host-path-prefix /tmp/gh-aw" + fi # shellcheck disable=SC1003 - sudo -E awf --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" --env-all --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --allow-domains '*.githubusercontent.com,api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,codeload.github.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,docs.github.com,github-cloud.githubusercontent.com,github-cloud.s3.amazonaws.com,github.blog,github.com,github.githubassets.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,lfs.github.com,objects.githubusercontent.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com' --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --image-tag 0.25.20 --skip-pull --enable-api-proxy \ - -- /bin/bash -c 'node ${RUNNER_TEMP}/gh-aw/actions/copilot_driver.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log + sudo -E awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS} --env-all --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --allow-host-ports 80,443,8080 --skip-pull \ + -- /bin/bash -c 'export PATH="${RUNNER_TEMP}/gh-aw/mcp-cli/bin:$PATH" && export PATH="$(find /opt/hostedtoolcache /home/runner/work/_tool -maxdepth 5 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner β€” check runtimes.node in workflow YAML" >&2; exit 127; fi; "$GH_AW_NODE_EXEC" ${RUNNER_TEMP}/gh-aw/actions/copilot_harness.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log env: + AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE + COPILOT_API_KEY: dummy-byok-key-for-offline-mode COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} - COPILOT_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || '' }} + COPILOT_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || 'claude-sonnet-4.6' }} GH_AW_MCP_CONFIG: /home/runner/.copilot/mcp-config.json GH_AW_PHASE: agent GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} - GH_AW_VERSION: v0.68.3 + GH_AW_VERSION: v0.74.4 GITHUB_API_URL: ${{ github.api_url }} GITHUB_AW: true + GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows GITHUB_HEAD_REF: ${{ github.head_ref }} GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} GITHUB_REF_NAME: ${{ github.ref_name }} @@ -762,7 +877,7 @@ jobs: bash "${RUNNER_TEMP}/gh-aw/actions/stop_mcp_gateway.sh" "$GATEWAY_PID" - name: Redact secrets in logs if: always() - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); @@ -788,7 +903,7 @@ jobs: - name: Ingest agent output id: collect_output if: always() - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} GH_AW_ALLOWED_DOMAINS: "*.githubusercontent.com,api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,codeload.github.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,docs.github.com,github-cloud.githubusercontent.com,github-cloud.s3.amazonaws.com,github.blog,github.com,github.githubassets.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,lfs.github.com,objects.githubusercontent.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com" @@ -802,7 +917,7 @@ jobs: await main(); - name: Parse agent logs for step summary if: always() - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: GH_AW_AGENT_OUTPUT: /tmp/gh-aw/sandbox/agent/logs/ with: @@ -814,7 +929,7 @@ jobs: - name: Parse MCP Gateway logs for step summary if: always() id: parse-mcp-gateway - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); @@ -827,9 +942,9 @@ jobs: env: AWF_LOGS_DIR: /tmp/gh-aw/sandbox/firewall/logs run: | - # Fix permissions on firewall logs so they can be uploaded as artifacts + # Fix permissions on firewall logs/audit dirs so they can be uploaded as artifacts # AWF runs with sudo, creating files owned by root - sudo chmod -R a+r /tmp/gh-aw/sandbox/firewall/logs 2>/dev/null || true + sudo chmod -R a+rX /tmp/gh-aw/sandbox/firewall 2>/dev/null || true # Only run awf logs summary if awf command exists (it may not be installed if workflow failed before install step) if command -v awf &> /dev/null; then awf logs summary | tee -a "$GITHUB_STEP_SUMMARY" @@ -839,13 +954,23 @@ jobs: - name: Parse token usage for step summary if: always() continue-on-error: true - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io, getOctokit); const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_token_usage.cjs'); await main(); + - name: Print AWF reflect summary + if: always() + continue-on-error: true + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/awf_reflect_summary.cjs'); + await main(); - name: Write agent output placeholder if missing if: always() run: | @@ -865,14 +990,17 @@ jobs: /tmp/gh-aw/mcp-logs/ /tmp/gh-aw/agent_usage.json /tmp/gh-aw/agent-stdio.log + /tmp/gh-aw/pre-agent-audit.txt /tmp/gh-aw/agent/ /tmp/gh-aw/github_rate_limits.jsonl /tmp/gh-aw/safeoutputs.jsonl /tmp/gh-aw/agent_output.json /tmp/gh-aw/aw-*.patch /tmp/gh-aw/aw-*.bundle + /tmp/gh-aw/awf-config.json /tmp/gh-aw/sandbox/firewall/logs/ /tmp/gh-aw/sandbox/firewall/audit/ + /tmp/gh-aw/sandbox/firewall/awf-reflect.json if-no-files-found: ignore conclusion: @@ -891,8 +1019,9 @@ jobs: issues: write pull-requests: write concurrency: - group: "gh-aw-conclusion-weekly-reference-impl-sync" + group: "gh-aw-conclusion-reference-impl-sync" cancel-in-progress: false + queue: max outputs: incomplete_count: ${{ steps.report_incomplete.outputs.incomplete_count }} noop_message: ${{ steps.noop.outputs.noop_message }} @@ -901,11 +1030,17 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 + uses: github/gh-aw-actions/setup@d3abfe96a194bce3a523ed2093ddedd5704cdf62 # v0.74.4 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} trace-id: ${{ needs.activation.outputs.setup-trace-id }} + parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Reference Implementation Sync" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/reference-impl-sync.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.48" + GH_AW_INFO_ENGINE_ID: "copilot" - name: Download agent output artifact id: download-agent-output continue-on-error: true @@ -922,11 +1057,11 @@ jobs: echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT" - name: Process no-op messages id: noop - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} GH_AW_NOOP_MAX: "1" - GH_AW_WORKFLOW_NAME: "Weekly Reference Implementation Sync" + GH_AW_WORKFLOW_NAME: "Reference Implementation Sync" GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }} GH_AW_NOOP_REPORT_AS_ISSUE: "false" @@ -939,10 +1074,10 @@ jobs: await main(); - name: Log detection run id: detection_runs - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} - GH_AW_WORKFLOW_NAME: "Weekly Reference Implementation Sync" + GH_AW_WORKFLOW_NAME: "Reference Implementation Sync" GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }} GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }} @@ -955,11 +1090,11 @@ jobs: await main(); - name: Record missing tool id: missing_tool - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} GH_AW_MISSING_TOOL_CREATE_ISSUE: "true" - GH_AW_WORKFLOW_NAME: "Weekly Reference Implementation Sync" + GH_AW_WORKFLOW_NAME: "Reference Implementation Sync" with: github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} script: | @@ -969,11 +1104,11 @@ jobs: await main(); - name: Record incomplete id: report_incomplete - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} GH_AW_REPORT_INCOMPLETE_CREATE_ISSUE: "true" - GH_AW_WORKFLOW_NAME: "Weekly Reference Implementation Sync" + GH_AW_WORKFLOW_NAME: "Reference Implementation Sync" with: github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} script: | @@ -984,27 +1119,34 @@ jobs: - name: Handle agent failure id: handle_agent_failure if: always() - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} - GH_AW_WORKFLOW_NAME: "Weekly Reference Implementation Sync" + GH_AW_WORKFLOW_NAME: "Reference Implementation Sync" GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }} - GH_AW_WORKFLOW_ID: "weekly-reference-impl-sync" + GH_AW_WORKFLOW_ID: "reference-impl-sync" + GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168" GH_AW_ENGINE_ID: "copilot" GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} + GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens || '' }} + GH_AW_EFFECTIVE_TOKENS_RATE_LIMIT_ERROR: ${{ needs.agent.outputs.effective_tokens_rate_limit_error || 'false' }} GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }} GH_AW_MCP_POLICY_ERROR: ${{ needs.agent.outputs.mcp_policy_error }} GH_AW_AGENTIC_ENGINE_TIMEOUT: ${{ needs.agent.outputs.agentic_engine_timeout }} GH_AW_MODEL_NOT_SUPPORTED_ERROR: ${{ needs.agent.outputs.model_not_supported_error }} + GH_AW_ENGINE_API_HOSTS: "api.enterprise.githubcopilot.com,api.githubcopilot.com,api.business.githubcopilot.com,api.individual.githubcopilot.com" GH_AW_ASSIGNMENT_ERRORS: ${{ needs.safe_outputs.outputs.assign_to_agent_assignment_errors }} GH_AW_ASSIGNMENT_ERROR_COUNT: ${{ needs.safe_outputs.outputs.assign_to_agent_assignment_error_count }} GH_AW_LOCKDOWN_CHECK_FAILED: ${{ needs.activation.outputs.lockdown_check_failed }} GH_AW_STALE_LOCK_FILE_FAILED: ${{ needs.activation.outputs.stale_lock_file_failed }} GH_AW_GROUP_REPORTS: "false" GH_AW_FAILURE_REPORT_AS_ISSUE: "true" + GH_AW_MISSING_TOOL_REPORT_AS_FAILURE: "true" + GH_AW_MISSING_DATA_REPORT_AS_FAILURE: "true" GH_AW_TIMEOUT_MINUTES: "20" + GH_AW_MAX_EFFECTIVE_TOKENS: "25000000" with: github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} script: | @@ -1029,11 +1171,17 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 + uses: github/gh-aw-actions/setup@d3abfe96a194bce3a523ed2093ddedd5704cdf62 # v0.74.4 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} trace-id: ${{ needs.activation.outputs.setup-trace-id }} + parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Reference Implementation Sync" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/reference-impl-sync.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.48" + GH_AW_INFO_ENGINE_ID: "copilot" - name: Download agent output artifact id: download-agent-output continue-on-error: true @@ -1059,7 +1207,7 @@ jobs: rm -rf /tmp/gh-aw/sandbox/firewall/logs rm -rf /tmp/gh-aw/sandbox/firewall/audit - name: Download container images - run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.20 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.20 ghcr.io/github/gh-aw-firewall/squid:0.25.20 + run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.46 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.46 ghcr.io/github/gh-aw-firewall/squid:0.25.46 - name: Check if detection needed id: detection_guard if: always() @@ -1074,10 +1222,10 @@ jobs: echo "run_detection=false" >> "$GITHUB_OUTPUT" echo "Detection skipped: no agent outputs or patches to analyze" fi - - name: Clear MCP configuration for detection + - name: Clear MCP Config for detection if: always() && steps.detection_guard.outputs.run_detection == 'true' run: | - rm -f /tmp/gh-aw/mcp-config/mcp-servers.json + rm -f "${RUNNER_TEMP}/gh-aw/mcp-config/mcp-servers.json" rm -f /home/runner/.copilot/mcp-config.json rm -f "$GITHUB_WORKSPACE/.gemini/settings.json" - name: Prepare threat detection files @@ -1096,10 +1244,10 @@ jobs: ls -la /tmp/gh-aw/threat-detection/ 2>/dev/null || true - name: Setup threat detection if: always() && steps.detection_guard.outputs.run_detection == 'true' - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: - WORKFLOW_NAME: "Weekly Reference Implementation Sync" - WORKFLOW_DESCRIPTION: "Weekly reference implementation sync workflow. Checks for new commits in the official\nCopilot SDK (github/copilot-sdk) and assigns to Copilot to port changes." + WORKFLOW_NAME: "Reference Implementation Sync" + WORKFLOW_DESCRIPTION: "Reference implementation sync workflow. Checks for new commits in the official\nCopilot SDK (github/copilot-sdk) and assigns to Copilot to port changes." HAS_PATCH: ${{ needs.agent.outputs.has_patch }} with: script: | @@ -1112,33 +1260,50 @@ jobs: run: | mkdir -p /tmp/gh-aw/threat-detection touch /tmp/gh-aw/threat-detection/detection.log + - name: Setup Node.js + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: '24' + package-manager-cache: false - name: Install GitHub Copilot CLI - run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.21 + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.48 env: GH_HOST: github.com - name: Install AWF binary - run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.25.20 + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.25.46 - name: Execute GitHub Copilot CLI if: always() && steps.detection_guard.outputs.run_detection == 'true' + continue-on-error: true id: detection_agentic_execution # Copilot CLI tool arguments (sorted): timeout-minutes: 20 run: | set -o pipefail + printf '%s' "$(date +%s%3N)" > /tmp/gh-aw/agent_cli_start_ms.txt touch /tmp/gh-aw/agent-step-summary.md + GH_AW_NODE_BIN=$(command -v node 2>/dev/null || true) + export GH_AW_NODE_BIN (umask 177 && touch /tmp/gh-aw/threat-detection/detection.log) + printf '%s\n' '{"$schema":"https://github.com/github/gh-aw-firewall/releases/download/v0.25.46/awf-config.schema.json","network":{"allowDomains":["api.business.githubcopilot.com","api.enterprise.githubcopilot.com","api.github.com","api.githubcopilot.com","api.individual.githubcopilot.com","github.com","host.docker.internal","telemetry.enterprise.githubcopilot.com"]},"apiProxy":{"enabled":true,"enableTokenSteering":true,"maxRuns":500,"maxEffectiveTokens":25000000},"container":{"imageTag":"0.25.46"}}' > "${RUNNER_TEMP}/gh-aw/awf-config.json" && cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json + GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="" + if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then + GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="--docker-host-path-prefix /tmp/gh-aw" + fi # shellcheck disable=SC1003 - sudo -E awf --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" --env-all --exclude-env COPILOT_GITHUB_TOKEN --allow-domains api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,github.com,host.docker.internal,telemetry.enterprise.githubcopilot.com --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --image-tag 0.25.20 --skip-pull --enable-api-proxy \ - -- /bin/bash -c 'node ${RUNNER_TEMP}/gh-aw/actions/copilot_driver.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --add-dir "${GITHUB_WORKSPACE}" --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log + sudo -E awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS} --env-all --exclude-env COPILOT_GITHUB_TOKEN --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --allow-host-ports 80,443,8080 --skip-pull \ + -- /bin/bash -c 'export PATH="$(find /opt/hostedtoolcache /home/runner/work/_tool -maxdepth 5 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner β€” check runtimes.node in workflow YAML" >&2; exit 127; fi; "$GH_AW_NODE_EXEC" ${RUNNER_TEMP}/gh-aw/actions/copilot_harness.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log env: + AWF_REFLECT_ENABLED: 1 COPILOT_AGENT_RUNNER_TYPE: STANDALONE + COPILOT_API_KEY: dummy-byok-key-for-offline-mode COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} - COPILOT_MODEL: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || '' }} + COPILOT_MODEL: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || 'claude-sonnet-4.6' }} GH_AW_PHASE: detection GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt - GH_AW_VERSION: v0.68.3 + GH_AW_VERSION: v0.74.4 GITHUB_API_URL: ${{ github.api_url }} GITHUB_AW: true + GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows GITHUB_HEAD_REF: ${{ github.head_ref }} GITHUB_REF_NAME: ${{ github.ref_name }} GITHUB_SERVER_URL: ${{ github.server_url }} @@ -1159,16 +1324,35 @@ jobs: - name: Parse and conclude threat detection id: detection_conclusion if: always() - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + continue-on-error: true + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }} + DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }} GH_AW_DETECTION_CONTINUE_ON_ERROR: "true" with: script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_threat_detection_results.cjs'); - await main(); + try { + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_threat_detection_results.cjs'); + await main(); + } catch (loadErr) { + const continueOnError = process.env.GH_AW_DETECTION_CONTINUE_ON_ERROR !== 'false'; + const detectionExecutionFailed = process.env.DETECTION_AGENTIC_EXECUTION_OUTCOME === 'failure'; + const msg = 'ERR_SYSTEM: \u274C Unexpected error loading threat detection module: ' + (loadErr && loadErr.message ? loadErr.message : String(loadErr)); + core.error(msg); + core.setOutput('reason', 'parse_error'); + if (continueOnError && !detectionExecutionFailed) { + core.warning('\u26A0\uFE0F ' + msg); + core.setOutput('conclusion', 'warning'); + core.setOutput('success', 'false'); + } else { + core.setOutput('conclusion', 'failure'); + core.setOutput('success', 'false'); + core.setFailed(msg); + } + } safe_outputs: needs: @@ -1184,14 +1368,15 @@ jobs: pull-requests: write timeout-minutes: 15 env: - GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/weekly-reference-impl-sync" + GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/reference-impl-sync" GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }} GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }} GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens }} GH_AW_ENGINE_ID: "copilot" GH_AW_ENGINE_MODEL: ${{ needs.agent.outputs.model }} - GH_AW_WORKFLOW_ID: "weekly-reference-impl-sync" - GH_AW_WORKFLOW_NAME: "Weekly Reference Implementation Sync" + GH_AW_ENGINE_VERSION: "1.0.48" + GH_AW_WORKFLOW_ID: "reference-impl-sync" + GH_AW_WORKFLOW_NAME: "Reference Implementation Sync" outputs: assign_to_agent_assigned: ${{ steps.process_safe_outputs.outputs.assign_to_agent_assigned }} assign_to_agent_assignment_error_count: ${{ steps.process_safe_outputs.outputs.assign_to_agent_assignment_error_count }} @@ -1209,11 +1394,17 @@ jobs: steps: - name: Setup Scripts id: setup - uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 + uses: github/gh-aw-actions/setup@d3abfe96a194bce3a523ed2093ddedd5704cdf62 # v0.74.4 with: destination: ${{ runner.temp }}/gh-aw/actions job-name: ${{ github.job }} trace-id: ${{ needs.activation.outputs.setup-trace-id }} + parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Reference Implementation Sync" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/reference-impl-sync.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.48" + GH_AW_INFO_ENGINE_ID: "copilot" - name: Download agent output artifact id: download-agent-output continue-on-error: true @@ -1239,13 +1430,13 @@ jobs: echo "GH_HOST=${GH_HOST}" >> "$GITHUB_ENV" - name: Process Safe Outputs id: process_safe_outputs - uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} GH_AW_ALLOWED_DOMAINS: "*.githubusercontent.com,api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,codeload.github.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,docs.github.com,github-cloud.githubusercontent.com,github-cloud.s3.amazonaws.com,github.blog,github.com,github.githubassets.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,lfs.github.com,objects.githubusercontent.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com" GITHUB_SERVER_URL: ${{ github.server_url }} GITHUB_API_URL: ${{ github.api_url }} - GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":10,\"target\":\"*\"},\"assign_to_agent\":{\"max\":1,\"model\":\"claude-opus-4.6\",\"name\":\"copilot\",\"target\":\"*\"},\"close_issue\":{\"max\":10,\"required_labels\":[\"reference-impl-sync\"],\"target\":\"*\"},\"create_issue\":{\"assignees\":[\"copilot-swe-agent\"],\"expires\":144,\"labels\":[\"reference-impl-sync\"],\"max\":1,\"title_prefix\":\"[reference-impl-sync] \"},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"false\"},\"report_incomplete\":{}}" + GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":10,\"target\":\"*\"},\"assign_to_agent\":{\"max\":1,\"model\":\"claude-opus-4.6\",\"name\":\"copilot\",\"target\":\"*\"},\"close_issue\":{\"max\":10,\"required_labels\":[\"reference-impl-sync\"],\"target\":\"*\"},\"close_pull_request\":{\"max\":10,\"target\":\"*\"},\"create_issue\":{\"expires\":144,\"labels\":[\"reference-impl-sync\"],\"max\":1,\"title_prefix\":\"[reference-impl-sync] \"},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"false\"},\"report_incomplete\":{}}" GH_AW_ASSIGN_TO_AGENT_TOKEN: ${{ secrets.GH_AW_AGENT_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} with: github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/weekly-reference-impl-sync.md b/.github/workflows/reference-impl-sync.md similarity index 70% rename from .github/workflows/weekly-reference-impl-sync.md rename to .github/workflows/reference-impl-sync.md index 1d1f9a4fd5..297ef6dbdf 100644 --- a/.github/workflows/weekly-reference-impl-sync.md +++ b/.github/workflows/reference-impl-sync.md @@ -1,16 +1,17 @@ --- description: | - Weekly reference implementation sync workflow. Checks for new commits in the official + Reference implementation sync workflow. Checks for new commits in the official Copilot SDK (github/copilot-sdk) and assigns to Copilot to port changes. on: - schedule: weekly + schedule: weekly on friday workflow_dispatch: permissions: contents: read actions: read issues: read + pull-requests: read network: allowed: @@ -19,12 +20,11 @@ network: tools: github: - toolsets: [context, repos, issues] + toolsets: [context, repos, issues, pull_requests] safe-outputs: create-issue: title-prefix: "[reference-impl-sync] " - assignees: [copilot-swe-agent] labels: [reference-impl-sync] expires: 6 close-issue: @@ -38,10 +38,13 @@ safe-outputs: name: "copilot" model: "claude-opus-4.6" target: "*" + close-pull-request: + target: "*" + max: 10 noop: report-as-issue: false --- -# Weekly Reference Implementation Sync +# Reference Implementation Sync You are an automation agent that detects new reference implementation changes and creates GitHub issues. You do **NOT** perform any code merges, edits, or pushes. Do **NOT** invoke any skills (especially `agentic-merge-reference-impl`). Your only job is to check for changes and use safe-output tools to create or close issues. @@ -79,14 +82,16 @@ Go to Step 3b. 1. Search for any open issues with the `reference-impl-sync` label using the GitHub MCP tools. 2. If there are open `reference-impl-sync` labeled issues, close each one using the `close_issue` safe-output tool with a comment: "No new reference implementation changes detected. The Java SDK is up to date. Closing." -3. Call the `noop` safe-output tool with message: "No new reference implementation changes since last merge ()." -4. **Stop here.** Do not proceed further. +3. Search for any open pull requests whose head branch starts with `copilot/reference-impl`. Close each one using the `close_pull_request` safe-output tool with a comment: "Superseded β€” the Java SDK is up to date with the reference implementation. Closing stale sync PR." +4. Call the `noop` safe-output tool with message: "No new reference implementation changes since last merge ()." +5. **Stop here.** Do not proceed further. ### Step 3b: Changes detected 1. Search for any open issues with the `reference-impl-sync` label using the GitHub MCP tools. 2. Close each existing open `reference-impl-sync` issue using the `close_issue` safe-output tool with a comment: "Superseded by a newer reference implementation sync check." -3. Create a new issue using the `create_issue` safe-output tool with: +3. Search for any open pull requests whose head branch starts with `copilot/reference-impl`. Close each one using the `close_pull_request` safe-output tool with a comment: "Superseded by a newer reference implementation sync issue. Closing stale sync PR." +4. Create a new issue using the `create_issue` safe-output tool with: - **Title:** `Reference Implementation sync: new commits ()` - **Body:** Include the following information: ``` @@ -105,9 +110,15 @@ Go to Step 3b. ### Instructions - Follow the [agentic-merge-reference-impl](.github/prompts/agentic-merge-reference-impl.prompt.md) prompt to port these changes to the Java SDK. + **You MUST follow these steps in order. Do NOT improvise or skip scripts.** + + 1. βœ…βœ…Read [.github/prompts/agentic-merge-reference-impl.prompt.md](.github/prompts/agentic-merge-reference-impl.prompt.md) in full before startingβœ…βœ… + + ❌❌Do NOT clone the reference implementation manually β€” the start script does this.❌❌ + ❌❌Do NOT update .lastmerge manually β€” the finish script does this.❌❌ + ❌❌Do NOT skip the finish script β€” it syncs codegen versions and updates .lastmerge.❌❌ ``` -4. After creating the issue, use the `assign_to_agent` safe-output tool to assign Copilot to the newly created issue. +5. After creating the issue, use the `assign_to_agent` safe-output tool to assign Copilot to the newly created issue. ## Important constraints diff --git a/.github/workflows/update-copilot-dependency.yml b/.github/workflows/update-copilot-dependency.yml index bb86bfd832..d29da6acb7 100644 --- a/.github/workflows/update-copilot-dependency.yml +++ b/.github/workflows/update-copilot-dependency.yml @@ -11,6 +11,7 @@ on: permissions: contents: write pull-requests: write + actions: write jobs: update: @@ -28,7 +29,7 @@ jobs: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 with: node-version: 22 @@ -98,7 +99,12 @@ jobs: copilot --yolo --prompt "$(cat /tmp/verify-codegen-prompt.txt)" - - name: Create pull request + # --- Commit, create PR, then run mvn verify --- + # The PR must exist before triggering the agentic fix workflow, which + # uses push-to-pull-request-branch safe-output to push fixes. + + - name: Commit and push changes + id: commit-changes env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} VERSION: ${{ inputs.version }} @@ -118,6 +124,7 @@ jobs: if git diff --cached --quiet; then echo "No changes detected; skipping commit and PR creation." + echo "has_changes=false" >> "$GITHUB_OUTPUT" exit 0 fi @@ -126,11 +133,23 @@ jobs: - Updated @github/copilot in scripts/codegen - Re-ran Java code generator" git push origin "$BRANCH" --force-with-lease + echo "has_changes=true" >> "$GITHUB_OUTPUT" + echo "branch=$BRANCH" >> "$GITHUB_OUTPUT" + - name: Create pull request + id: create-pr + if: steps.commit-changes.outputs.has_changes == 'true' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ inputs.version }} + BRANCH: ${{ steps.commit-changes.outputs.branch }} + run: | if gh pr view "$BRANCH" >/dev/null 2>&1; then echo "Pull request for branch '$BRANCH' already exists; updated branch only." + PR_NUMBER=$(gh pr view "$BRANCH" --json number --jq .number) + gh pr edit "$PR_NUMBER" --add-label dependencies else - gh pr create \ + PR_NUMBER=$(gh pr create \ --title "Update @github/copilot to $VERSION" \ --body "Automated update of \`@github/copilot\` to version \`$VERSION\`. @@ -139,6 +158,109 @@ jobs: - Re-ran Java code generator (\`scripts/codegen\`) > Created by the **Update @github/copilot Dependency** workflow." \ + --label dependencies \ --base main \ - --head "$BRANCH" + --head "$BRANCH" \ + | grep -oE '[0-9]+$' || gh pr view "$BRANCH" --json number --jq .number) fi + echo "pr_number=$PR_NUMBER" >> "$GITHUB_OUTPUT" + + # --- Build verification --- + + - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + if: steps.commit-changes.outputs.has_changes == 'true' + with: + java-version: "17" + distribution: "microsoft" + cache: "maven" + + - name: Run mvn verify + id: mvn-verify + if: steps.commit-changes.outputs.has_changes == 'true' + continue-on-error: true + env: + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + run: | + set -o pipefail + mvn verify 2>&1 | tee /tmp/mvn-verify-output.txt + echo "exit_code=$?" >> "$GITHUB_OUTPUT" + + - name: Capture error summary + id: error-summary + if: steps.mvn-verify.outcome == 'failure' + run: | + # Extract the last 80 lines as error summary (enough context for the agent) + SUMMARY=$(tail -80 /tmp/mvn-verify-output.txt) + # Write to file to avoid shell escaping issues with multiline strings + echo "$SUMMARY" > /tmp/error-summary.txt + echo "has_errors=true" >> "$GITHUB_OUTPUT" + + # --- Agentic fix on failure --- + + - name: Trigger agentic fix workflow + id: trigger-fix + if: steps.error-summary.outputs.has_errors == 'true' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: ${{ steps.commit-changes.outputs.branch }} + PR_NUMBER: ${{ steps.create-pr.outputs.pr_number }} + run: | + ERROR_SUMMARY=$(cat /tmp/error-summary.txt) + gh workflow run codegen-agentic-fix.lock.yml \ + -f branch="$BRANCH" \ + -f pr_number="$PR_NUMBER" \ + -f error_summary="$ERROR_SUMMARY" + echo "Triggered codegen-agentic-fix workflow on branch $BRANCH" + + - name: Wait for agentic fix to complete + if: steps.trigger-fix.outcome == 'success' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: ${{ steps.commit-changes.outputs.branch }} + run: | + echo "Waiting for agentic fix workflow to start..." + sleep 30 + + for i in $(seq 1 60); do + RUN_ID=$(gh run list \ + --workflow=codegen-agentic-fix.lock.yml \ + --branch="$BRANCH" \ + --limit=1 \ + --json databaseId,status \ + --jq '.[0].databaseId') + + STATUS=$(gh run list \ + --workflow=codegen-agentic-fix.lock.yml \ + --branch="$BRANCH" \ + --limit=1 \ + --json databaseId,status \ + --jq '.[0].status') + + if [ "$STATUS" = "completed" ]; then + echo "Agentic fix workflow run $RUN_ID completed." + CONCLUSION=$(gh run view "$RUN_ID" --json conclusion --jq .conclusion) + echo "Conclusion: $CONCLUSION" + break + fi + + echo "Run $RUN_ID status: $STATUS (attempt $i/60)" + sleep 30 + done + + if [ "$STATUS" != "completed" ]; then + echo "::warning::Agentic fix workflow did not complete within 30 minutes." + fi + + - name: Fetch latest changes after agentic fix + if: steps.trigger-fix.outcome == 'success' + env: + BRANCH: ${{ steps.commit-changes.outputs.branch }} + run: | + git fetch origin "$BRANCH" + git reset --hard "origin/$BRANCH" + + - name: Final mvn verify after agentic fix + if: steps.trigger-fix.outcome == 'success' + env: + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + run: mvn verify diff --git a/.github/workflows/weekly-reference-impl-sync.yml b/.github/workflows/weekly-reference-impl-sync.yml deleted file mode 100644 index aa3fc971ac..0000000000 --- a/.github/workflows/weekly-reference-impl-sync.yml +++ /dev/null @@ -1,181 +0,0 @@ -name: "Weekly Reference Implementation Sync" - -on: - schedule: - # Every Monday at 10:00 UTC (5:00 AM EST / 6:00 AM EDT) - - cron: '0 10 * * 1' - workflow_dispatch: - -permissions: - contents: write - issues: write - pull-requests: write - -env: - # Used for `gh` CLI operations to create/close/comment issues. Must be a PAT with repo permissions because the default - GH_AW_AGENT_TOKEN: ${{ secrets.GH_AW_AGENT_TOKEN }} - GH_TOKEN: ${{ secrets.GH_AW_AGENT_TOKEN }} - -jobs: - - check-and-sync: - name: "Check reference implementation & trigger Copilot merge" - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - name: Check for reference implementation changes - id: check - run: | - LAST_MERGE=$(cat .lastmerge) - echo "Last merged commit: $LAST_MERGE" - - git clone --quiet https://github.com/github/copilot-sdk.git /tmp/reference-impl - cd /tmp/reference-impl - - REFERENCE_IMPL_HEAD=$(git rev-parse HEAD) - echo "Reference implementation HEAD: $REFERENCE_IMPL_HEAD" - - echo "last_merge=$LAST_MERGE" >> "$GITHUB_OUTPUT" - - if [ "$LAST_MERGE" = "$REFERENCE_IMPL_HEAD" ]; then - echo "No new reference implementation changes since last merge." - echo "has_changes=false" >> "$GITHUB_OUTPUT" - else - COMMIT_COUNT=$(git rev-list --count "$LAST_MERGE".."$REFERENCE_IMPL_HEAD") - echo "Found $COMMIT_COUNT new reference implementation commits." - echo "has_changes=true" >> "$GITHUB_OUTPUT" - echo "commit_count=$COMMIT_COUNT" >> "$GITHUB_OUTPUT" - echo "reference_impl_head=$REFERENCE_IMPL_HEAD" >> "$GITHUB_OUTPUT" - - # Generate a short summary of changes - SUMMARY=$(git log --oneline "$LAST_MERGE".."$REFERENCE_IMPL_HEAD" | head -20) - { - echo "summary<> "$GITHUB_OUTPUT" - fi - - - name: Close previous reference-impl-sync issues - if: steps.check.outputs.has_changes == 'true' - run: | - # Find all open issues with the reference-impl-sync label - OPEN_ISSUES=$(gh issue list \ - --repo "${{ github.repository }}" \ - --label "reference-impl-sync" \ - --state open \ - --json number \ - --jq '.[].number') - - for ISSUE_NUM in $OPEN_ISSUES; do - echo "Closing superseded issue #${ISSUE_NUM}" - gh issue comment "$ISSUE_NUM" \ - --repo "${{ github.repository }}" \ - --body "Superseded by a newer reference implementation sync issue. Closing this one." - gh issue close "$ISSUE_NUM" \ - --repo "${{ github.repository }}" \ - --reason "not planned" - done - - - name: Close stale reference-impl-sync issues (no changes) - if: steps.check.outputs.has_changes == 'false' - run: | - OPEN_ISSUES=$(gh issue list \ - --repo "${{ github.repository }}" \ - --label "reference-impl-sync" \ - --state open \ - --json number \ - --jq '.[].number') - - for ISSUE_NUM in $OPEN_ISSUES; do - echo "Closing stale issue #${ISSUE_NUM} β€” reference implementation is up to date" - gh issue comment "$ISSUE_NUM" \ - --repo "${{ github.repository }}" \ - --body "No new reference implementation changes detected. The Java SDK is up to date. Closing." - gh issue close "$ISSUE_NUM" \ - --repo "${{ github.repository }}" \ - --reason "completed" - done - - - name: Create issue and assign to Copilot - id: create-issue - if: steps.check.outputs.has_changes == 'true' - env: - SUMMARY: ${{ steps.check.outputs.summary }} - run: | - COMMIT_COUNT="${{ steps.check.outputs.commit_count }}" - LAST_MERGE="${{ steps.check.outputs.last_merge }}" - REFERENCE_IMPL_HEAD="${{ steps.check.outputs.reference_impl_head }}" - DATE=$(date -u +"%Y-%m-%d") - REPO="${{ github.repository }}" - - BODY="## Automated Reference Implementation Sync - - There are **${COMMIT_COUNT}** new commits in the [official Copilot SDK](https://github.com/github/copilot-sdk) since the last merge. - - - **Last merged commit:** [\`${LAST_MERGE}\`](https://github.com/github/copilot-sdk/commit/${LAST_MERGE}) - - **Reference implementation HEAD:** [\`${REFERENCE_IMPL_HEAD}\`](https://github.com/github/copilot-sdk/commit/${REFERENCE_IMPL_HEAD}) - - ### Recent reference implementation commits - - \`\`\` - ${SUMMARY} - \`\`\` - - ### Instructions - - Follow the [agentic-merge-reference-impl](.github/prompts/agentic-merge-reference-impl.prompt.md) prompt to port these changes to the Java SDK." - - # Create the issue and assign to Copilot coding agent - ISSUE_URL=$(gh issue create \ - --repo "$REPO" \ - --title "Reference implementation sync: ${COMMIT_COUNT} new commits (${DATE})" \ - --body "$BODY" \ - --label "reference-impl-sync" \ - --assignee "copilot-swe-agent") - - echo "issue_url=$ISSUE_URL" >> "$GITHUB_OUTPUT" - echo "βœ… Issue created and assigned to Copilot coding agent: $ISSUE_URL" - - - name: Summary - if: always() - env: - SUMMARY: ${{ steps.check.outputs.summary }} - run: | - HAS_CHANGES="${{ steps.check.outputs.has_changes }}" - COMMIT_COUNT="${{ steps.check.outputs.commit_count }}" - LAST_MERGE="${{ steps.check.outputs.last_merge }}" - REFERENCE_IMPL_HEAD="${{ steps.check.outputs.reference_impl_head }}" - ISSUE_URL="${{ steps.create-issue.outputs.issue_url }}" - - { - echo "## Weekly Reference Implementation Sync" - echo "" - if [ "$HAS_CHANGES" = "true" ]; then - echo "### βœ… New reference implementation changes detected" - echo "" - echo "| | |" - echo "|---|---|" - echo "| **New commits** | ${COMMIT_COUNT} |" - echo "| **Last merged** | \`${LAST_MERGE:0:12}\` |" - echo "| **Reference implementation HEAD** | \`${REFERENCE_IMPL_HEAD:0:12}\` |" - echo "" - echo "An issue has been created and assigned to the Copilot coding agent: " - echo " -> ${ISSUE_URL}" - echo "" - echo "### Recent reference implementation commits" - echo "" - echo '```' - echo "$SUMMARY" - echo '```' - else - echo "### ⏭️ No changes" - echo "" - echo "The Java SDK is already up to date with the reference implementation Copilot SDK." - echo "" - echo "**Last merged commit:** \`${LAST_MERGE:0:12}\`" - fi - } >> "$GITHUB_STEP_SUMMARY" diff --git a/.gitignore b/.gitignore index 35ea546f09..654d3278f8 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ changebundle.txt* .settings scripts/codegen/node_modules/ *~ +*.sln diff --git a/.lastmerge b/.lastmerge index 4255f7b138..473fef56df 100644 --- a/.lastmerge +++ b/.lastmerge @@ -1 +1 @@ -922959f4a7b83509c3620d4881733c6c5677f00c +f4d22d70016c377881d86e4c77f8a3f93746ffae diff --git a/CHANGELOG.md b/CHANGELOG.md index 3592a5320d..8e174dd216 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ## [Unreleased] -> **Reference implementation sync:** [`github/copilot-sdk@922959f`](https://github.com/github/copilot-sdk/commit/922959f4a7b83509c3620d4881733c6c5677f00c) +> **Reference implementation sync:** [`github/copilot-sdk@e20f5be`](https://github.com/github/copilot-sdk/commit/e20f5bef125860accb30c60d1b35109371a77f16) + +## [1.0.0-beta-java.4] - 2026-05-16 + +> **Reference implementation sync:** [`github/copilot-sdk@e20f5be`](https://github.com/github/copilot-sdk/commit/e20f5bef125860accb30c60d1b35109371a77f16) +## [1.0.0-beta-java.3] - 2026-05-11 + +> **Reference implementation sync:** [`github/copilot-sdk@4a0437b`](https://github.com/github/copilot-sdk/commit/4a0437bb03a0b60a1867f14ae8e3faf053afa5aa) +## [1.0.0-beta-java.2] - 2026-05-08 + +> **Reference implementation sync:** [`github/copilot-sdk@066a69c`](https://github.com/github/copilot-sdk/commit/066a69c1e849adf1bd98564ab1b52316ec471182) +## [1.0.0-beta-java.1] - 2026-05-05 + +> **Reference implementation sync:** [`github/copilot-sdk@c063458`](https://github.com/github/copilot-sdk/commit/c063458ecc3d606766f04cf203b11b08de672cc8) +## [0.3.0-java.2] - 2026-04-26 +> **Reference implementation sync:** [`github/copilot-sdk@dd2dcbc`](https://github.com/github/copilot-sdk/commit/dd2dcbc439256acfb9feb2cff07c0b9c820091b8) ## [0.3.0-java-preview.1] - 2026-04-21 > **Reference implementation sync:** [`github/copilot-sdk@922959f`](https://github.com/github/copilot-sdk/commit/922959f4a7b83509c3620d4881733c6c5677f00c) @@ -494,29 +509,13 @@ New types: `GetForegroundSessionResponse`, `SetForegroundSessionResponse` - Pre-commit hook for Spotless code formatting - Comprehensive API documentation -[Unreleased]: https://github.com/github/copilot-sdk-java/compare/v0.3.0-java-preview.0...HEAD -[0.3.0-java-preview.0]: https://github.com/github/copilot-sdk-java/compare/v0.2.2-java.1...v0.3.0-java-preview.0 -[Unreleased]: https://github.com/github/copilot-sdk-java/compare/v0.3.0-java-preview.0...HEAD -[0.3.0-java-preview.0]: https://github.com/github/copilot-sdk-java/compare/v0.2.2-java.1...v0.3.0-java-preview.0 -[Unreleased]: https://github.com/github/copilot-sdk-java/compare/v0.3.0-java-preview.1...HEAD +[Unreleased]: https://github.com/github/copilot-sdk-java/compare/v1.0.0-beta-java.4...HEAD +[1.0.0-beta-java.4]: https://github.com/github/copilot-sdk-java/compare/v1.0.0-beta-java.3...v1.0.0-beta-java.4 +[1.0.0-beta-java.3]: https://github.com/github/copilot-sdk-java/compare/v1.0.0-beta-java.2...v1.0.0-beta-java.3 +[1.0.0-beta-java.2]: https://github.com/github/copilot-sdk-java/compare/v1.0.0-beta-java.1...v1.0.0-beta-java.2 +[1.0.0-beta-java.1]: https://github.com/github/copilot-sdk-java/compare/v0.3.0-java.2...v1.0.0-beta-java.1 +[0.3.0-java.2]: https://github.com/github/copilot-sdk-java/compare/v0.2.2-java.1...v0.3.0-java.2 [0.3.0-java-preview.1]: https://github.com/github/copilot-sdk-java/compare/v0.2.2-java.1...v0.3.0-java-preview.1 -[0.2.2-java.1]: https://github.com/github/copilot-sdk-java/compare/v0.2.1-java.1...v0.2.2-java.1 -[Unreleased]: https://github.com/github/copilot-sdk-java/compare/v0.3.0-java-preview.0...HEAD -[0.3.0-java-preview.0]: https://github.com/github/copilot-sdk-java/compare/v0.2.2-java.1...v0.3.0-java-preview.0 -[0.2.2-java.1]: https://github.com/github/copilot-sdk-java/compare/v0.2.1-java.1...v0.2.2-java.1 -[0.2.1-java.1]: https://github.com/github/copilot-sdk-java/compare/v0.2.1-java.0...v0.2.1-java.1 -[Unreleased]: https://github.com/github/copilot-sdk-java/compare/v0.3.0-java-preview.0...HEAD -[0.3.0-java-preview.0]: https://github.com/github/copilot-sdk-java/compare/v0.2.2-java.1...v0.3.0-java-preview.0 -[0.2.2-java.1]: https://github.com/github/copilot-sdk-java/compare/v0.2.1-java.1...v0.2.2-java.1 -[0.2.1-java.1]: https://github.com/github/copilot-sdk-java/compare/v0.2.1-java.0...v0.2.1-java.1 -[0.2.1-java.0]: https://github.com/github/copilot-sdk-java/compare/v0.1.32-java.0...v0.2.1-java.0 -[Unreleased]: https://github.com/github/copilot-sdk-java/compare/v0.3.0-java-preview.0...HEAD -[0.3.0-java-preview.0]: https://github.com/github/copilot-sdk-java/compare/v0.2.2-java.1...v0.3.0-java-preview.0 -[0.2.2-java.1]: https://github.com/github/copilot-sdk-java/compare/v0.2.1-java.1...v0.2.2-java.1 -[0.2.1-java.1]: https://github.com/github/copilot-sdk-java/compare/v0.2.1-java.0...v0.2.1-java.1 -[0.2.1-java.0]: https://github.com/github/copilot-sdk-java/compare/v0.1.32-java.0...v0.2.1-java.0 -[0.1.32-java.0]: https://github.com/github/copilot-sdk-java/compare/v1.0.11...v0.1.32-java.0 -[Unreleased]: https://github.com/github/copilot-sdk-java/compare/v0.3.0-java-preview.0...HEAD [0.3.0-java-preview.0]: https://github.com/github/copilot-sdk-java/compare/v0.2.2-java.1...v0.3.0-java-preview.0 [0.2.2-java.1]: https://github.com/github/copilot-sdk-java/compare/v0.2.1-java.1...v0.2.2-java.1 [0.2.1-java.1]: https://github.com/github/copilot-sdk-java/compare/v0.2.1-java.0...v0.2.1-java.1 @@ -534,4 +533,3 @@ New types: `GetForegroundSessionResponse`, `SetForegroundSessionResponse` [1.0.2]: https://github.com/github/copilot-sdk-java/compare/v1.0.1...v1.0.2 [1.0.1]: https://github.com/github/copilot-sdk-java/compare/1.0.0...v1.0.1 [1.0.0]: https://github.com/github/copilot-sdk-java/releases/tag/1.0.0 - diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f86976c01f..38f2def77c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,7 +38,9 @@ If you have ideas for entirely new features, please post an issue or start a dis 1. Push to your fork and [submit a pull request][pr] 1. Pat yourself on the back and wait for your pull request to be reviewed and merged. -### Running tests and linters +### Running locally, including tests and linters + +The POM has logic to ensure a known correct installation of Copilot CLI is used when executing the tests. If you want to test against a different installation of Copilot CLI, set the value of the `copilot.cli.path` maven property to the fully qualified path to the Copilot CLI. ```bash # Build and run all tests @@ -54,6 +56,22 @@ mvn spotless:apply mvn spotless:check ``` +## Running the known correct Copilot CLI installation + +### POSIX + +```bash +export COPILOT_CLI_PATH="$(find "$PWD/target" -type f -path '*/nodejs/node_modules/@github/copilot/index.js' | head -n 1)" +node ${COPILOT_CLI_PATH} +``` + +### PowerShell + +```PowerShell +$env:COPILOT_CLI_PATH = (Get-ChildItem -Path "$PWD\target" -Recurse -Filter 'index.js' -File | Where-Object { $_.FullName -match '[\\/]nodejs[\\/]node_modules[\\/]@github[\\/]copilot[\\/]index\.js$' } | Select-Object -First 1 -ExpandProperty FullName) +node $env:COPILOT_CLI_PATH +``` + Here are a few things you can do that will increase the likelihood of your pull request being accepted: - Write tests. diff --git a/README.md b/README.md index 1c129cbffe..37bb2d659b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ [![Build](https://github.com/github/copilot-sdk-java/actions/workflows/build-test.yml/badge.svg)](https://github.com/github/copilot-sdk-java/actions/workflows/build-test.yml) [![Site](https://github.com/github/copilot-sdk-java/actions/workflows/deploy-site.yml/badge.svg)](https://github.com/github/copilot-sdk-java/actions/workflows/deploy-site.yml) -[![Coverage](.github/badges/jacoco.svg)](https://github.github.io/copilot-sdk-java/snapshot/jacoco/index.html) +[![Handwritten Coverage](.github/badges/jacoco-handwritten.svg)](https://github.github.io/copilot-sdk-java/snapshot/jacoco/index.html) +[![Generated Coverage](.github/badges/jacoco-generated.svg)](https://github.github.io/copilot-sdk-java/snapshot/jacoco/index.html) [![Documentation](https://img.shields.io/badge/docs-online-brightgreen)](https://github.github.io/copilot-sdk-java/) [![Java 17+](https://img.shields.io/badge/Java-17%2B-blue?logo=openjdk&logoColor=white)](https://openjdk.org/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) @@ -33,7 +34,7 @@ Java SDK for programmatic control of GitHub Copilot CLI, enabling you to build A com.github copilot-sdk-java - 0.3.0-java-preview.0 + 1.0.0-beta-java.4 ``` @@ -53,14 +54,14 @@ Snapshot builds of the next development version are published to Maven Central S com.github copilot-sdk-java - 0.3.0-java.1-SNAPSHOT + 1.0.0-beta-java.5-SNAPSHOT ``` ### Gradle ```groovy -implementation 'com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0' +implementation 'com.github:copilot-sdk-java:1.0.0-beta-java.4' ``` ## Quick Start @@ -165,7 +166,7 @@ Contributions are welcome! Please see the [Contributing Guide](CONTRIBUTING.md) This SDK tracks the official [Copilot SDK](https://github.com/github/copilot-sdk) (.NET reference implementation) and ports changes to Java. The reference implementation merge process is automated with AI assistance: -**Weekly automated sync** β€” A [scheduled GitHub Actions workflow](.github/workflows/weekly-reference-impl-sync.yml) runs every Monday at 5 AM ET. It checks for new reference implementation commits since the last merge (tracked in [`.lastmerge`](.lastmerge)), and if changes are found, creates an issue labeled `reference-impl-sync` and assigns it to the GitHub Copilot coding agent. Any previously open `reference-impl-sync` issues are automatically closed. +**Automated sync** β€” A [scheduled GitHub Actions workflow](.github/workflows/reference-impl-sync.yml) runs on the schedule specified in that file. It checks for new reference implementation commits since the last merge (tracked in [`.lastmerge`](.lastmerge)), and if changes are found, creates an issue labeled `reference-impl-sync` and assigns it to the GitHub Copilot coding agent. Any previously open `reference-impl-sync` issues are automatically closed. The sync also updates the `@github/copilot` version in both `pom.xml` and `scripts/codegen/package.json` to keep schemas and test CLI in lockstep. **Reusable prompt** β€” The merge workflow is defined in [`agentic-merge-reference-impl.prompt.md`](.github/prompts/agentic-merge-reference-impl.prompt.md). It can be triggered manually from: - **VS Code Copilot Chat** β€” type `/agentic-merge-reference-impl` @@ -212,4 +213,3 @@ MIT β€” see [LICENSE](LICENSE) for details. [![Star History Chart](https://api.star-history.com/svg?repos=github/copilot-sdk-java&type=Date)](https://www.star-history.com/#github/copilot-sdk-java&Date) ⭐ Drop a star if you find this useful! - diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 9a6f3761b5..fcde1f6c97 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -11,9 +11,9 @@ - + - + diff --git a/docs/WORKFLOWS.md b/docs/WORKFLOWS.md index 3df254890c..9dd3833d1b 100644 --- a/docs/WORKFLOWS.md +++ b/docs/WORKFLOWS.md @@ -6,11 +6,11 @@ |----------|-------------|----------|----------| | [Build & Test](workflows/build-test.yml) | Builds, lints, and tests the Java SDK | `push` (main), `pull_request`, `merge_group`, `workflow_dispatch` | Sundays at 00:00 UTC | | [Codegen Check](workflows/codegen-check.yml) | Verifies that generated Java files are up-to-date with the JSON schemas | `push` (main), `pull_request`, `workflow_dispatch` | β€” | -| [Update @github/copilot Dependency](workflows/update-copilot-dependency.yml) | Updates the `@github/copilot` npm package, re-runs code generation, and opens a PR | `workflow_dispatch` | β€” | +| [Update @github/copilot Dependency](workflows/update-copilot-dependency.yml) | _(Codegen-only)_ Updates the `@github/copilot` npm package in `scripts/codegen`, re-runs code generation, and opens a PR. Does **not** update `pom.xml`; use the Reference Implementation Sync for full version alignment. | `workflow_dispatch` | β€” | | [Deploy Documentation](workflows/deploy-site.yml) | Generates and deploys versioned docs to GitHub Pages | `workflow_run` (after Build & Test), `release`, `workflow_dispatch` | β€” | | [Publish to Maven Central](workflows/publish-maven.yml) | Releases the SDK to Maven Central and creates a GitHub Release | `workflow_dispatch` | β€” | -| [Weekly Reference Implementation Sync](workflows/weekly-reference-impl-sync.yml) | Checks for new reference implementation commits and creates an issue for Copilot to merge | `workflow_dispatch` | Mondays at 10:00 UTC | -| [Weekly Reference Implementation Sync (Agentic)](workflows/weekly-reference-impl-sync.lock.yml) | Compiled agentic workflow that executes the reference implementation sync via `gh-aw` | `workflow_dispatch` | Tuesdays at 08:39 UTC (scattered) | +| [Reference Implementation Sync](workflows/reference-impl-sync.yml) | Checks for new reference implementation commits and creates an issue for Copilot to merge | `workflow_dispatch` | [See workflow](workflows/reference-impl-sync.yml) | +| [Reference Implementation Sync (Agentic)](workflows/reference-impl-sync.lock.yml) | Compiled agentic workflow that executes the reference implementation sync via `gh-aw` | `workflow_dispatch` | [See workflow](workflows/reference-impl-sync.lock.yml) | | [Copilot Setup Steps](workflows/copilot-setup-steps.yml) | Configures the environment for the GitHub Copilot coding agent | `push` (on self-change), `workflow_dispatch` | β€” | --- @@ -64,11 +64,11 @@ Manual-only workflow that performs a full release: --- -## Weekly Reference Implementation Sync +## Reference Implementation Sync -**File:** [`weekly-reference-impl-sync.yml`](workflows/weekly-reference-impl-sync.yml) +**File:** [`reference-impl-sync.yml`](workflows/reference-impl-sync.yml) -Runs every Monday at 10:00 UTC. Clones the official `github/copilot-sdk` repository and compares `HEAD` against the commit hash stored in `.lastmerge`. +Runs on the schedule specified in [`.github/workflows/reference-impl-sync.yml`](workflows/reference-impl-sync.yml). Clones the official `github/copilot-sdk` repository and compares `HEAD` against the commit hash stored in `.lastmerge`. If new commits are found: 1. Closes any previously open `reference-impl-sync` issues @@ -79,9 +79,9 @@ If no changes are found, any stale open `reference-impl-sync` issues are closed. --- -## Weekly Reference Implementation Sync (Agentic Workflow: Experimental) +## Reference Implementation Sync (Agentic Workflow: Experimental) -**File:** [`weekly-reference-impl-sync.lock.yml`](workflows/weekly-reference-impl-sync.lock.yml) +**File:** [`reference-impl-sync.lock.yml`](workflows/reference-impl-sync.lock.yml) Auto-generated compiled workflow produced by `gh aw compile` from the corresponding `.md` source. This is the agentic counterpart that actually executes the reference implementation merge using the `gh-aw` MCP server and Copilot coding agent. @@ -113,6 +113,8 @@ If changes appear, commit the updated generated files. **File:** [`update-copilot-dependency.yml`](workflows/update-copilot-dependency.yml) +> **Note:** This workflow is for codegen-only updates to `scripts/codegen`. It does **not** update `pom.xml`. For full version alignment (both CLI and codegen in lockstep), use the **Reference Implementation Sync** workflow instead. + Manual workflow triggered when a new version of the `@github/copilot` npm package is published. Accepts a `version` input (e.g. `1.0.25`). Steps: diff --git a/docs/adr/adr-002-maven-version-and-reference-implementation-tracking.md b/docs/adr/adr-002-maven-version-and-reference-implementation-tracking.md index 6a0b54f225..248a024c23 100644 --- a/docs/adr/adr-002-maven-version-and-reference-implementation-tracking.md +++ b/docs/adr/adr-002-maven-version-and-reference-implementation-tracking.md @@ -8,7 +8,7 @@ Releases of this implementation track releases of the reference implementation. - Simple number qualifier (0.1.32-0, 0.1.32-1, ...) fails on a subtle but important point: 0.1.32-0 is treated identically to 0.1.32 by Maven (trailing zeros are normalized away), and bare numeric qualifiers are pre-release semantics. Your "first release" would sort before the reference implementation bare version. -- Java and number in the qualifier (0.1.32-java.N +- Java and number in the qualifier (0.1.32-java.N) - java is an unknown qualifier that sorts correctly and accurately describes what it is β€” the Java-ecosystem release of this version. diff --git a/jbang-example.java b/jbang-example.java index aec2c69c52..1c41679cdf 100644 --- a/jbang-example.java +++ b/jbang-example.java @@ -1,5 +1,5 @@ -! -//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0 +///usr/bin/env jbang "$0" "$@" ; exit $? +//DEPS com.github:copilot-sdk-java:1.0.0-beta-java.4 import com.github.copilot.sdk.CopilotClient; import com.github.copilot.sdk.generated.AssistantMessageEvent; import com.github.copilot.sdk.generated.SessionUsageInfoEvent; diff --git a/pom.xml b/pom.xml index 5b2dbc3bc2..be9e92a93a 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.github copilot-sdk-java - 0.3.0-java-preview.1 + 1.0.0-beta-java.5-SNAPSHOT jar GitHub Copilot SDK :: Java @@ -33,7 +33,7 @@ scm:git:https://github.com/github/copilot-sdk-java.git scm:git:https://github.com/github/copilot-sdk-java.git https://github.com/github/copilot-sdk-java - v0.3.0-java-preview.1 + HEAD @@ -49,10 +49,53 @@ ${project.build.directory}/copilot-sdk ${copilot.sdk.clone.dir}/test + + ${copilot.sdk.clone.dir}/nodejs/node_modules/@github/copilot/index.js false + + ${skip.test.harness} + + ^1.0.52-1 + @@ -60,7 +103,7 @@ com.fasterxml.jackson.core jackson-databind - 2.21.1 + 2.21.3 com.fasterxml.jackson.core @@ -70,7 +113,7 @@ com.fasterxml.jackson.datatype jackson-datatype-jsr310 - 2.21.1 + 2.21.3 @@ -85,7 +128,7 @@ org.junit.jupiter junit-jupiter - 5.14.1 + 5.14.4 test @@ -112,7 +155,7 @@ com.github.spotbugs spotbugs-maven-plugin - 4.9.8.2 + 4.9.8.3 config/spotbugs/spotbugs-exclude.xml @@ -123,19 +166,12 @@ org.apache.maven.plugins maven-compiler-plugin - 3.14.1 + 3.15.0 org.apache.maven.plugins maven-jar-plugin - 3.4.2 - - - - com.github.copilot.sdk.java - - - + 3.5.0 @@ -215,7 +251,7 @@ org.apache.ant ant - 1.10.15 + 1.10.17 @@ -223,7 +259,7 @@ org.codehaus.mojo exec-maven-plugin - 3.6.2 + 3.6.3 install-harness-dependencies @@ -240,20 +276,97 @@ + + + install-nodejs-cli-dependencies + generate-test-resources + + exec + + + ${skip.cli.install} + npm + ${copilot.sdk.clone.dir}/nodejs + + ci + --ignore-scripts + + + org.apache.maven.plugins maven-surefire-plugin - 3.5.4 + 3.5.5 + alphabetical ${testExecutionAgentArgs} ${surefire.jvm.args} + + 2 ${copilot.tests.dir} ${copilot.sdk.clone.dir} + + + ${copilot.cli.path} + + + + + isolated-resume-tests + test + + test + + + isolated-resume + + ${project.build.directory}/surefire-reports-isolated + + + + + default-test + + isolated-resume + + + @@ -278,7 +391,7 @@ com.diffplug.spotless spotless-maven-plugin - 2.44.5 + 2.46.1 @@ -369,7 +482,7 @@ org.apache.maven.plugins maven-resources-plugin - 3.4.0 + 3.5.0 filter-site-markdown @@ -456,7 +569,7 @@ org.apache.maven.doxia doxia-module-markdown - 2.0.0 + 2.1.0 @@ -515,13 +628,13 @@ org.apache.maven.plugins maven-surefire-report-plugin - 3.5.4 + 3.5.5 com.github.spotbugs spotbugs-maven-plugin - 4.9.8.2 + 4.9.8.3 config/spotbugs/spotbugs-exclude.xml @@ -530,7 +643,7 @@ org.codehaus.mojo taglist-maven-plugin - 3.2.1 + 3.2.2 @@ -555,7 +668,7 @@ org.apache.maven.plugins maven-dependency-plugin - 3.9.0 + 3.10.0 @@ -587,6 +700,39 @@ true + + + skip-cli-install-when-tests-skipped + + + skipTests + true + + + + true + + + + + skip-cli-install-when-maven-test-skip + + + maven.test.skip + true + + + + true + + debug @@ -659,7 +805,7 @@ org.codehaus.mojo exec-maven-plugin - 3.6.2 + 3.6.3 update-copilot-schema-version @@ -681,7 +827,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.5.0 + 3.6.3 require-schema-version @@ -712,7 +858,7 @@ org.codehaus.mojo exec-maven-plugin - 3.6.2 + 3.6.3 codegen-npm-install diff --git a/scripts/codegen/java.ts b/scripts/codegen/java.ts index 7c2ea7091c..34bc83a9d5 100644 --- a/scripts/codegen/java.ts +++ b/scripts/codegen/java.ts @@ -37,13 +37,29 @@ function toJavaClassName(typeName: string): string { return typeName.split(/[._]/).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(""); } +/** Java reserved keywords and Object method names that cannot be used as record component names. */ +const JAVA_RESERVED_IDENTIFIERS = new Set([ + "abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const", + "continue", "default", "do", "double", "else", "enum", "extends", "final", "finally", "float", + "for", "goto", "if", "implements", "import", "instanceof", "int", "interface", "long", "native", + "new", "package", "private", "protected", "public", "return", "short", "static", "strictfp", + "super", "switch", "synchronized", "this", "throw", "throws", "transient", "try", "void", + "volatile", "while", + // Object methods that conflict with record component accessor names + "wait", "notify", "notifyAll", "getClass", "clone", "finalize", "toString", "hashCode", "equals", +]); + function toCamelCase(name: string): string { const pascal = toPascalCase(name); - return pascal.charAt(0).toLowerCase() + pascal.slice(1); + let result = pascal.charAt(0).toLowerCase() + pascal.slice(1); + if (JAVA_RESERVED_IDENTIFIERS.has(result)) { + result = result + "_"; + } + return result; } function toEnumConstant(value: string): string { - return value.toUpperCase().replace(/[-. ]/g, "_"); + return value.toUpperCase().replace(/[-. /:]/g, "_").replace(/^_+/, "").replace(/_+/g, "_"); } // ── Schema path resolution ─────────────────────────────────────────────────── @@ -97,6 +113,34 @@ interface JavaTypeResult { imports: Set; } +// Module-level state for $ref resolution during codegen. +// Set before each schema generation pass; used by schemaTypeToJava and helpers. +let currentDefinitions: Record = {}; +const pendingStandaloneTypes = new Map(); + +// Cross-schema definitions: keyed by schema filename (e.g. "session-events.schema.json"), +// value is the definitions map from that schema. Populated by generateRpcTypes so that +// cross-schema $ref values like "session-events.schema.json#/definitions/Foo" can be resolved. +const crossSchemaDefinitions = new Map>(); + +/** + * Resolve a $ref in a JSON Schema against the current definitions. + * Returns the resolved schema, or the original if no $ref is present. + */ +function resolveRef(schema: JSONSchema7 | undefined): JSONSchema7 | undefined { + if (!schema) return schema; + if (schema.$ref) { + const name = schema.$ref.replace(/^#\/definitions\//, ""); + const resolved = currentDefinitions[name]; + if (!resolved) { + console.warn(`[codegen] Unresolved $ref: ${schema.$ref}`); + return schema; + } + return resolved; + } + return schema; +} + function schemaTypeToJava( schema: JSONSchema7, required: boolean, @@ -106,6 +150,47 @@ function schemaTypeToJava( ): JavaTypeResult { const imports = new Set(); + // Resolve $ref first β€” register standalone types for generation + if (schema.$ref) { + // Handle cross-schema $ref (e.g. "session-events.schema.json#/definitions/Foo") + const crossSchemaMatch = schema.$ref.match(/^([^#]+)#\/definitions\/(.+)$/); + if (crossSchemaMatch) { + const [, schemaFile, typeName] = crossSchemaMatch; + const externalDefs = crossSchemaDefinitions.get(schemaFile); + if (externalDefs) { + const resolved = externalDefs[typeName]; + if (resolved) { + // Save and swap currentDefinitions so recursive calls resolve against + // the external schema's definitions. + const savedDefs = currentDefinitions; + currentDefinitions = externalDefs; + const result = schemaTypeToJava(resolved, required, context, propName, nestedTypes); + currentDefinitions = savedDefs; + return result; + } + } + // Fallback: extract just the type name and warn + console.warn(`[codegen] Unresolved cross-schema $ref: ${schema.$ref}`); + return { javaType: typeName, imports }; + } + + const name = schema.$ref.replace(/^#\/definitions\//, ""); + const resolved = currentDefinitions[name]; + if (resolved) { + // Enum or object types β†’ register for standalone generation, return ref name + if ((resolved.type === "string" && resolved.enum) || + (resolved.type === "object" && resolved.properties)) { + pendingStandaloneTypes.set(name, resolved); + return { javaType: name, imports }; + } + // Other types (primitives, arrays, maps, anyOf unions) β†’ resolve and recurse + return schemaTypeToJava(resolved, required, context, propName, nestedTypes); + } + // Unresolved $ref β€” return name as-is + console.warn(`[codegen] Unresolved $ref: ${schema.$ref}`); + return { javaType: name, imports }; + } + if (schema.anyOf) { const hasNull = schema.anyOf.some((s) => typeof s === "object" && (s as JSONSchema7).type === "null"); const nonNull = schema.anyOf.filter((s) => typeof s === "object" && (s as JSONSchema7).type !== "null"); @@ -206,11 +291,6 @@ function schemaTypeToJava( return { javaType: "Map", imports }; } - if (schema.$ref) { - const refName = schema.$ref.split("/").pop()!; - return { javaType: refName, imports }; - } - console.warn(`[codegen] ${context}.${propName}: unrecognized schema (type=${JSON.stringify(schema.type)}) β€” falling back to Object`); return { javaType: "Object", imports }; } @@ -235,21 +315,34 @@ interface EventVariant { } function extractEventVariants(schema: JSONSchema7): EventVariant[] { - const sessionEvent = (schema.definitions as Record)?.SessionEvent; + const definitions = schema.definitions as Record; + const sessionEvent = definitions?.SessionEvent; if (!sessionEvent?.anyOf) throw new Error("Schema must have SessionEvent definition with anyOf"); return (sessionEvent.anyOf as JSONSchema7[]) .map((variant) => { - const typeSchema = variant.properties?.type as JSONSchema7; + // Resolve $ref if present (1.0.35+ schema uses $ref to named definitions) + let resolved = variant; + if (variant.$ref) { + const refName = variant.$ref.replace(/^#\/definitions\//, ""); + resolved = definitions[refName]; + if (!resolved) throw new Error(`Unresolved $ref: ${variant.$ref}`); + } + const typeSchema = resolved.properties?.type as JSONSchema7; const typeName = typeSchema?.const as string; if (!typeName) throw new Error("Variant must have type.const"); const baseName = toJavaClassName(typeName); - const dataSchema = variant.properties?.data as JSONSchema7 | undefined; + let dataSchema = resolved.properties?.data as JSONSchema7 | undefined; + // Resolve $ref on data schema if present + if (dataSchema?.$ref) { + const dataRefName = dataSchema.$ref.replace(/^#\/definitions\//, ""); + dataSchema = definitions[dataRefName]; + } return { typeName, className: `${baseName}Event`, dataSchema: dataSchema ?? null, - description: variant.description, + description: resolved.description, }; }) .filter((v) => !EXCLUDED_EVENT_TYPES.has(v.typeName)); @@ -260,6 +353,10 @@ async function generateSessionEvents(schemaPath: string): Promise { const schemaContent = await fs.readFile(schemaPath, "utf-8"); const schema = JSON.parse(schemaContent) as JSONSchema7; + // Set module-level definitions for $ref resolution + currentDefinitions = (schema.definitions ?? {}) as Record; + pendingStandaloneTypes.clear(); + const variants = extractEventVariants(schema); const packageName = "com.github.copilot.sdk.generated"; const packageDir = `src/generated/java/com/github/copilot/sdk/generated`; @@ -272,6 +369,9 @@ async function generateSessionEvents(schemaPath: string): Promise { await generateEventVariantClass(variant, packageName, packageDir); } + // Generate standalone types discovered via $ref resolution + await generatePendingStandaloneTypes(packageName, packageDir, GENERATED_FROM_SESSION_EVENTS); + console.log(`βœ… Generated ${variants.length + 1} session event files`); } @@ -597,6 +697,141 @@ async function generateEventVariantClass( await writeGeneratedFile(`${packageDir}/${variant.className}.java`, lines.join("\n")); } +// ── Standalone $ref type generation ────────────────────────────────────────── + +/** + * Generate all pending standalone types discovered via $ref resolution. + * Iterates until no new types are discovered (handles transitive $ref chains). + */ +async function generatePendingStandaloneTypes( + packageName: string, + packageDir: string, + headerComment: string +): Promise { + const generated = new Set(); + + while (true) { + const batch: [string, JSONSchema7][] = []; + for (const [name, schema] of pendingStandaloneTypes) { + if (!generated.has(name)) { + batch.push([name, schema]); + generated.add(name); + } + } + pendingStandaloneTypes.clear(); + + if (batch.length === 0) break; + + for (const [name, schema] of batch) { + if (schema.type === "string" && schema.enum) { + await generateStandaloneEnum(name, schema, packageName, packageDir, headerComment); + } else if (schema.type === "object" && schema.properties) { + await generateStandaloneRecord(name, schema, packageName, packageDir, headerComment); + } else { + console.warn(`[codegen] Cannot generate standalone type for ${name}: type=${schema.type}`); + } + } + // Generating records may have discovered more $ref targets β€” loop again + } +} + +async function generateStandaloneEnum( + name: string, + schema: JSONSchema7, + packageName: string, + packageDir: string, + headerComment: string +): Promise { + const values = schema.enum as string[]; + const lines: string[] = []; + lines.push(COPYRIGHT); + lines.push(""); + lines.push(AUTO_GENERATED_HEADER); + lines.push(headerComment); + lines.push(""); + lines.push(`package ${packageName};`); + lines.push(""); + lines.push(`import javax.annotation.processing.Generated;`); + lines.push(""); + if (schema.description) { + lines.push(`/**`); + lines.push(` * ${schema.description}`); + lines.push(` *`); + lines.push(` * @since 1.0.0`); + lines.push(` */`); + } + lines.push(GENERATED_ANNOTATION); + lines.push(`public enum ${name} {`); + for (let i = 0; i < values.length; i++) { + const v = values[i]; + const comma = i < values.length - 1 ? "," : ";"; + lines.push(` /** The {@code ${v}} variant. */`); + lines.push(` ${toEnumConstant(v)}("${v}")${comma}`); + } + lines.push(""); + lines.push(` private final String value;`); + lines.push(` ${name}(String value) { this.value = value; }`); + lines.push(` @com.fasterxml.jackson.annotation.JsonValue`); + lines.push(` public String getValue() { return value; }`); + lines.push(` @com.fasterxml.jackson.annotation.JsonCreator`); + lines.push(` public static ${name} fromValue(String value) {`); + lines.push(` for (${name} v : values()) {`); + lines.push(` if (v.value.equals(value)) return v;`); + lines.push(` }`); + lines.push(` throw new IllegalArgumentException("Unknown ${name} value: " + value);`); + lines.push(` }`); + lines.push(`}`); + lines.push(""); + + await writeGeneratedFile(`${packageDir}/${name}.java`, lines.join("\n")); +} + +async function generateStandaloneRecord( + name: string, + schema: JSONSchema7, + packageName: string, + packageDir: string, + headerComment: string +): Promise { + const nestedTypes = new Map(); + const { code, imports } = generateRpcClass(name, schema, nestedTypes, packageName); + + const lines: string[] = []; + lines.push(COPYRIGHT); + lines.push(""); + lines.push(AUTO_GENERATED_HEADER); + lines.push(headerComment); + lines.push(""); + lines.push(`package ${packageName};`); + lines.push(""); + + const allImports = new Set([ + "com.fasterxml.jackson.annotation.JsonIgnoreProperties", + "com.fasterxml.jackson.annotation.JsonProperty", + "com.fasterxml.jackson.annotation.JsonInclude", + "javax.annotation.processing.Generated", + ...imports, + ]); + const sortedImports = [...allImports].sort(); + for (const imp of sortedImports) { + lines.push(`import ${imp};`); + } + lines.push(""); + + if (schema.description) { + lines.push(`/**`); + lines.push(` * ${schema.description}`); + lines.push(` *`); + lines.push(` * @since 1.0.0`); + lines.push(` */`); + } + lines.push(GENERATED_ANNOTATION); + lines.push(code); + lines.push(""); + + await writeGeneratedFile(`${packageDir}/${name}.java`, lines.join("\n")); +} + // ── RPC types codegen ───────────────────────────────────────────────────────── interface RpcMethod { @@ -685,8 +920,26 @@ async function generateRpcTypes(schemaPath: string): Promise { server?: Record; session?: Record; clientSession?: Record; + definitions?: Record; }; + // Set module-level definitions for $ref resolution + currentDefinitions = (schema.definitions ?? {}) as Record; + pendingStandaloneTypes.clear(); + crossSchemaDefinitions.clear(); + + // Load cross-schema definitions (session-events) so that cross-schema $ref values + // like "session-events.schema.json#/definitions/Foo" can be resolved. + try { + const sessionEventsSchemaPath = await getSessionEventsSchemaPath(); + const sessionEventsContent = await fs.readFile(sessionEventsSchemaPath, "utf-8"); + const sessionEventsSchema = JSON.parse(sessionEventsContent) as JSONSchema7; + crossSchemaDefinitions.set("session-events.schema.json", + (sessionEventsSchema.definitions ?? {}) as Record); + } catch (e) { + console.warn(`[codegen] Could not load session-events schema for cross-ref resolution: ${e}`); + } + const packageName = "com.github.copilot.sdk.generated.rpc"; const packageDir = `src/generated/java/com/github/copilot/sdk/generated/rpc`; @@ -704,26 +957,33 @@ async function generateRpcTypes(schemaPath: string): Promise { for (const [, method] of methods) { const className = rpcMethodToClassName(method.rpcMethod); - // Generate params class - if (method.params && typeof method.params === "object" && (method.params as JSONSchema7).properties) { + // Generate params class β€” resolve $ref if params is a reference + let paramsSchema = method.params as JSONSchema7 | null; + if (paramsSchema?.$ref) paramsSchema = resolveRef(paramsSchema) as JSONSchema7; + if (paramsSchema && typeof paramsSchema === "object" && paramsSchema.properties) { const paramsClassName = `${className}Params`; if (!generatedClasses.has(paramsClassName)) { generatedClasses.set(paramsClassName, true); - allFiles.push(await generateRpcDataClass(paramsClassName, method.params as JSONSchema7, packageName, packageDir, method.rpcMethod, "params")); + allFiles.push(await generateRpcDataClass(paramsClassName, paramsSchema, packageName, packageDir, method.rpcMethod, "params")); } } - // Generate result class - if (method.result && typeof method.result === "object" && (method.result as JSONSchema7).properties) { + // Generate result class β€” resolve $ref if result is a reference + let resultSchema = method.result as JSONSchema7 | null; + if (resultSchema?.$ref) resultSchema = resolveRef(resultSchema) as JSONSchema7; + if (resultSchema && typeof resultSchema === "object" && resultSchema.properties) { const resultClassName = `${className}Result`; if (!generatedClasses.has(resultClassName)) { generatedClasses.set(resultClassName, true); - allFiles.push(await generateRpcDataClass(resultClassName, method.result as JSONSchema7, packageName, packageDir, method.rpcMethod, "result")); + allFiles.push(await generateRpcDataClass(resultClassName, resultSchema, packageName, packageDir, method.rpcMethod, "result")); } } } } + // Generate standalone types discovered via $ref resolution + await generatePendingStandaloneTypes(packageName, packageDir, GENERATED_FROM_API); + console.log(`βœ… Generated ${allFiles.length} RPC type files`); } @@ -835,11 +1095,13 @@ function apiClassName(prefix: string, path: string[]): string { * If the result schema has no properties we use Void; if no result schema we also use Void. */ function wrapperResultClassName(method: RpcMethodNode): string { + let result = method.result; + if (result?.$ref) result = resolveRef(result) as JSONSchema7; if ( - method.result && - typeof method.result === "object" && - method.result.properties && - Object.keys(method.result.properties).length > 0 + result && + typeof result === "object" && + result.properties && + Object.keys(result.properties).length > 0 ) { return rpcMethodToClassName(method.rpcMethod) + "Result"; } @@ -851,8 +1113,10 @@ function wrapperResultClassName(method: RpcMethodNode): string { * other than sessionId (i.e. there are user-supplied parameters). */ function wrapperParamsClassName(method: RpcMethodNode): string | null { - if (!method.params || typeof method.params !== "object") return null; - const props = method.params.properties ?? {}; + let params = method.params; + if (params?.$ref) params = resolveRef(params) as JSONSchema7; + if (!params || typeof params !== "object") return null; + const props = params.properties ?? {}; const userProps = Object.keys(props).filter((k) => k !== "sessionId"); if (userProps.length === 0) return null; return rpcMethodToClassName(method.rpcMethod) + "Params"; @@ -860,7 +1124,9 @@ function wrapperParamsClassName(method: RpcMethodNode): string | null { /** True if the method's params schema contains a "sessionId" property */ function methodHasSessionId(method: RpcMethodNode): boolean { - return !!method.params?.properties && "sessionId" in method.params.properties; + let params = method.params; + if (params?.$ref) params = resolveRef(params) as JSONSchema7; + return !!params?.properties && "sessionId" in params.properties; } /** @@ -1290,8 +1556,12 @@ async function generateRpcWrappers(schemaPath: string): Promise { server?: Record; session?: Record; clientSession?: Record; + definitions?: Record; }; + // Set module-level definitions for $ref resolution in wrapper helpers + currentDefinitions = (schema.definitions ?? {}) as Record; + const packageName = "com.github.copilot.sdk.generated.rpc"; const packageDir = `src/generated/java/com/github/copilot/sdk/generated/rpc`; diff --git a/scripts/codegen/package-lock.json b/scripts/codegen/package-lock.json index 4a3705f36f..436d4f19a4 100644 --- a/scripts/codegen/package-lock.json +++ b/scripts/codegen/package-lock.json @@ -6,7 +6,7 @@ "": { "name": "copilot-sdk-java-codegen", "dependencies": { - "@github/copilot": "1.0.24", + "@github/copilot": "^1.0.52-1", "json-schema": "^0.4.0", "tsx": "^4.20.6" } @@ -428,26 +428,31 @@ } }, "node_modules/@github/copilot": { - "version": "1.0.24", - "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.24.tgz", - "integrity": "sha512-/nZ2GwhaGq0HeI3W+6LE0JGw25/bipC6tYVa+oQ5tIvAafBazuNt10CXkeaor+u9oBWLZtPbdTyAzE2tjy9NpQ==", + "version": "1.0.52-1", + "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.52-1.tgz", + "integrity": "sha512-oz6m/dOpTU+FaCWXqYZj5JkJmRT+/RYcrmtGal39V+gOxTA2Nc9wIeLH1SMwMoOXC9Q6DN6keiY0wqWcHirPVg==", "license": "SEE LICENSE IN LICENSE.md", + "dependencies": { + "detect-libc": "^2.1.2" + }, "bin": { "copilot": "npm-loader.js" }, "optionalDependencies": { - "@github/copilot-darwin-arm64": "1.0.24", - "@github/copilot-darwin-x64": "1.0.24", - "@github/copilot-linux-arm64": "1.0.24", - "@github/copilot-linux-x64": "1.0.24", - "@github/copilot-win32-arm64": "1.0.24", - "@github/copilot-win32-x64": "1.0.24" + "@github/copilot-darwin-arm64": "1.0.52-1", + "@github/copilot-darwin-x64": "1.0.52-1", + "@github/copilot-linux-arm64": "1.0.52-1", + "@github/copilot-linux-x64": "1.0.52-1", + "@github/copilot-linuxmusl-arm64": "1.0.52-1", + "@github/copilot-linuxmusl-x64": "1.0.52-1", + "@github/copilot-win32-arm64": "1.0.52-1", + "@github/copilot-win32-x64": "1.0.52-1" } }, "node_modules/@github/copilot-darwin-arm64": { - "version": "1.0.24", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.24.tgz", - "integrity": "sha512-lejn6KV+09rZEICX3nRx9a58DQFQ2kK3NJ3EICfVLngUCWIUmwn1BLezjeTQc9YNasHltA1hulvfsWqX+VjlMw==", + "version": "1.0.52-1", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.52-1.tgz", + "integrity": "sha512-DWXtC/yItZVtkSQhPyRMEkFwa2mcY2rg2cu/uwJ15L9ReiYvlKYEZQDe1TMqkT+U6+k9KjA2L2HQfXVm14/vTw==", "cpu": [ "arm64" ], @@ -461,9 +466,9 @@ } }, "node_modules/@github/copilot-darwin-x64": { - "version": "1.0.24", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.24.tgz", - "integrity": "sha512-r2F3keTvr4Bunz3V+waRAvsHgqsVQGyIZFBebsNPWxBX1eh3IXgtBqxCR7vXTFyZonQ8VaiJH3YYEfAhyKsk9g==", + "version": "1.0.52-1", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.52-1.tgz", + "integrity": "sha512-NFTJkzzlTALMfbj9CDJ7N09PRPTVFq1+71hk+zoNx1uT/pi954liV6tKSaNAihPIXTMQKfJXGwEdjtvACpc8Vg==", "cpu": [ "x64" ], @@ -477,9 +482,9 @@ } }, "node_modules/@github/copilot-linux-arm64": { - "version": "1.0.24", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.24.tgz", - "integrity": "sha512-B3oANXKKKLhnKYozXa/W+DxfCQAHJCs0QKR5rBwNrwJbf656twNgALSxWTSJk+1rEP6MrHCswUAcwjwZL7Q+FQ==", + "version": "1.0.52-1", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.52-1.tgz", + "integrity": "sha512-CZE29v+RPJClHgVE1rU+RpRWSG8lm48koRZ0taKVopqLRD6NWKjBOwFKYJojk08H8/K+BWr/paM5+R8hEZHxZw==", "cpu": [ "arm64" ], @@ -493,9 +498,9 @@ } }, "node_modules/@github/copilot-linux-x64": { - "version": "1.0.24", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.24.tgz", - "integrity": "sha512-NGTldizY54B+4Sfhu/GWoEQNMwqqUNgMwbSgBshFv+Hqy1EwuvNWKVov1Y0Vzhp4qAHc6ZxBk/OPIW8Ato9FUg==", + "version": "1.0.52-1", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.52-1.tgz", + "integrity": "sha512-tJhLQV70TJLq3hPXg7P6pHPfE4vaT2nENIXZsHu6fBkOcsSAxX1APSv6Bkyfsiod8EfFHkcG2+n7VXiVg8WqFw==", "cpu": [ "x64" ], @@ -508,10 +513,42 @@ "copilot-linux-x64": "copilot" } }, + "node_modules/@github/copilot-linuxmusl-arm64": { + "version": "1.0.52-1", + "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-arm64/-/copilot-linuxmusl-arm64-1.0.52-1.tgz", + "integrity": "sha512-u24wHsUumldUEPWX/5z5IEuJvixiQEYF82N04P1g65dvOknq+89dpj+GND4Rh3Vr5u13drgj5AJqkJbWB8N+EQ==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "linux" + ], + "bin": { + "copilot-linuxmusl-arm64": "copilot" + } + }, + "node_modules/@github/copilot-linuxmusl-x64": { + "version": "1.0.52-1", + "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-x64/-/copilot-linuxmusl-x64-1.0.52-1.tgz", + "integrity": "sha512-wM22FxcHL8NlnesKKQPPvtk4ojqefN7irU5tQcX+IunpD1izVQl7AOXhZyHoQ21zQnN0De8EapxOUc+WnvlxpA==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "linux" + ], + "bin": { + "copilot-linuxmusl-x64": "copilot" + } + }, "node_modules/@github/copilot-win32-arm64": { - "version": "1.0.24", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.24.tgz", - "integrity": "sha512-/pd/kgef7/HIIg1SQq4q8fext39pDSC44jHB10KkhfgG1WaDFhQbc/aSSMQfxeldkRbQh6VANp8WtGQdwtMCBA==", + "version": "1.0.52-1", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.52-1.tgz", + "integrity": "sha512-ecvfl9N7DPSwpiT2ZNUSXR1ZrSKwpkByOU6VcNphh4RptPZ0iNfyRNLhFCwSfFz+FvB6z2LZi+F7jSzQ3SaT3w==", "cpu": [ "arm64" ], @@ -525,9 +562,9 @@ } }, "node_modules/@github/copilot-win32-x64": { - "version": "1.0.24", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.24.tgz", - "integrity": "sha512-RDvOiSvyEJwELqErwANJTrdRuMIHkwPE4QK7Le7WsmaSKxiuS4H1Pa8Yxnd2FWrMsCHEbase23GJlymbnGYLXQ==", + "version": "1.0.52-1", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.52-1.tgz", + "integrity": "sha512-a9Ct7krktP+/pfPdh/K57deYzzmL13e5Tb1pf5E152u4o/5xKzfgroNFUOzotFfFhs1jFhdzKCm3WHNLIvVEHA==", "cpu": [ "x64" ], @@ -540,6 +577,15 @@ "copilot-win32-x64": "copilot.exe" } }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, "node_modules/esbuild": { "version": "0.27.7", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz", diff --git a/scripts/codegen/package.json b/scripts/codegen/package.json index 38dd5fc1f3..672b42d654 100644 --- a/scripts/codegen/package.json +++ b/scripts/codegen/package.json @@ -7,7 +7,7 @@ "generate:java": "tsx java.ts" }, "dependencies": { - "@github/copilot": "1.0.24", + "@github/copilot": "^1.0.52-1", "json-schema": "^0.4.0", "tsx": "^4.20.6" } diff --git a/src/generated/java/com/github/copilot/sdk/generated/AbortEvent.java b/src/generated/java/com/github/copilot/sdk/generated/AbortEvent.java index d236f04f0b..297f23f722 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/AbortEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/AbortEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code abort} session event. + * Session event "abort". Turn abort information including the reason for termination * * @since 1.0.0 */ @@ -35,8 +35,8 @@ public final class AbortEvent extends SessionEvent { @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) public record AbortEventData( - /** Reason the current turn was aborted (e.g., "user initiated") */ - @JsonProperty("reason") String reason + /** Finite reason code describing why the current turn was aborted */ + @JsonProperty("reason") AbortReason reason ) { } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/AbortReason.java b/src/generated/java/com/github/copilot/sdk/generated/AbortReason.java new file mode 100644 index 0000000000..2bb93b8865 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/AbortReason.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * Finite reason code describing why the current turn was aborted + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum AbortReason { + /** The {@code user_initiated} variant. */ + USER_INITIATED("user_initiated"), + /** The {@code remote_command} variant. */ + REMOTE_COMMAND("remote_command"), + /** The {@code user_abort} variant. */ + USER_ABORT("user_abort"); + + private final String value; + AbortReason(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static AbortReason fromValue(String value) { + for (AbortReason v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown AbortReason value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantIntentEvent.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantIntentEvent.java index a1c22edfb1..332daeb179 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/AssistantIntentEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantIntentEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code assistant.intent} session event. + * Session event "assistant.intent". Agent intent description for current activity or plan * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageDeltaEvent.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageDeltaEvent.java index 128608a1e1..ff84f757d5 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageDeltaEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageDeltaEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code assistant.message_delta} session event. + * Session event "assistant.message_delta". Streaming assistant message delta for incremental response updates * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageEvent.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageEvent.java index 78ccbf42f4..ab58b24e5d 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageEvent.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * The {@code assistant.message} session event. + * Session event "assistant.message". Assistant response containing text content, optional tool requests, and interaction metadata * * @since 1.0.0 */ @@ -38,10 +38,12 @@ public final class AssistantMessageEvent extends SessionEvent { public record AssistantMessageEventData( /** Unique identifier for this assistant message */ @JsonProperty("messageId") String messageId, + /** Model that produced this assistant message, if known */ + @JsonProperty("model") String model, /** The assistant's text response content */ @JsonProperty("content") String content, /** Tool invocations requested by the assistant in this message */ - @JsonProperty("toolRequests") List toolRequests, + @JsonProperty("toolRequests") List toolRequests, /** Opaque/encrypted extended thinking data from Anthropic models. Session-bound and stripped on resume. */ @JsonProperty("reasoningOpaque") String reasoningOpaque, /** Readable reasoning text from the model's extended thinking */ @@ -51,54 +53,19 @@ public record AssistantMessageEventData( /** Generation phase for phased-output models (e.g., thinking vs. response phases) */ @JsonProperty("phase") String phase, /** Actual output token count from the API response (completion_tokens), used for accurate token accounting */ - @JsonProperty("outputTokens") Double outputTokens, + @JsonProperty("outputTokens") Long outputTokens, /** CAPI interaction ID for correlating this message with upstream telemetry */ @JsonProperty("interactionId") String interactionId, /** GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs */ @JsonProperty("requestId") String requestId, + /** Raw Anthropic content array with advisor blocks (server_tool_use, advisor_tool_result) for verbatim round-tripping */ + @JsonProperty("anthropicAdvisorBlocks") List anthropicAdvisorBlocks, + /** Anthropic advisor model ID used for this response, for timeline display on replay */ + @JsonProperty("anthropicAdvisorModel") String anthropicAdvisorModel, + /** Identifier for the agent loop turn that produced this message, matching the corresponding assistant.turn_start event */ + @JsonProperty("turnId") String turnId, /** Tool call ID of the parent tool invocation when this event originates from a sub-agent */ @JsonProperty("parentToolCallId") String parentToolCallId ) { - - /** A tool invocation request from the assistant */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record AssistantMessageEventDataToolRequestsItem( - /** Unique identifier for this tool call */ - @JsonProperty("toolCallId") String toolCallId, - /** Name of the tool being invoked */ - @JsonProperty("name") String name, - /** Arguments to pass to the tool, format depends on the tool */ - @JsonProperty("arguments") Object arguments, - /** Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent. */ - @JsonProperty("type") AssistantMessageEventDataToolRequestsItemType type, - /** Human-readable display title for the tool */ - @JsonProperty("toolTitle") String toolTitle, - /** Name of the MCP server hosting this tool, when the tool is an MCP tool */ - @JsonProperty("mcpServerName") String mcpServerName, - /** Resolved intention summary describing what this specific call does */ - @JsonProperty("intentionSummary") String intentionSummary - ) { - - /** Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent. */ - public enum AssistantMessageEventDataToolRequestsItemType { - /** The {@code function} variant. */ - FUNCTION("function"), - /** The {@code custom} variant. */ - CUSTOM("custom"); - - private final String value; - AssistantMessageEventDataToolRequestsItemType(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static AssistantMessageEventDataToolRequestsItemType fromValue(String value) { - for (AssistantMessageEventDataToolRequestsItemType v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown AssistantMessageEventDataToolRequestsItemType value: " + value); - } - } - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageStartEvent.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageStartEvent.java new file mode 100644 index 0000000000..8a83da9439 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageStartEvent.java @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Session event "assistant.message_start". Streaming assistant message start metadata + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class AssistantMessageStartEvent extends SessionEvent { + + @Override + public String getType() { return "assistant.message_start"; } + + @JsonProperty("data") + private AssistantMessageStartEventData data; + + public AssistantMessageStartEventData getData() { return data; } + public void setData(AssistantMessageStartEventData data) { this.data = data; } + + /** Data payload for {@link AssistantMessageStartEvent}. */ + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record AssistantMessageStartEventData( + /** Message ID this start event belongs to, matching subsequent deltas and assistant.message */ + @JsonProperty("messageId") String messageId, + /** Generation phase this message belongs to for phased-output models */ + @JsonProperty("phase") String phase + ) { + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageToolRequest.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageToolRequest.java new file mode 100644 index 0000000000..e185a01fa8 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageToolRequest.java @@ -0,0 +1,41 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * A tool invocation request from the assistant + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record AssistantMessageToolRequest( + /** Unique identifier for this tool call */ + @JsonProperty("toolCallId") String toolCallId, + /** Name of the tool being invoked */ + @JsonProperty("name") String name, + /** Arguments to pass to the tool, format depends on the tool */ + @JsonProperty("arguments") Object arguments, + /** Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent. */ + @JsonProperty("type") AssistantMessageToolRequestType type, + /** Human-readable display title for the tool */ + @JsonProperty("toolTitle") String toolTitle, + /** Name of the MCP server hosting this tool, when the tool is an MCP tool */ + @JsonProperty("mcpServerName") String mcpServerName, + /** Original tool name on the MCP server, when the tool is an MCP tool */ + @JsonProperty("mcpToolName") String mcpToolName, + /** Resolved intention summary describing what this specific call does */ + @JsonProperty("intentionSummary") String intentionSummary +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageToolRequestType.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageToolRequestType.java new file mode 100644 index 0000000000..024b845d62 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageToolRequestType.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum AssistantMessageToolRequestType { + /** The {@code function} variant. */ + FUNCTION("function"), + /** The {@code custom} variant. */ + CUSTOM("custom"); + + private final String value; + AssistantMessageToolRequestType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static AssistantMessageToolRequestType fromValue(String value) { + for (AssistantMessageToolRequestType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown AssistantMessageToolRequestType value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantReasoningDeltaEvent.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantReasoningDeltaEvent.java index 7c11ad59e7..5c7a6f94b9 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/AssistantReasoningDeltaEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantReasoningDeltaEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code assistant.reasoning_delta} session event. + * Session event "assistant.reasoning_delta". Streaming reasoning delta for incremental extended thinking updates * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantReasoningEvent.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantReasoningEvent.java index 292b191b14..58a7e665d4 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/AssistantReasoningEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantReasoningEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code assistant.reasoning} session event. + * Session event "assistant.reasoning". Assistant reasoning content for timeline display with complete thinking text * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantStreamingDeltaEvent.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantStreamingDeltaEvent.java index 71ec8f4884..31acae7c65 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/AssistantStreamingDeltaEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantStreamingDeltaEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code assistant.streaming_delta} session event. + * Session event "assistant.streaming_delta". Streaming response progress with cumulative byte count * * @since 1.0.0 */ @@ -36,7 +36,7 @@ public final class AssistantStreamingDeltaEvent extends SessionEvent { @JsonInclude(JsonInclude.Include.NON_NULL) public record AssistantStreamingDeltaEventData( /** Cumulative total bytes received from the streaming response so far */ - @JsonProperty("totalResponseSizeBytes") Double totalResponseSizeBytes + @JsonProperty("totalResponseSizeBytes") Long totalResponseSizeBytes ) { } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantTurnEndEvent.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantTurnEndEvent.java index a8e0b16525..e349711dc8 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/AssistantTurnEndEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantTurnEndEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code assistant.turn_end} session event. + * Session event "assistant.turn_end". Turn completion metadata including the turn identifier * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantTurnStartEvent.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantTurnStartEvent.java index 921623801d..245803774e 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/AssistantTurnStartEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantTurnStartEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code assistant.turn_start} session event. + * Session event "assistant.turn_start". Turn initialization metadata including identifier and interaction tracking * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java new file mode 100644 index 0000000000..e69e4ef868 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * API endpoint used for this model call, matching CAPI supported_endpoints vocabulary + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum AssistantUsageApiEndpoint { + /** The {@code /chat/completions} variant. */ + CHAT_COMPLETIONS("/chat/completions"), + /** The {@code /v1/messages} variant. */ + V1_MESSAGES("/v1/messages"), + /** The {@code /responses} variant. */ + RESPONSES("/responses"), + /** The {@code ws:/responses} variant. */ + WS_RESPONSES("ws:/responses"); + + private final String value; + AssistantUsageApiEndpoint(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static AssistantUsageApiEndpoint fromValue(String value) { + for (AssistantUsageApiEndpoint v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown AssistantUsageApiEndpoint value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageCopilotUsage.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageCopilotUsage.java new file mode 100644 index 0000000000..ee3e9f9cfb --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageCopilotUsage.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Per-request cost and usage data from the CAPI copilot_usage response field + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record AssistantUsageCopilotUsage( + /** Itemized token usage breakdown */ + @JsonProperty("tokenDetails") List tokenDetails, + /** Total cost in nano-AI units for this request */ + @JsonProperty("totalNanoAiu") Double totalNanoAiu +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageCopilotUsageTokenDetail.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageCopilotUsageTokenDetail.java new file mode 100644 index 0000000000..bea7cf162b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageCopilotUsageTokenDetail.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Token usage detail for a single billing category + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record AssistantUsageCopilotUsageTokenDetail( + /** Number of tokens in this billing batch */ + @JsonProperty("batchSize") Long batchSize, + /** Cost per batch of tokens */ + @JsonProperty("costPerBatch") Long costPerBatch, + /** Total token count for this entry */ + @JsonProperty("tokenCount") Long tokenCount, + /** Token category (e.g., "input", "output") */ + @JsonProperty("tokenType") String tokenType +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageEvent.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageEvent.java index 65f47bfadf..7d06ae9a0c 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageEvent.java @@ -10,13 +10,11 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import java.time.OffsetDateTime; -import java.util.List; import java.util.Map; import javax.annotation.processing.Generated; /** - * The {@code assistant.usage} session event. + * Session event "assistant.usage". LLM API call usage metrics including tokens, costs, quotas, and billing information * * @since 1.0.0 */ @@ -41,21 +39,21 @@ public record AssistantUsageEventData( /** Model identifier used for this API call */ @JsonProperty("model") String model, /** Number of input tokens consumed */ - @JsonProperty("inputTokens") Double inputTokens, + @JsonProperty("inputTokens") Long inputTokens, /** Number of output tokens produced */ - @JsonProperty("outputTokens") Double outputTokens, + @JsonProperty("outputTokens") Long outputTokens, /** Number of tokens read from prompt cache */ - @JsonProperty("cacheReadTokens") Double cacheReadTokens, + @JsonProperty("cacheReadTokens") Long cacheReadTokens, /** Number of tokens written to prompt cache */ - @JsonProperty("cacheWriteTokens") Double cacheWriteTokens, + @JsonProperty("cacheWriteTokens") Long cacheWriteTokens, /** Number of output tokens used for reasoning (e.g., chain-of-thought) */ - @JsonProperty("reasoningTokens") Double reasoningTokens, + @JsonProperty("reasoningTokens") Long reasoningTokens, /** Model multiplier cost for billing purposes */ @JsonProperty("cost") Double cost, /** Duration of the API call in milliseconds */ - @JsonProperty("duration") Double duration, + @JsonProperty("duration") Long duration, /** Time to first token in milliseconds. Only available for streaming requests */ - @JsonProperty("ttftMs") Double ttftMs, + @JsonProperty("timeToFirstTokenMs") Long timeToFirstTokenMs, /** Average inter-token latency in milliseconds. Only available for streaming requests */ @JsonProperty("interTokenLatencyMs") Double interTokenLatencyMs, /** What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls */ @@ -64,62 +62,16 @@ public record AssistantUsageEventData( @JsonProperty("apiCallId") String apiCallId, /** GitHub request tracing ID (x-github-request-id header) for server-side log correlation */ @JsonProperty("providerCallId") String providerCallId, + /** API endpoint used for this model call, matching CAPI supported_endpoints vocabulary */ + @JsonProperty("apiEndpoint") AssistantUsageApiEndpoint apiEndpoint, /** Parent tool call ID when this usage originates from a sub-agent */ @JsonProperty("parentToolCallId") String parentToolCallId, /** Per-quota resource usage snapshots, keyed by quota identifier */ - @JsonProperty("quotaSnapshots") Map quotaSnapshots, + @JsonProperty("quotaSnapshots") Map quotaSnapshots, /** Per-request cost and usage data from the CAPI copilot_usage response field */ - @JsonProperty("copilotUsage") AssistantUsageEventDataCopilotUsage copilotUsage, - /** Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh") */ + @JsonProperty("copilotUsage") AssistantUsageCopilotUsage copilotUsage, + /** Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max") */ @JsonProperty("reasoningEffort") String reasoningEffort ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record AssistantUsageEventDataQuotaSnapshotsValue( - /** Whether the user has an unlimited usage entitlement */ - @JsonProperty("isUnlimitedEntitlement") Boolean isUnlimitedEntitlement, - /** Total requests allowed by the entitlement */ - @JsonProperty("entitlementRequests") Double entitlementRequests, - /** Number of requests already consumed */ - @JsonProperty("usedRequests") Double usedRequests, - /** Whether usage is still permitted after quota exhaustion */ - @JsonProperty("usageAllowedWithExhaustedQuota") Boolean usageAllowedWithExhaustedQuota, - /** Number of requests over the entitlement limit */ - @JsonProperty("overage") Double overage, - /** Whether overage is allowed when quota is exhausted */ - @JsonProperty("overageAllowedWithExhaustedQuota") Boolean overageAllowedWithExhaustedQuota, - /** Percentage of quota remaining (0.0 to 1.0) */ - @JsonProperty("remainingPercentage") Double remainingPercentage, - /** Date when the quota resets */ - @JsonProperty("resetDate") OffsetDateTime resetDate - ) { - } - - /** Per-request cost and usage data from the CAPI copilot_usage response field */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record AssistantUsageEventDataCopilotUsage( - /** Itemized token usage breakdown */ - @JsonProperty("tokenDetails") List tokenDetails, - /** Total cost in nano-AIU (AI Units) for this request */ - @JsonProperty("totalNanoAiu") Double totalNanoAiu - ) { - - /** Token usage detail for a single billing category */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record AssistantUsageEventDataCopilotUsageTokenDetailsItem( - /** Number of tokens in this billing batch */ - @JsonProperty("batchSize") Double batchSize, - /** Cost per batch of tokens */ - @JsonProperty("costPerBatch") Double costPerBatch, - /** Total token count for this entry */ - @JsonProperty("tokenCount") Double tokenCount, - /** Token category (e.g., "input", "output") */ - @JsonProperty("tokenType") String tokenType - ) { - } - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageQuotaSnapshot.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageQuotaSnapshot.java new file mode 100644 index 0000000000..1bfa2c0886 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageQuotaSnapshot.java @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import javax.annotation.processing.Generated; + +/** + * Schema for the `AssistantUsageQuotaSnapshot` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record AssistantUsageQuotaSnapshot( + /** Whether the user has an unlimited usage entitlement */ + @JsonProperty("isUnlimitedEntitlement") Boolean isUnlimitedEntitlement, + /** Total requests allowed by the entitlement */ + @JsonProperty("entitlementRequests") Long entitlementRequests, + /** Number of requests already consumed */ + @JsonProperty("usedRequests") Long usedRequests, + /** Whether usage is still permitted after quota exhaustion */ + @JsonProperty("usageAllowedWithExhaustedQuota") Boolean usageAllowedWithExhaustedQuota, + /** Number of additional usage requests made this period */ + @JsonProperty("overage") Double overage, + /** Whether additional usage is allowed when quota is exhausted */ + @JsonProperty("overageAllowedWithExhaustedQuota") Boolean overageAllowedWithExhaustedQuota, + /** Percentage of quota remaining (0 to 100) */ + @JsonProperty("remainingPercentage") Double remainingPercentage, + /** Date when the quota resets */ + @JsonProperty("resetDate") OffsetDateTime resetDate +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/AutoModeSwitchCompletedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/AutoModeSwitchCompletedEvent.java new file mode 100644 index 0000000000..09c15cc1a8 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/AutoModeSwitchCompletedEvent.java @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Session event "auto_mode_switch.completed". Auto mode switch completion notification + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class AutoModeSwitchCompletedEvent extends SessionEvent { + + @Override + public String getType() { return "auto_mode_switch.completed"; } + + @JsonProperty("data") + private AutoModeSwitchCompletedEventData data; + + public AutoModeSwitchCompletedEventData getData() { return data; } + public void setData(AutoModeSwitchCompletedEventData data) { this.data = data; } + + /** Data payload for {@link AutoModeSwitchCompletedEvent}. */ + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record AutoModeSwitchCompletedEventData( + /** Request ID of the resolved request; clients should dismiss any UI for this request */ + @JsonProperty("requestId") String requestId, + /** The user's auto-mode-switch choice */ + @JsonProperty("response") AutoModeSwitchResponse response + ) { + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/AutoModeSwitchRequestedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/AutoModeSwitchRequestedEvent.java new file mode 100644 index 0000000000..4c68eb746a --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/AutoModeSwitchRequestedEvent.java @@ -0,0 +1,46 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Session event "auto_mode_switch.requested". Auto mode switch request notification requiring user approval + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class AutoModeSwitchRequestedEvent extends SessionEvent { + + @Override + public String getType() { return "auto_mode_switch.requested"; } + + @JsonProperty("data") + private AutoModeSwitchRequestedEventData data; + + public AutoModeSwitchRequestedEventData getData() { return data; } + public void setData(AutoModeSwitchRequestedEventData data) { this.data = data; } + + /** Data payload for {@link AutoModeSwitchRequestedEvent}. */ + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record AutoModeSwitchRequestedEventData( + /** Unique identifier for this request; used to respond via session.respondToAutoModeSwitch() */ + @JsonProperty("requestId") String requestId, + /** The rate limit error code that triggered this request */ + @JsonProperty("errorCode") String errorCode, + /** Seconds until the rate limit resets, when known. Lets clients render a humanized reset time alongside the prompt. */ + @JsonProperty("retryAfterSeconds") Long retryAfterSeconds + ) { + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/AutoModeSwitchResponse.java b/src/generated/java/com/github/copilot/sdk/generated/AutoModeSwitchResponse.java new file mode 100644 index 0000000000..3f677ca202 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/AutoModeSwitchResponse.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * The user's auto-mode-switch choice + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum AutoModeSwitchResponse { + /** The {@code yes} variant. */ + YES("yes"), + /** The {@code yes_always} variant. */ + YES_ALWAYS("yes_always"), + /** The {@code no} variant. */ + NO("no"); + + private final String value; + AutoModeSwitchResponse(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static AutoModeSwitchResponse fromValue(String value) { + for (AutoModeSwitchResponse v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown AutoModeSwitchResponse value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/CapabilitiesChangedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/CapabilitiesChangedEvent.java index fbf14f8ec1..ff359b04a0 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/CapabilitiesChangedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/CapabilitiesChangedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code capabilities.changed} session event. + * Session event "capabilities.changed". Session capability change notification * * @since 1.0.0 */ @@ -36,16 +36,7 @@ public final class CapabilitiesChangedEvent extends SessionEvent { @JsonInclude(JsonInclude.Include.NON_NULL) public record CapabilitiesChangedEventData( /** UI capability changes */ - @JsonProperty("ui") CapabilitiesChangedEventDataUi ui + @JsonProperty("ui") CapabilitiesChangedUI ui ) { - - /** UI capability changes */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record CapabilitiesChangedEventDataUi( - /** Whether elicitation is now supported */ - @JsonProperty("elicitation") Boolean elicitation - ) { - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/CapabilitiesChangedUI.java b/src/generated/java/com/github/copilot/sdk/generated/CapabilitiesChangedUI.java new file mode 100644 index 0000000000..828733b046 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/CapabilitiesChangedUI.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * UI capability changes + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CapabilitiesChangedUI( + /** Whether elicitation is now supported */ + @JsonProperty("elicitation") Boolean elicitation +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/CommandCompletedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/CommandCompletedEvent.java index d2075f09d3..584cde38b3 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/CommandCompletedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/CommandCompletedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code command.completed} session event. + * Session event "command.completed". Queued command completion notification signaling UI dismissal * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/CommandExecuteEvent.java b/src/generated/java/com/github/copilot/sdk/generated/CommandExecuteEvent.java index a9b0608dba..5d07300e8b 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/CommandExecuteEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/CommandExecuteEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code command.execute} session event. + * Session event "command.execute". Registered command dispatch request routed to the owning client * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/CommandQueuedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/CommandQueuedEvent.java index 6599f4da64..f724f52993 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/CommandQueuedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/CommandQueuedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code command.queued} session event. + * Session event "command.queued". Queued slash command dispatch request for client execution * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/CommandsChangedCommand.java b/src/generated/java/com/github/copilot/sdk/generated/CommandsChangedCommand.java new file mode 100644 index 0000000000..cb446ee24c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/CommandsChangedCommand.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `CommandsChangedCommand` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CommandsChangedCommand( + /** Slash command name without the leading slash. */ + @JsonProperty("name") String name, + /** Optional human-readable command description. */ + @JsonProperty("description") String description +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/CommandsChangedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/CommandsChangedEvent.java index a7704b6c88..7b2d3c2c12 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/CommandsChangedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/CommandsChangedEvent.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * The {@code commands.changed} session event. + * Session event "commands.changed". SDK command registration change notification * * @since 1.0.0 */ @@ -37,15 +37,7 @@ public final class CommandsChangedEvent extends SessionEvent { @JsonInclude(JsonInclude.Include.NON_NULL) public record CommandsChangedEventData( /** Current list of registered SDK commands */ - @JsonProperty("commands") List commands + @JsonProperty("commands") List commands ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record CommandsChangedEventDataCommandsItem( - @JsonProperty("name") String name, - @JsonProperty("description") String description - ) { - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/CompactionCompleteCompactionTokensUsed.java b/src/generated/java/com/github/copilot/sdk/generated/CompactionCompleteCompactionTokensUsed.java new file mode 100644 index 0000000000..c3469eb7b2 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/CompactionCompleteCompactionTokensUsed.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Token usage breakdown for the compaction LLM call (aligned with assistant.usage format) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CompactionCompleteCompactionTokensUsed( + /** Input tokens consumed by the compaction LLM call */ + @JsonProperty("inputTokens") Long inputTokens, + /** Output tokens produced by the compaction LLM call */ + @JsonProperty("outputTokens") Long outputTokens, + /** Cached input tokens reused in the compaction LLM call */ + @JsonProperty("cacheReadTokens") Long cacheReadTokens, + /** Tokens written to prompt cache in the compaction LLM call */ + @JsonProperty("cacheWriteTokens") Long cacheWriteTokens, + /** Per-request cost and usage data from the CAPI copilot_usage response field */ + @JsonProperty("copilotUsage") CompactionCompleteCompactionTokensUsedCopilotUsage copilotUsage, + /** Duration of the compaction LLM call in milliseconds */ + @JsonProperty("duration") Long duration, + /** Model identifier used for the compaction LLM call */ + @JsonProperty("model") String model +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/CompactionCompleteCompactionTokensUsedCopilotUsage.java b/src/generated/java/com/github/copilot/sdk/generated/CompactionCompleteCompactionTokensUsedCopilotUsage.java new file mode 100644 index 0000000000..76e5a0ed8f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/CompactionCompleteCompactionTokensUsedCopilotUsage.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Per-request cost and usage data from the CAPI copilot_usage response field + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CompactionCompleteCompactionTokensUsedCopilotUsage( + /** Itemized token usage breakdown */ + @JsonProperty("tokenDetails") List tokenDetails, + /** Total cost in nano-AI units for this request */ + @JsonProperty("totalNanoAiu") Double totalNanoAiu +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/CompactionCompleteCompactionTokensUsedCopilotUsageTokenDetail.java b/src/generated/java/com/github/copilot/sdk/generated/CompactionCompleteCompactionTokensUsedCopilotUsageTokenDetail.java new file mode 100644 index 0000000000..5c368251f0 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/CompactionCompleteCompactionTokensUsedCopilotUsageTokenDetail.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Token usage detail for a single billing category + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CompactionCompleteCompactionTokensUsedCopilotUsageTokenDetail( + /** Number of tokens in this billing batch */ + @JsonProperty("batchSize") Long batchSize, + /** Cost per batch of tokens */ + @JsonProperty("costPerBatch") Long costPerBatch, + /** Total token count for this entry */ + @JsonProperty("tokenCount") Long tokenCount, + /** Token category (e.g., "input", "output") */ + @JsonProperty("tokenType") String tokenType +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/CustomAgentsUpdatedAgent.java b/src/generated/java/com/github/copilot/sdk/generated/CustomAgentsUpdatedAgent.java new file mode 100644 index 0000000000..154e763778 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/CustomAgentsUpdatedAgent.java @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Schema for the `CustomAgentsUpdatedAgent` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CustomAgentsUpdatedAgent( + /** Unique identifier for the agent */ + @JsonProperty("id") String id, + /** Internal name of the agent */ + @JsonProperty("name") String name, + /** Human-readable display name */ + @JsonProperty("displayName") String displayName, + /** Description of what the agent does */ + @JsonProperty("description") String description, + /** Source location: user, project, inherited, remote, or plugin */ + @JsonProperty("source") String source, + /** List of tool names available to this agent, or null when all tools are available */ + @JsonProperty("tools") List tools, + /** Whether the agent can be selected by the user */ + @JsonProperty("userInvocable") Boolean userInvocable, + /** Model override for this agent, if set */ + @JsonProperty("model") String model +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ElicitationCompletedAction.java b/src/generated/java/com/github/copilot/sdk/generated/ElicitationCompletedAction.java new file mode 100644 index 0000000000..32e4723e58 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ElicitationCompletedAction.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * The user action: "accept" (submitted form), "decline" (explicitly refused), or "cancel" (dismissed) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ElicitationCompletedAction { + /** The {@code accept} variant. */ + ACCEPT("accept"), + /** The {@code decline} variant. */ + DECLINE("decline"), + /** The {@code cancel} variant. */ + CANCEL("cancel"); + + private final String value; + ElicitationCompletedAction(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ElicitationCompletedAction fromValue(String value) { + for (ElicitationCompletedAction v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ElicitationCompletedAction value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ElicitationCompletedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/ElicitationCompletedEvent.java index 45cbf54c77..ee713a1002 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/ElicitationCompletedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/ElicitationCompletedEvent.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * The {@code elicitation.completed} session event. + * Session event "elicitation.completed". Elicitation request completion with the user's response * * @since 1.0.0 */ @@ -39,31 +39,9 @@ public record ElicitationCompletedEventData( /** Request ID of the resolved elicitation request; clients should dismiss any UI for this request */ @JsonProperty("requestId") String requestId, /** The user action: "accept" (submitted form), "decline" (explicitly refused), or "cancel" (dismissed) */ - @JsonProperty("action") ElicitationCompletedEventDataAction action, + @JsonProperty("action") ElicitationCompletedAction action, /** The submitted form data when action is 'accept'; keys match the requested schema fields */ @JsonProperty("content") Map content ) { - - /** The user action: "accept" (submitted form), "decline" (explicitly refused), or "cancel" (dismissed) */ - public enum ElicitationCompletedEventDataAction { - /** The {@code accept} variant. */ - ACCEPT("accept"), - /** The {@code decline} variant. */ - DECLINE("decline"), - /** The {@code cancel} variant. */ - CANCEL("cancel"); - - private final String value; - ElicitationCompletedEventDataAction(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static ElicitationCompletedEventDataAction fromValue(String value) { - for (ElicitationCompletedEventDataAction v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown ElicitationCompletedEventDataAction value: " + value); - } - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/ElicitationRequestedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/ElicitationRequestedEvent.java index 838afbc506..000c242c9a 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/ElicitationRequestedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/ElicitationRequestedEvent.java @@ -10,12 +10,10 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import java.util.Map; import javax.annotation.processing.Generated; /** - * The {@code elicitation.requested} session event. + * Session event "elicitation.requested". Elicitation request; may be form-based (structured input) or URL-based (browser redirect) * * @since 1.0.0 */ @@ -46,44 +44,11 @@ public record ElicitationRequestedEventData( /** Message describing what information is needed from the user */ @JsonProperty("message") String message, /** Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to "form" when absent. */ - @JsonProperty("mode") ElicitationRequestedEventDataMode mode, + @JsonProperty("mode") ElicitationRequestedMode mode, /** JSON Schema describing the form fields to present to the user (form mode only) */ - @JsonProperty("requestedSchema") ElicitationRequestedEventDataRequestedSchema requestedSchema, + @JsonProperty("requestedSchema") ElicitationRequestedSchema requestedSchema, /** URL to open in the user's browser (url mode only) */ @JsonProperty("url") String url ) { - - /** Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to "form" when absent. */ - public enum ElicitationRequestedEventDataMode { - /** The {@code form} variant. */ - FORM("form"), - /** The {@code url} variant. */ - URL("url"); - - private final String value; - ElicitationRequestedEventDataMode(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static ElicitationRequestedEventDataMode fromValue(String value) { - for (ElicitationRequestedEventDataMode v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown ElicitationRequestedEventDataMode value: " + value); - } - } - - /** JSON Schema describing the form fields to present to the user (form mode only) */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record ElicitationRequestedEventDataRequestedSchema( - /** Schema type indicator (always 'object') */ - @JsonProperty("type") String type, - /** Form field definitions, keyed by field name */ - @JsonProperty("properties") Map properties, - /** List of required field names */ - @JsonProperty("required") List required - ) { - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/ElicitationRequestedMode.java b/src/generated/java/com/github/copilot/sdk/generated/ElicitationRequestedMode.java new file mode 100644 index 0000000000..ffe24b56fa --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ElicitationRequestedMode.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to "form" when absent. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ElicitationRequestedMode { + /** The {@code form} variant. */ + FORM("form"), + /** The {@code url} variant. */ + URL("url"); + + private final String value; + ElicitationRequestedMode(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ElicitationRequestedMode fromValue(String value) { + for (ElicitationRequestedMode v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ElicitationRequestedMode value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ElicitationRequestedSchema.java b/src/generated/java/com/github/copilot/sdk/generated/ElicitationRequestedSchema.java new file mode 100644 index 0000000000..4234867adc --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ElicitationRequestedSchema.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; +import javax.annotation.processing.Generated; + +/** + * JSON Schema describing the form fields to present to the user (form mode only) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ElicitationRequestedSchema( + /** Schema type indicator (always 'object') */ + @JsonProperty("type") String type, + /** Form field definitions, keyed by field name */ + @JsonProperty("properties") Map properties, + /** List of required field names */ + @JsonProperty("required") List required +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ExitPlanModeAction.java b/src/generated/java/com/github/copilot/sdk/generated/ExitPlanModeAction.java new file mode 100644 index 0000000000..a8b85ad943 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ExitPlanModeAction.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * Exit plan mode action + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ExitPlanModeAction { + /** The {@code exit_only} variant. */ + EXIT_ONLY("exit_only"), + /** The {@code interactive} variant. */ + INTERACTIVE("interactive"), + /** The {@code autopilot} variant. */ + AUTOPILOT("autopilot"), + /** The {@code autopilot_fleet} variant. */ + AUTOPILOT_FLEET("autopilot_fleet"); + + private final String value; + ExitPlanModeAction(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ExitPlanModeAction fromValue(String value) { + for (ExitPlanModeAction v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ExitPlanModeAction value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ExitPlanModeCompletedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/ExitPlanModeCompletedEvent.java index 56c2c66813..3788532933 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/ExitPlanModeCompletedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/ExitPlanModeCompletedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code exit_plan_mode.completed} session event. + * Session event "exit_plan_mode.completed". Plan mode exit completion with the user's approval decision and optional feedback * * @since 1.0.0 */ @@ -39,8 +39,8 @@ public record ExitPlanModeCompletedEventData( @JsonProperty("requestId") String requestId, /** Whether the plan was approved by the user */ @JsonProperty("approved") Boolean approved, - /** Which action the user selected (e.g. 'autopilot', 'interactive', 'exit_only') */ - @JsonProperty("selectedAction") String selectedAction, + /** Action selected by the user */ + @JsonProperty("selectedAction") ExitPlanModeAction selectedAction, /** Whether edits should be auto-approved without confirmation */ @JsonProperty("autoApproveEdits") Boolean autoApproveEdits, /** Free-form feedback from the user if they requested changes to the plan */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/ExitPlanModeRequestedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/ExitPlanModeRequestedEvent.java index de2bf45a84..e96124bc7e 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/ExitPlanModeRequestedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/ExitPlanModeRequestedEvent.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * The {@code exit_plan_mode.requested} session event. + * Session event "exit_plan_mode.requested". Plan approval request with plan content and available user actions * * @since 1.0.0 */ @@ -42,10 +42,10 @@ public record ExitPlanModeRequestedEventData( @JsonProperty("summary") String summary, /** Full content of the plan file */ @JsonProperty("planContent") String planContent, - /** Available actions the user can take (e.g., approve, edit, reject) */ - @JsonProperty("actions") List actions, - /** The recommended action for the user to take */ - @JsonProperty("recommendedAction") String recommendedAction + /** Available actions the user can take */ + @JsonProperty("actions") List actions, + /** Recommended action to preselect for the user */ + @JsonProperty("recommendedAction") ExitPlanModeAction recommendedAction ) { } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/ExtensionsLoadedExtension.java b/src/generated/java/com/github/copilot/sdk/generated/ExtensionsLoadedExtension.java new file mode 100644 index 0000000000..32e8ae4601 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ExtensionsLoadedExtension.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `ExtensionsLoadedExtension` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ExtensionsLoadedExtension( + /** Source-qualified extension ID (e.g., 'project:my-ext', 'user:auth-helper') */ + @JsonProperty("id") String id, + /** Extension name (directory name) */ + @JsonProperty("name") String name, + /** Discovery source */ + @JsonProperty("source") ExtensionsLoadedExtensionSource source, + /** Current status: running, disabled, failed, or starting */ + @JsonProperty("status") ExtensionsLoadedExtensionStatus status +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ExtensionsLoadedExtensionSource.java b/src/generated/java/com/github/copilot/sdk/generated/ExtensionsLoadedExtensionSource.java new file mode 100644 index 0000000000..d6409caf45 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ExtensionsLoadedExtensionSource.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * Discovery source + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ExtensionsLoadedExtensionSource { + /** The {@code project} variant. */ + PROJECT("project"), + /** The {@code user} variant. */ + USER("user"); + + private final String value; + ExtensionsLoadedExtensionSource(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ExtensionsLoadedExtensionSource fromValue(String value) { + for (ExtensionsLoadedExtensionSource v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ExtensionsLoadedExtensionSource value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ExtensionsLoadedExtensionStatus.java b/src/generated/java/com/github/copilot/sdk/generated/ExtensionsLoadedExtensionStatus.java new file mode 100644 index 0000000000..a4ef8de991 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ExtensionsLoadedExtensionStatus.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * Current status: running, disabled, failed, or starting + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ExtensionsLoadedExtensionStatus { + /** The {@code running} variant. */ + RUNNING("running"), + /** The {@code disabled} variant. */ + DISABLED("disabled"), + /** The {@code failed} variant. */ + FAILED("failed"), + /** The {@code starting} variant. */ + STARTING("starting"); + + private final String value; + ExtensionsLoadedExtensionStatus(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ExtensionsLoadedExtensionStatus fromValue(String value) { + for (ExtensionsLoadedExtensionStatus v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ExtensionsLoadedExtensionStatus value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ExternalToolCompletedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/ExternalToolCompletedEvent.java index e9526c6faf..be086cb6d8 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/ExternalToolCompletedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/ExternalToolCompletedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code external_tool.completed} session event. + * Session event "external_tool.completed". External tool completion notification signaling UI dismissal * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/ExternalToolRequestedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/ExternalToolRequestedEvent.java index 8e646c1a5c..72591dd47c 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/ExternalToolRequestedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/ExternalToolRequestedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code external_tool.requested} session event. + * Session event "external_tool.requested". External tool invocation request for client-side tool execution * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/HandoffRepository.java b/src/generated/java/com/github/copilot/sdk/generated/HandoffRepository.java new file mode 100644 index 0000000000..a87002c9e3 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/HandoffRepository.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Repository context for the handed-off session + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record HandoffRepository( + /** Repository owner (user or organization) */ + @JsonProperty("owner") String owner, + /** Repository name */ + @JsonProperty("name") String name, + /** Git branch name, if applicable */ + @JsonProperty("branch") String branch +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/HandoffSourceType.java b/src/generated/java/com/github/copilot/sdk/generated/HandoffSourceType.java new file mode 100644 index 0000000000..06f39c214e --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/HandoffSourceType.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * Origin type of the session being handed off + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum HandoffSourceType { + /** The {@code remote} variant. */ + REMOTE("remote"), + /** The {@code local} variant. */ + LOCAL("local"); + + private final String value; + HandoffSourceType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static HandoffSourceType fromValue(String value) { + for (HandoffSourceType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown HandoffSourceType value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/HookEndError.java b/src/generated/java/com/github/copilot/sdk/generated/HookEndError.java new file mode 100644 index 0000000000..bbf992536a --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/HookEndError.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Error details when the hook failed + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record HookEndError( + /** Human-readable error message */ + @JsonProperty("message") String message, + /** Error stack trace, when available */ + @JsonProperty("stack") String stack +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/HookEndEvent.java b/src/generated/java/com/github/copilot/sdk/generated/HookEndEvent.java index 51de160c1b..71b148fb13 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/HookEndEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/HookEndEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code hook.end} session event. + * Session event "hook.end". Hook invocation completion details including output, success status, and error information * * @since 1.0.0 */ @@ -44,18 +44,7 @@ public record HookEndEventData( /** Whether the hook completed successfully */ @JsonProperty("success") Boolean success, /** Error details when the hook failed */ - @JsonProperty("error") HookEndEventDataError error + @JsonProperty("error") HookEndError error ) { - - /** Error details when the hook failed */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record HookEndEventDataError( - /** Human-readable error message */ - @JsonProperty("message") String message, - /** Error stack trace, when available */ - @JsonProperty("stack") String stack - ) { - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/HookStartEvent.java b/src/generated/java/com/github/copilot/sdk/generated/HookStartEvent.java index ffca1dfe0b..0505c4182a 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/HookStartEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/HookStartEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code hook.start} session event. + * Session event "hook.start". Hook invocation start details including type and input data * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/McpOauthCompletedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/McpOauthCompletedEvent.java index 3d410bf2d2..33a56f8248 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/McpOauthCompletedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/McpOauthCompletedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code mcp.oauth_completed} session event. + * Session event "mcp.oauth_completed". MCP OAuth request completion notification * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/McpOauthRequiredEvent.java b/src/generated/java/com/github/copilot/sdk/generated/McpOauthRequiredEvent.java index 748cdfc9ba..c2e9843da1 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/McpOauthRequiredEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/McpOauthRequiredEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code mcp.oauth_required} session event. + * Session event "mcp.oauth_required". OAuth authentication request for an MCP server * * @since 1.0.0 */ @@ -42,18 +42,7 @@ public record McpOauthRequiredEventData( /** URL of the MCP server that requires OAuth */ @JsonProperty("serverUrl") String serverUrl, /** Static OAuth client configuration, if the server specifies one */ - @JsonProperty("staticClientConfig") McpOauthRequiredEventDataStaticClientConfig staticClientConfig + @JsonProperty("staticClientConfig") McpOauthRequiredStaticClientConfig staticClientConfig ) { - - /** Static OAuth client configuration, if the server specifies one */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record McpOauthRequiredEventDataStaticClientConfig( - /** OAuth client ID for the server */ - @JsonProperty("clientId") String clientId, - /** Whether this is a public OAuth client */ - @JsonProperty("publicClient") Boolean publicClient - ) { - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/McpOauthRequiredStaticClientConfig.java b/src/generated/java/com/github/copilot/sdk/generated/McpOauthRequiredStaticClientConfig.java new file mode 100644 index 0000000000..b037b82ac5 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/McpOauthRequiredStaticClientConfig.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Static OAuth client configuration, if the server specifies one + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpOauthRequiredStaticClientConfig( + /** OAuth client ID for the server */ + @JsonProperty("clientId") String clientId, + /** Whether this is a public OAuth client */ + @JsonProperty("publicClient") Boolean publicClient, + /** Optional non-default OAuth grant type. When set to 'client_credentials', the OAuth flow runs headlessly using the client_id + keychain-stored secret (no browser, no callback server). */ + @JsonProperty("grantType") String grantType +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/McpServerSource.java b/src/generated/java/com/github/copilot/sdk/generated/McpServerSource.java new file mode 100644 index 0000000000..15cff507a4 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/McpServerSource.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * Configuration source: user, workspace, plugin, or builtin + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpServerSource { + /** The {@code user} variant. */ + USER("user"), + /** The {@code workspace} variant. */ + WORKSPACE("workspace"), + /** The {@code plugin} variant. */ + PLUGIN("plugin"), + /** The {@code builtin} variant. */ + BUILTIN("builtin"); + + private final String value; + McpServerSource(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpServerSource fromValue(String value) { + for (McpServerSource v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpServerSource value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/McpServerStatus.java b/src/generated/java/com/github/copilot/sdk/generated/McpServerStatus.java new file mode 100644 index 0000000000..f9c948f10c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/McpServerStatus.java @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * Connection status: connected, failed, needs-auth, pending, disabled, or not_configured + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpServerStatus { + /** The {@code connected} variant. */ + CONNECTED("connected"), + /** The {@code failed} variant. */ + FAILED("failed"), + /** The {@code needs-auth} variant. */ + NEEDS_AUTH("needs-auth"), + /** The {@code pending} variant. */ + PENDING("pending"), + /** The {@code disabled} variant. */ + DISABLED("disabled"), + /** The {@code not_configured} variant. */ + NOT_CONFIGURED("not_configured"); + + private final String value; + McpServerStatus(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpServerStatus fromValue(String value) { + for (McpServerStatus v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpServerStatus value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/McpServerStatusChangedStatus.java b/src/generated/java/com/github/copilot/sdk/generated/McpServerStatusChangedStatus.java new file mode 100644 index 0000000000..c0a6d989d2 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/McpServerStatusChangedStatus.java @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * New connection status: connected, failed, needs-auth, pending, disabled, or not_configured + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpServerStatusChangedStatus { + /** The {@code connected} variant. */ + CONNECTED("connected"), + /** The {@code failed} variant. */ + FAILED("failed"), + /** The {@code needs-auth} variant. */ + NEEDS_AUTH("needs-auth"), + /** The {@code pending} variant. */ + PENDING("pending"), + /** The {@code disabled} variant. */ + DISABLED("disabled"), + /** The {@code not_configured} variant. */ + NOT_CONFIGURED("not_configured"); + + private final String value; + McpServerStatusChangedStatus(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpServerStatusChangedStatus fromValue(String value) { + for (McpServerStatusChangedStatus v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpServerStatusChangedStatus value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/McpServersLoadedServer.java b/src/generated/java/com/github/copilot/sdk/generated/McpServersLoadedServer.java new file mode 100644 index 0000000000..dbd08ede71 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/McpServersLoadedServer.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `McpServersLoadedServer` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpServersLoadedServer( + /** Server name (config key) */ + @JsonProperty("name") String name, + /** Connection status: connected, failed, needs-auth, pending, disabled, or not_configured */ + @JsonProperty("status") McpServerStatus status, + /** Configuration source: user, workspace, plugin, or builtin */ + @JsonProperty("source") McpServerSource source, + /** Error message if the server failed to connect */ + @JsonProperty("error") String error +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/McpServersLoadedServerStatus.java b/src/generated/java/com/github/copilot/sdk/generated/McpServersLoadedServerStatus.java new file mode 100644 index 0000000000..4d09fe2a38 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/McpServersLoadedServerStatus.java @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * Connection status: connected, failed, needs-auth, pending, disabled, or not_configured + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpServersLoadedServerStatus { + /** The {@code connected} variant. */ + CONNECTED("connected"), + /** The {@code failed} variant. */ + FAILED("failed"), + /** The {@code needs-auth} variant. */ + NEEDS_AUTH("needs-auth"), + /** The {@code pending} variant. */ + PENDING("pending"), + /** The {@code disabled} variant. */ + DISABLED("disabled"), + /** The {@code not_configured} variant. */ + NOT_CONFIGURED("not_configured"); + + private final String value; + McpServersLoadedServerStatus(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpServersLoadedServerStatus fromValue(String value) { + for (McpServersLoadedServerStatus v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpServersLoadedServerStatus value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ModelCallFailureEvent.java b/src/generated/java/com/github/copilot/sdk/generated/ModelCallFailureEvent.java new file mode 100644 index 0000000000..42de2f1f84 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ModelCallFailureEvent.java @@ -0,0 +1,56 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Session event "model.call_failure". Failed LLM API call metadata for telemetry + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class ModelCallFailureEvent extends SessionEvent { + + @Override + public String getType() { return "model.call_failure"; } + + @JsonProperty("data") + private ModelCallFailureEventData data; + + public ModelCallFailureEventData getData() { return data; } + public void setData(ModelCallFailureEventData data) { this.data = data; } + + /** Data payload for {@link ModelCallFailureEvent}. */ + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record ModelCallFailureEventData( + /** Model identifier used for the failed API call */ + @JsonProperty("model") String model, + /** What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls */ + @JsonProperty("initiator") String initiator, + /** Completion ID from the model provider (e.g., chatcmpl-abc123) */ + @JsonProperty("apiCallId") String apiCallId, + /** GitHub request tracing ID (x-github-request-id header) for server-side log correlation */ + @JsonProperty("providerCallId") String providerCallId, + /** HTTP status code from the failed request */ + @JsonProperty("statusCode") Long statusCode, + /** Duration of the failed API call in milliseconds */ + @JsonProperty("durationMs") Long durationMs, + /** Where the failed model call originated */ + @JsonProperty("source") ModelCallFailureSource source, + /** Raw provider/runtime error message for restricted telemetry */ + @JsonProperty("errorMessage") String errorMessage + ) { + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ModelCallFailureSource.java b/src/generated/java/com/github/copilot/sdk/generated/ModelCallFailureSource.java new file mode 100644 index 0000000000..469adaab43 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ModelCallFailureSource.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * Where the failed model call originated + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ModelCallFailureSource { + /** The {@code top_level} variant. */ + TOP_LEVEL("top_level"), + /** The {@code subagent} variant. */ + SUBAGENT("subagent"), + /** The {@code mcp_sampling} variant. */ + MCP_SAMPLING("mcp_sampling"); + + private final String value; + ModelCallFailureSource(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ModelCallFailureSource fromValue(String value) { + for (ModelCallFailureSource v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ModelCallFailureSource value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/PendingMessagesModifiedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/PendingMessagesModifiedEvent.java index 56f8ed520e..7cdcf1d3a8 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/PendingMessagesModifiedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/PendingMessagesModifiedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code pending_messages.modified} session event. + * Session event "pending_messages.modified". Empty payload; the event signals that the pending message queue has changed * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/PermissionCompletedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/PermissionCompletedEvent.java index 06300a5aef..feeb4ca822 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/PermissionCompletedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/PermissionCompletedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code permission.completed} session event. + * Session event "permission.completed". Permission request completion notification signaling UI dismissal * * @since 1.0.0 */ @@ -37,45 +37,10 @@ public final class PermissionCompletedEvent extends SessionEvent { public record PermissionCompletedEventData( /** Request ID of the resolved permission request; clients should dismiss any UI for this request */ @JsonProperty("requestId") String requestId, + /** Optional tool call ID associated with this permission prompt; clients may use it to correlate UI created from tool-scoped prompts */ + @JsonProperty("toolCallId") String toolCallId, /** The result of the permission request */ - @JsonProperty("result") PermissionCompletedEventDataResult result + @JsonProperty("result") Object result ) { - - /** The result of the permission request */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record PermissionCompletedEventDataResult( - /** The outcome of the permission request */ - @JsonProperty("kind") PermissionCompletedEventDataResultKind kind - ) { - - /** The outcome of the permission request */ - public enum PermissionCompletedEventDataResultKind { - /** The {@code approved} variant. */ - APPROVED("approved"), - /** The {@code denied-by-rules} variant. */ - DENIED_BY_RULES("denied-by-rules"), - /** The {@code denied-no-approval-rule-and-could-not-request-from-user} variant. */ - DENIED_NO_APPROVAL_RULE_AND_COULD_NOT_REQUEST_FROM_USER("denied-no-approval-rule-and-could-not-request-from-user"), - /** The {@code denied-interactively-by-user} variant. */ - DENIED_INTERACTIVELY_BY_USER("denied-interactively-by-user"), - /** The {@code denied-by-content-exclusion-policy} variant. */ - DENIED_BY_CONTENT_EXCLUSION_POLICY("denied-by-content-exclusion-policy"), - /** The {@code denied-by-permission-request-hook} variant. */ - DENIED_BY_PERMISSION_REQUEST_HOOK("denied-by-permission-request-hook"); - - private final String value; - PermissionCompletedEventDataResultKind(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static PermissionCompletedEventDataResultKind fromValue(String value) { - for (PermissionCompletedEventDataResultKind v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown PermissionCompletedEventDataResultKind value: " + value); - } - } - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/PermissionCompletedKind.java b/src/generated/java/com/github/copilot/sdk/generated/PermissionCompletedKind.java new file mode 100644 index 0000000000..c02f221fd5 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/PermissionCompletedKind.java @@ -0,0 +1,47 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * The outcome of the permission request + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum PermissionCompletedKind { + /** The {@code approved} variant. */ + APPROVED("approved"), + /** The {@code approved-for-session} variant. */ + APPROVED_FOR_SESSION("approved-for-session"), + /** The {@code approved-for-location} variant. */ + APPROVED_FOR_LOCATION("approved-for-location"), + /** The {@code denied-by-rules} variant. */ + DENIED_BY_RULES("denied-by-rules"), + /** The {@code denied-no-approval-rule-and-could-not-request-from-user} variant. */ + DENIED_NO_APPROVAL_RULE_AND_COULD_NOT_REQUEST_FROM_USER("denied-no-approval-rule-and-could-not-request-from-user"), + /** The {@code denied-interactively-by-user} variant. */ + DENIED_INTERACTIVELY_BY_USER("denied-interactively-by-user"), + /** The {@code denied-by-content-exclusion-policy} variant. */ + DENIED_BY_CONTENT_EXCLUSION_POLICY("denied-by-content-exclusion-policy"), + /** The {@code denied-by-permission-request-hook} variant. */ + DENIED_BY_PERMISSION_REQUEST_HOOK("denied-by-permission-request-hook"); + + private final String value; + PermissionCompletedKind(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static PermissionCompletedKind fromValue(String value) { + for (PermissionCompletedKind v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown PermissionCompletedKind value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/PermissionCompletedResult.java b/src/generated/java/com/github/copilot/sdk/generated/PermissionCompletedResult.java new file mode 100644 index 0000000000..4a180001ca --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/PermissionCompletedResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * The result of the permission request + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record PermissionCompletedResult( + /** The outcome of the permission request */ + @JsonProperty("kind") PermissionCompletedKind kind +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/PermissionRequestedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/PermissionRequestedEvent.java index 83a1967c7f..fda4db42f3 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/PermissionRequestedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/PermissionRequestedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code permission.requested} session event. + * Session event "permission.requested". Permission request notification requiring client approval with request details * * @since 1.0.0 */ @@ -39,6 +39,8 @@ public record PermissionRequestedEventData( @JsonProperty("requestId") String requestId, /** Details of the permission being requested */ @JsonProperty("permissionRequest") Object permissionRequest, + /** Derived user-facing permission prompt details for UI consumers */ + @JsonProperty("promptRequest") Object promptRequest, /** When true, this permission was already resolved by a permissionRequest hook and requires no client action */ @JsonProperty("resolvedByHook") Boolean resolvedByHook ) { diff --git a/src/generated/java/com/github/copilot/sdk/generated/PlanChangedOperation.java b/src/generated/java/com/github/copilot/sdk/generated/PlanChangedOperation.java new file mode 100644 index 0000000000..cd52d7ec1a --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/PlanChangedOperation.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * The type of operation performed on the plan file + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum PlanChangedOperation { + /** The {@code create} variant. */ + CREATE("create"), + /** The {@code update} variant. */ + UPDATE("update"), + /** The {@code delete} variant. */ + DELETE("delete"); + + private final String value; + PlanChangedOperation(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static PlanChangedOperation fromValue(String value) { + for (PlanChangedOperation v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown PlanChangedOperation value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ReasoningSummary.java b/src/generated/java/com/github/copilot/sdk/generated/ReasoningSummary.java new file mode 100644 index 0000000000..98897bbc92 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ReasoningSummary.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * Reasoning summary mode used for model calls, if applicable (e.g. "none", "concise", "detailed") + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ReasoningSummary { + /** The {@code none} variant. */ + NONE("none"), + /** The {@code concise} variant. */ + CONCISE("concise"), + /** The {@code detailed} variant. */ + DETAILED("detailed"); + + private final String value; + ReasoningSummary(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ReasoningSummary fromValue(String value) { + for (ReasoningSummary v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ReasoningSummary value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/SamplingCompletedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SamplingCompletedEvent.java index ae21575094..2c6b264aa9 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SamplingCompletedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SamplingCompletedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code sampling.completed} session event. + * Session event "sampling.completed". Sampling request completion notification signaling UI dismissal * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/SamplingRequestedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SamplingRequestedEvent.java index 7b92f5fafe..2be3cfc491 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SamplingRequestedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SamplingRequestedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code sampling.requested} session event. + * Session event "sampling.requested". Sampling request from an MCP server; contains the server name and a requestId for correlation * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionBackgroundTasksChangedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionBackgroundTasksChangedEvent.java index fa996cf0e3..062954dfbf 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionBackgroundTasksChangedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionBackgroundTasksChangedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.background_tasks_changed} session event. + * Session event "session.background_tasks_changed". * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionCompactionCompleteEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionCompactionCompleteEvent.java index 14728cf201..3c1252003d 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionCompactionCompleteEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionCompactionCompleteEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.compaction_complete} session event. + * Session event "session.compaction_complete". Conversation compaction results including success status, metrics, and optional error details * * @since 1.0.0 */ @@ -40,44 +40,33 @@ public record SessionCompactionCompleteEventData( /** Error message if compaction failed */ @JsonProperty("error") String error, /** Total tokens in conversation before compaction */ - @JsonProperty("preCompactionTokens") Double preCompactionTokens, + @JsonProperty("preCompactionTokens") Long preCompactionTokens, /** Total tokens in conversation after compaction */ - @JsonProperty("postCompactionTokens") Double postCompactionTokens, + @JsonProperty("postCompactionTokens") Long postCompactionTokens, /** Number of messages before compaction */ - @JsonProperty("preCompactionMessagesLength") Double preCompactionMessagesLength, + @JsonProperty("preCompactionMessagesLength") Long preCompactionMessagesLength, /** Number of messages removed during compaction */ - @JsonProperty("messagesRemoved") Double messagesRemoved, + @JsonProperty("messagesRemoved") Long messagesRemoved, /** Number of tokens removed during compaction */ - @JsonProperty("tokensRemoved") Double tokensRemoved, + @JsonProperty("tokensRemoved") Long tokensRemoved, + /** User-supplied focus instructions provided to a manual `/compact` invocation. Omitted for automatic compaction and for manual compaction with no focus text. */ + @JsonProperty("customInstructions") String customInstructions, /** LLM-generated summary of the compacted conversation history */ @JsonProperty("summaryContent") String summaryContent, /** Checkpoint snapshot number created for recovery */ - @JsonProperty("checkpointNumber") Double checkpointNumber, + @JsonProperty("checkpointNumber") Long checkpointNumber, /** File path where the checkpoint was stored */ @JsonProperty("checkpointPath") String checkpointPath, - /** Token usage breakdown for the compaction LLM call */ - @JsonProperty("compactionTokensUsed") SessionCompactionCompleteEventDataCompactionTokensUsed compactionTokensUsed, + /** Token usage breakdown for the compaction LLM call (aligned with assistant.usage format) */ + @JsonProperty("compactionTokensUsed") CompactionCompleteCompactionTokensUsed compactionTokensUsed, /** GitHub request tracing ID (x-github-request-id header) for the compaction LLM call */ @JsonProperty("requestId") String requestId, /** Token count from system message(s) after compaction */ - @JsonProperty("systemTokens") Double systemTokens, + @JsonProperty("systemTokens") Long systemTokens, /** Token count from non-system messages (user, assistant, tool) after compaction */ - @JsonProperty("conversationTokens") Double conversationTokens, + @JsonProperty("conversationTokens") Long conversationTokens, /** Token count from tool definitions after compaction */ - @JsonProperty("toolDefinitionsTokens") Double toolDefinitionsTokens + @JsonProperty("toolDefinitionsTokens") Long toolDefinitionsTokens ) { - - /** Token usage breakdown for the compaction LLM call */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionCompactionCompleteEventDataCompactionTokensUsed( - /** Input tokens consumed by the compaction LLM call */ - @JsonProperty("input") Double input, - /** Output tokens produced by the compaction LLM call */ - @JsonProperty("output") Double output, - /** Cached input tokens reused in the compaction LLM call */ - @JsonProperty("cachedInput") Double cachedInput - ) { - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionCompactionStartEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionCompactionStartEvent.java index 2e0fb6d6f4..051f83f4cf 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionCompactionStartEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionCompactionStartEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.compaction_start} session event. + * Session event "session.compaction_start". Context window breakdown at the start of LLM-powered conversation compaction * * @since 1.0.0 */ @@ -36,11 +36,11 @@ public final class SessionCompactionStartEvent extends SessionEvent { @JsonInclude(JsonInclude.Include.NON_NULL) public record SessionCompactionStartEventData( /** Token count from system message(s) at compaction start */ - @JsonProperty("systemTokens") Double systemTokens, + @JsonProperty("systemTokens") Long systemTokens, /** Token count from non-system messages (user, assistant, tool) at compaction start */ - @JsonProperty("conversationTokens") Double conversationTokens, + @JsonProperty("conversationTokens") Long conversationTokens, /** Token count from tool definitions at compaction start */ - @JsonProperty("toolDefinitionsTokens") Double toolDefinitionsTokens + @JsonProperty("toolDefinitionsTokens") Long toolDefinitionsTokens ) { } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionContextChangedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionContextChangedEvent.java index 5399860a22..6cc775d528 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionContextChangedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionContextChangedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.context_changed} session event. + * Session event "session.context_changed". Updated working directory and git context after the change * * @since 1.0.0 */ @@ -42,7 +42,9 @@ public record SessionContextChangedEventData( /** Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps) */ @JsonProperty("repository") String repository, /** Hosting platform type of the repository (github or ado) */ - @JsonProperty("hostType") SessionContextChangedEventDataHostType hostType, + @JsonProperty("hostType") WorkingDirectoryContextHostType hostType, + /** Raw host string from the git remote URL (e.g. "github.com", "mycompany.ghe.com", "dev.azure.com") */ + @JsonProperty("repositoryHost") String repositoryHost, /** Current git branch name */ @JsonProperty("branch") String branch, /** Head commit of current git branch at session start time */ @@ -50,25 +52,5 @@ public record SessionContextChangedEventData( /** Base commit of current git branch at session start time */ @JsonProperty("baseCommit") String baseCommit ) { - - /** Hosting platform type of the repository (github or ado) */ - public enum SessionContextChangedEventDataHostType { - /** The {@code github} variant. */ - GITHUB("github"), - /** The {@code ado} variant. */ - ADO("ado"); - - private final String value; - SessionContextChangedEventDataHostType(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionContextChangedEventDataHostType fromValue(String value) { - for (SessionContextChangedEventDataHostType v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionContextChangedEventDataHostType value: " + value); - } - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionCustomAgentsUpdatedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionCustomAgentsUpdatedEvent.java index 0a0c3f7615..ec10ed9c93 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionCustomAgentsUpdatedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionCustomAgentsUpdatedEvent.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.custom_agents_updated} session event. + * Session event "session.custom_agents_updated". * * @since 1.0.0 */ @@ -37,33 +37,11 @@ public final class SessionCustomAgentsUpdatedEvent extends SessionEvent { @JsonInclude(JsonInclude.Include.NON_NULL) public record SessionCustomAgentsUpdatedEventData( /** Array of loaded custom agent metadata */ - @JsonProperty("agents") List agents, + @JsonProperty("agents") List agents, /** Non-fatal warnings from agent loading */ @JsonProperty("warnings") List warnings, /** Fatal errors from agent loading */ @JsonProperty("errors") List errors ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionCustomAgentsUpdatedEventDataAgentsItem( - /** Unique identifier for the agent */ - @JsonProperty("id") String id, - /** Internal name of the agent */ - @JsonProperty("name") String name, - /** Human-readable display name */ - @JsonProperty("displayName") String displayName, - /** Description of what the agent does */ - @JsonProperty("description") String description, - /** Source location: user, project, inherited, remote, or plugin */ - @JsonProperty("source") String source, - /** List of tool names available to this agent */ - @JsonProperty("tools") List tools, - /** Whether the agent can be selected by the user */ - @JsonProperty("userInvocable") Boolean userInvocable, - /** Model override for this agent, if set */ - @JsonProperty("model") String model - ) { - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionCustomNotificationEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionCustomNotificationEvent.java new file mode 100644 index 0000000000..3078895b7a --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionCustomNotificationEvent.java @@ -0,0 +1,51 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import javax.annotation.processing.Generated; + +/** + * Session event "session.custom_notification". Opaque custom notification data. Consumers may branch on source and name, but payload semantics are source-defined. + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionCustomNotificationEvent extends SessionEvent { + + @Override + public String getType() { return "session.custom_notification"; } + + @JsonProperty("data") + private SessionCustomNotificationEventData data; + + public SessionCustomNotificationEventData getData() { return data; } + public void setData(SessionCustomNotificationEventData data) { this.data = data; } + + /** Data payload for {@link SessionCustomNotificationEvent}. */ + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record SessionCustomNotificationEventData( + /** Namespace for the custom notification producer */ + @JsonProperty("source") String source, + /** Source-defined custom notification name */ + @JsonProperty("name") String name, + /** Optional source-defined payload schema version */ + @JsonProperty("version") Long version, + /** Optional source-defined string identifiers describing the payload subject */ + @JsonProperty("subject") Map subject, + /** Source-defined JSON payload for the custom notification */ + @JsonProperty("payload") Object payload + ) { + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionErrorEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionErrorEvent.java index 33dc688348..48ae04ade0 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionErrorEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionErrorEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.error} session event. + * Session event "session.error". Error details for timeline display including message and optional diagnostic information * * @since 1.0.0 */ @@ -37,6 +37,10 @@ public final class SessionErrorEvent extends SessionEvent { public record SessionErrorEventData( /** Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "context_limit", "query") */ @JsonProperty("errorType") String errorType, + /** Fine-grained error code from the upstream provider, when available. For `errorType: "rate_limit"`, this is one of the `RateLimitErrorCode` values (e.g., `"user_weekly_rate_limited"`, `"user_global_rate_limited"`, `"rate_limited"`, `"user_model_rate_limited"`, `"integration_rate_limited"`). For `errorType: "quota"`, this is the CAPI quota error code (e.g., `"quota_exceeded"`, `"session_quota_exceeded"`, `"billing_not_configured"`). */ + @JsonProperty("errorCode") String errorCode, + /** Only set on `errorType: "rate_limit"`. When `true`, the runtime will follow this error with an `auto_mode_switch.requested` event (or silently switch if `continueOnAutoMode` is enabled). UI clients can use this flag to suppress duplicate rendering of the rate-limit error when they show their own auto-mode-switch prompt. */ + @JsonProperty("eligibleForAutoSwitch") Boolean eligibleForAutoSwitch, /** Human-readable error message */ @JsonProperty("message") String message, /** Error stack trace, when available */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionEvent.java index 1b63b238e7..2181be1972 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionEvent.java @@ -31,6 +31,8 @@ @JsonSubTypes.Type(value = SessionErrorEvent.class, name = "session.error"), @JsonSubTypes.Type(value = SessionIdleEvent.class, name = "session.idle"), @JsonSubTypes.Type(value = SessionTitleChangedEvent.class, name = "session.title_changed"), + @JsonSubTypes.Type(value = SessionScheduleCreatedEvent.class, name = "session.schedule_created"), + @JsonSubTypes.Type(value = SessionScheduleCancelledEvent.class, name = "session.schedule_cancelled"), @JsonSubTypes.Type(value = SessionInfoEvent.class, name = "session.info"), @JsonSubTypes.Type(value = SessionWarningEvent.class, name = "session.warning"), @JsonSubTypes.Type(value = SessionModelChangeEvent.class, name = "session.model_change"), @@ -54,9 +56,11 @@ @JsonSubTypes.Type(value = AssistantReasoningDeltaEvent.class, name = "assistant.reasoning_delta"), @JsonSubTypes.Type(value = AssistantStreamingDeltaEvent.class, name = "assistant.streaming_delta"), @JsonSubTypes.Type(value = AssistantMessageEvent.class, name = "assistant.message"), + @JsonSubTypes.Type(value = AssistantMessageStartEvent.class, name = "assistant.message_start"), @JsonSubTypes.Type(value = AssistantMessageDeltaEvent.class, name = "assistant.message_delta"), @JsonSubTypes.Type(value = AssistantTurnEndEvent.class, name = "assistant.turn_end"), @JsonSubTypes.Type(value = AssistantUsageEvent.class, name = "assistant.usage"), + @JsonSubTypes.Type(value = ModelCallFailureEvent.class, name = "model.call_failure"), @JsonSubTypes.Type(value = AbortEvent.class, name = "abort"), @JsonSubTypes.Type(value = ToolUserRequestedEvent.class, name = "tool.user_requested"), @JsonSubTypes.Type(value = ToolExecutionStartEvent.class, name = "tool.execution_start"), @@ -83,11 +87,14 @@ @JsonSubTypes.Type(value = SamplingCompletedEvent.class, name = "sampling.completed"), @JsonSubTypes.Type(value = McpOauthRequiredEvent.class, name = "mcp.oauth_required"), @JsonSubTypes.Type(value = McpOauthCompletedEvent.class, name = "mcp.oauth_completed"), + @JsonSubTypes.Type(value = SessionCustomNotificationEvent.class, name = "session.custom_notification"), @JsonSubTypes.Type(value = ExternalToolRequestedEvent.class, name = "external_tool.requested"), @JsonSubTypes.Type(value = ExternalToolCompletedEvent.class, name = "external_tool.completed"), @JsonSubTypes.Type(value = CommandQueuedEvent.class, name = "command.queued"), @JsonSubTypes.Type(value = CommandExecuteEvent.class, name = "command.execute"), @JsonSubTypes.Type(value = CommandCompletedEvent.class, name = "command.completed"), + @JsonSubTypes.Type(value = AutoModeSwitchRequestedEvent.class, name = "auto_mode_switch.requested"), + @JsonSubTypes.Type(value = AutoModeSwitchCompletedEvent.class, name = "auto_mode_switch.completed"), @JsonSubTypes.Type(value = CommandsChangedEvent.class, name = "commands.changed"), @JsonSubTypes.Type(value = CapabilitiesChangedEvent.class, name = "capabilities.changed"), @JsonSubTypes.Type(value = ExitPlanModeRequestedEvent.class, name = "exit_plan_mode.requested"), @@ -108,6 +115,8 @@ public abstract sealed class SessionEvent permits SessionErrorEvent, SessionIdleEvent, SessionTitleChangedEvent, + SessionScheduleCreatedEvent, + SessionScheduleCancelledEvent, SessionInfoEvent, SessionWarningEvent, SessionModelChangeEvent, @@ -131,9 +140,11 @@ public abstract sealed class SessionEvent permits AssistantReasoningDeltaEvent, AssistantStreamingDeltaEvent, AssistantMessageEvent, + AssistantMessageStartEvent, AssistantMessageDeltaEvent, AssistantTurnEndEvent, AssistantUsageEvent, + ModelCallFailureEvent, AbortEvent, ToolUserRequestedEvent, ToolExecutionStartEvent, @@ -160,11 +171,14 @@ public abstract sealed class SessionEvent permits SamplingCompletedEvent, McpOauthRequiredEvent, McpOauthCompletedEvent, + SessionCustomNotificationEvent, ExternalToolRequestedEvent, ExternalToolCompletedEvent, CommandQueuedEvent, CommandExecuteEvent, CommandCompletedEvent, + AutoModeSwitchRequestedEvent, + AutoModeSwitchCompletedEvent, CommandsChangedEvent, CapabilitiesChangedEvent, ExitPlanModeRequestedEvent, diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionExtensionsLoadedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionExtensionsLoadedEvent.java index 969851a783..a1b9b8fcef 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionExtensionsLoadedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionExtensionsLoadedEvent.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.extensions_loaded} session event. + * Session event "session.extensions_loaded". * * @since 1.0.0 */ @@ -37,65 +37,7 @@ public final class SessionExtensionsLoadedEvent extends SessionEvent { @JsonInclude(JsonInclude.Include.NON_NULL) public record SessionExtensionsLoadedEventData( /** Array of discovered extensions and their status */ - @JsonProperty("extensions") List extensions + @JsonProperty("extensions") List extensions ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionExtensionsLoadedEventDataExtensionsItem( - /** Source-qualified extension ID (e.g., 'project:my-ext', 'user:auth-helper') */ - @JsonProperty("id") String id, - /** Extension name (directory name) */ - @JsonProperty("name") String name, - /** Discovery source */ - @JsonProperty("source") SessionExtensionsLoadedEventDataExtensionsItemSource source, - /** Current status: running, disabled, failed, or starting */ - @JsonProperty("status") SessionExtensionsLoadedEventDataExtensionsItemStatus status - ) { - - /** Discovery source */ - public enum SessionExtensionsLoadedEventDataExtensionsItemSource { - /** The {@code project} variant. */ - PROJECT("project"), - /** The {@code user} variant. */ - USER("user"); - - private final String value; - SessionExtensionsLoadedEventDataExtensionsItemSource(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionExtensionsLoadedEventDataExtensionsItemSource fromValue(String value) { - for (SessionExtensionsLoadedEventDataExtensionsItemSource v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionExtensionsLoadedEventDataExtensionsItemSource value: " + value); - } - } - - /** Current status: running, disabled, failed, or starting */ - public enum SessionExtensionsLoadedEventDataExtensionsItemStatus { - /** The {@code running} variant. */ - RUNNING("running"), - /** The {@code disabled} variant. */ - DISABLED("disabled"), - /** The {@code failed} variant. */ - FAILED("failed"), - /** The {@code starting} variant. */ - STARTING("starting"); - - private final String value; - SessionExtensionsLoadedEventDataExtensionsItemStatus(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionExtensionsLoadedEventDataExtensionsItemStatus fromValue(String value) { - for (SessionExtensionsLoadedEventDataExtensionsItemStatus v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionExtensionsLoadedEventDataExtensionsItemStatus value: " + value); - } - } - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionHandoffEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionHandoffEvent.java index 431108733b..11599defae 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionHandoffEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionHandoffEvent.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.handoff} session event. + * Session event "session.handoff". Session handoff metadata including source, context, and repository information * * @since 1.0.0 */ @@ -39,9 +39,9 @@ public record SessionHandoffEventData( /** ISO 8601 timestamp when the handoff occurred */ @JsonProperty("handoffTime") OffsetDateTime handoffTime, /** Origin type of the session being handed off */ - @JsonProperty("sourceType") SessionHandoffEventDataSourceType sourceType, + @JsonProperty("sourceType") HandoffSourceType sourceType, /** Repository context for the handed-off session */ - @JsonProperty("repository") SessionHandoffEventDataRepository repository, + @JsonProperty("repository") HandoffRepository repository, /** Additional context information for the handoff */ @JsonProperty("context") String context, /** Summary of the work done in the source session */ @@ -51,38 +51,5 @@ public record SessionHandoffEventData( /** GitHub host URL for the source session (e.g., https://github.com or https://tenant.ghe.com) */ @JsonProperty("host") String host ) { - - /** Origin type of the session being handed off */ - public enum SessionHandoffEventDataSourceType { - /** The {@code remote} variant. */ - REMOTE("remote"), - /** The {@code local} variant. */ - LOCAL("local"); - - private final String value; - SessionHandoffEventDataSourceType(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionHandoffEventDataSourceType fromValue(String value) { - for (SessionHandoffEventDataSourceType v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionHandoffEventDataSourceType value: " + value); - } - } - - /** Repository context for the handed-off session */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionHandoffEventDataRepository( - /** Repository owner (user or organization) */ - @JsonProperty("owner") String owner, - /** Repository name */ - @JsonProperty("name") String name, - /** Git branch name, if applicable */ - @JsonProperty("branch") String branch - ) { - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionIdleEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionIdleEvent.java index 86376ae7c1..cdb38a3444 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionIdleEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionIdleEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.idle} session event. + * Session event "session.idle". Payload indicating the session is idle with no background agents in flight * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionInfoEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionInfoEvent.java index 4dee36ba5c..c0613dfa20 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionInfoEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionInfoEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.info} session event. + * Session event "session.info". Informational message for timeline display with categorization * * @since 1.0.0 */ @@ -40,7 +40,9 @@ public record SessionInfoEventData( /** Human-readable informational message for display in the timeline */ @JsonProperty("message") String message, /** Optional URL associated with this message that the user can open in a browser */ - @JsonProperty("url") String url + @JsonProperty("url") String url, + /** Optional actionable tip displayed with this message */ + @JsonProperty("tip") String tip ) { } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionMcpServerStatusChangedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionMcpServerStatusChangedEvent.java index 7bf09f7f55..27cf4d9cc6 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionMcpServerStatusChangedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionMcpServerStatusChangedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.mcp_server_status_changed} session event. + * Session event "session.mcp_server_status_changed". * * @since 1.0.0 */ @@ -37,36 +37,8 @@ public final class SessionMcpServerStatusChangedEvent extends SessionEvent { public record SessionMcpServerStatusChangedEventData( /** Name of the MCP server whose status changed */ @JsonProperty("serverName") String serverName, - /** New connection status: connected, failed, needs-auth, pending, disabled, or not_configured */ - @JsonProperty("status") SessionMcpServerStatusChangedEventDataStatus status + /** Connection status: connected, failed, needs-auth, pending, disabled, or not_configured */ + @JsonProperty("status") McpServerStatus status ) { - - /** New connection status: connected, failed, needs-auth, pending, disabled, or not_configured */ - public enum SessionMcpServerStatusChangedEventDataStatus { - /** The {@code connected} variant. */ - CONNECTED("connected"), - /** The {@code failed} variant. */ - FAILED("failed"), - /** The {@code needs-auth} variant. */ - NEEDS_AUTH("needs-auth"), - /** The {@code pending} variant. */ - PENDING("pending"), - /** The {@code disabled} variant. */ - DISABLED("disabled"), - /** The {@code not_configured} variant. */ - NOT_CONFIGURED("not_configured"); - - private final String value; - SessionMcpServerStatusChangedEventDataStatus(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionMcpServerStatusChangedEventDataStatus fromValue(String value) { - for (SessionMcpServerStatusChangedEventDataStatus v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionMcpServerStatusChangedEventDataStatus value: " + value); - } - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionMcpServersLoadedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionMcpServersLoadedEvent.java index e6ab5f25dc..0a0b7bc50b 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionMcpServersLoadedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionMcpServersLoadedEvent.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.mcp_servers_loaded} session event. + * Session event "session.mcp_servers_loaded". * * @since 1.0.0 */ @@ -37,49 +37,7 @@ public final class SessionMcpServersLoadedEvent extends SessionEvent { @JsonInclude(JsonInclude.Include.NON_NULL) public record SessionMcpServersLoadedEventData( /** Array of MCP server status summaries */ - @JsonProperty("servers") List servers + @JsonProperty("servers") List servers ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionMcpServersLoadedEventDataServersItem( - /** Server name (config key) */ - @JsonProperty("name") String name, - /** Connection status: connected, failed, needs-auth, pending, disabled, or not_configured */ - @JsonProperty("status") SessionMcpServersLoadedEventDataServersItemStatus status, - /** Configuration source: user, workspace, plugin, or builtin */ - @JsonProperty("source") String source, - /** Error message if the server failed to connect */ - @JsonProperty("error") String error - ) { - - /** Connection status: connected, failed, needs-auth, pending, disabled, or not_configured */ - public enum SessionMcpServersLoadedEventDataServersItemStatus { - /** The {@code connected} variant. */ - CONNECTED("connected"), - /** The {@code failed} variant. */ - FAILED("failed"), - /** The {@code needs-auth} variant. */ - NEEDS_AUTH("needs-auth"), - /** The {@code pending} variant. */ - PENDING("pending"), - /** The {@code disabled} variant. */ - DISABLED("disabled"), - /** The {@code not_configured} variant. */ - NOT_CONFIGURED("not_configured"); - - private final String value; - SessionMcpServersLoadedEventDataServersItemStatus(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionMcpServersLoadedEventDataServersItemStatus fromValue(String value) { - for (SessionMcpServersLoadedEventDataServersItemStatus v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionMcpServersLoadedEventDataServersItemStatus value: " + value); - } - } - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionMode.java b/src/generated/java/com/github/copilot/sdk/generated/SessionMode.java new file mode 100644 index 0000000000..f6359c0df9 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionMode.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * The session mode the agent is operating in + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SessionMode { + /** The {@code interactive} variant. */ + INTERACTIVE("interactive"), + /** The {@code plan} variant. */ + PLAN("plan"), + /** The {@code autopilot} variant. */ + AUTOPILOT("autopilot"); + + private final String value; + SessionMode(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SessionMode fromValue(String value) { + for (SessionMode v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SessionMode value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionModeChangedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionModeChangedEvent.java index 82ae9ff39c..c997f9850d 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionModeChangedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionModeChangedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.mode_changed} session event. + * Session event "session.mode_changed". Agent mode change details including previous and new modes * * @since 1.0.0 */ @@ -35,10 +35,10 @@ public final class SessionModeChangedEvent extends SessionEvent { @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) public record SessionModeChangedEventData( - /** Agent mode before the change (e.g., "interactive", "plan", "autopilot") */ - @JsonProperty("previousMode") String previousMode, - /** Agent mode after the change (e.g., "interactive", "plan", "autopilot") */ - @JsonProperty("newMode") String newMode + /** The session mode the agent is operating in */ + @JsonProperty("previousMode") SessionMode previousMode, + /** The session mode the agent is operating in */ + @JsonProperty("newMode") SessionMode newMode ) { } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionModelChangeEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionModelChangeEvent.java index c23c8a5f50..8225fc78f9 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionModelChangeEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionModelChangeEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.model_change} session event. + * Session event "session.model_change". Model change details including previous and new model identifiers * * @since 1.0.0 */ @@ -42,7 +42,13 @@ public record SessionModelChangeEventData( /** Reasoning effort level before the model change, if applicable */ @JsonProperty("previousReasoningEffort") String previousReasoningEffort, /** Reasoning effort level after the model change, if applicable */ - @JsonProperty("reasoningEffort") String reasoningEffort + @JsonProperty("reasoningEffort") String reasoningEffort, + /** Reasoning summary mode before the model change, if applicable */ + @JsonProperty("previousReasoningSummary") ReasoningSummary previousReasoningSummary, + /** Reasoning summary mode after the model change, if applicable */ + @JsonProperty("reasoningSummary") ReasoningSummary reasoningSummary, + /** Reason the change happened, when not user-initiated. Currently `"rate_limit_auto_switch"` for changes triggered by the auto-mode-switch rate-limit recovery path. UI clients can use this to render contextual copy. */ + @JsonProperty("cause") String cause ) { } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionPlanChangedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionPlanChangedEvent.java index 0ea80289a9..266ec307dc 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionPlanChangedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionPlanChangedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.plan_changed} session event. + * Session event "session.plan_changed". Plan file operation details indicating what changed * * @since 1.0.0 */ @@ -36,29 +36,7 @@ public final class SessionPlanChangedEvent extends SessionEvent { @JsonInclude(JsonInclude.Include.NON_NULL) public record SessionPlanChangedEventData( /** The type of operation performed on the plan file */ - @JsonProperty("operation") SessionPlanChangedEventDataOperation operation + @JsonProperty("operation") PlanChangedOperation operation ) { - - /** The type of operation performed on the plan file */ - public enum SessionPlanChangedEventDataOperation { - /** The {@code create} variant. */ - CREATE("create"), - /** The {@code update} variant. */ - UPDATE("update"), - /** The {@code delete} variant. */ - DELETE("delete"); - - private final String value; - SessionPlanChangedEventDataOperation(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionPlanChangedEventDataOperation fromValue(String value) { - for (SessionPlanChangedEventDataOperation v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionPlanChangedEventDataOperation value: " + value); - } - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionRemoteSteerableChangedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionRemoteSteerableChangedEvent.java index ba752f4c62..5ba9423155 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionRemoteSteerableChangedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionRemoteSteerableChangedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.remote_steerable_changed} session event. + * Session event "session.remote_steerable_changed". Notifies that the session's remote steering capability has changed * * @since 1.0.0 */ @@ -35,7 +35,7 @@ public final class SessionRemoteSteerableChangedEvent extends SessionEvent { @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) public record SessionRemoteSteerableChangedEventData( - /** Whether this session now supports remote steering via Mission Control */ + /** Whether this session now supports remote steering via GitHub */ @JsonProperty("remoteSteerable") Boolean remoteSteerable ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionResumeEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionResumeEvent.java index e132a1c9f9..a5983fc2af 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionResumeEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionResumeEvent.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.resume} session event. + * Session event "session.resume". Session resume metadata including current context and event count * * @since 1.0.0 */ @@ -39,58 +39,23 @@ public record SessionResumeEventData( /** ISO 8601 timestamp when the session was resumed */ @JsonProperty("resumeTime") OffsetDateTime resumeTime, /** Total number of persisted events in the session at the time of resume */ - @JsonProperty("eventCount") Double eventCount, + @JsonProperty("eventCount") Long eventCount, /** Model currently selected at resume time */ @JsonProperty("selectedModel") String selectedModel, - /** Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh") */ + /** Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max") */ @JsonProperty("reasoningEffort") String reasoningEffort, + /** Reasoning summary mode used for model calls, if applicable (e.g. "none", "concise", "detailed") */ + @JsonProperty("reasoningSummary") ReasoningSummary reasoningSummary, /** Updated working directory and git context at resume time */ - @JsonProperty("context") SessionResumeEventDataContext context, + @JsonProperty("context") WorkingDirectoryContext context, /** Whether the session was already in use by another client at resume time */ @JsonProperty("alreadyInUse") Boolean alreadyInUse, - /** Whether this session supports remote steering via Mission Control */ - @JsonProperty("remoteSteerable") Boolean remoteSteerable + /** True when this resume attached to a session that the runtime already had running in-memory (for example, an extension joining a session another client was actively driving). False (or omitted) for cold resumes β€” the runtime had to reconstitute the session from its persisted event log. */ + @JsonProperty("sessionWasActive") Boolean sessionWasActive, + /** Whether this session supports remote steering via GitHub */ + @JsonProperty("remoteSteerable") Boolean remoteSteerable, + /** When true, tool calls and permission requests left in flight by the previous session lifetime remain pending after resume and the agentic loop awaits their results. User sends are queued behind the pending work until all such requests reach a terminal state. When false (the default), any such tool calls and permission requests are immediately marked as interrupted on resume. */ + @JsonProperty("continuePendingWork") Boolean continuePendingWork ) { - - /** Updated working directory and git context at resume time */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionResumeEventDataContext( - /** Current working directory path */ - @JsonProperty("cwd") String cwd, - /** Root directory of the git repository, resolved via git rev-parse */ - @JsonProperty("gitRoot") String gitRoot, - /** Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps) */ - @JsonProperty("repository") String repository, - /** Hosting platform type of the repository (github or ado) */ - @JsonProperty("hostType") SessionResumeEventDataContextHostType hostType, - /** Current git branch name */ - @JsonProperty("branch") String branch, - /** Head commit of current git branch at session start time */ - @JsonProperty("headCommit") String headCommit, - /** Base commit of current git branch at session start time */ - @JsonProperty("baseCommit") String baseCommit - ) { - - /** Hosting platform type of the repository (github or ado) */ - public enum SessionResumeEventDataContextHostType { - /** The {@code github} variant. */ - GITHUB("github"), - /** The {@code ado} variant. */ - ADO("ado"); - - private final String value; - SessionResumeEventDataContextHostType(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionResumeEventDataContextHostType fromValue(String value) { - for (SessionResumeEventDataContextHostType v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionResumeEventDataContextHostType value: " + value); - } - } - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionScheduleCancelledEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionScheduleCancelledEvent.java new file mode 100644 index 0000000000..2c480a7575 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionScheduleCancelledEvent.java @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Session event "session.schedule_cancelled". Scheduled prompt cancelled from the schedule manager dialog + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionScheduleCancelledEvent extends SessionEvent { + + @Override + public String getType() { return "session.schedule_cancelled"; } + + @JsonProperty("data") + private SessionScheduleCancelledEventData data; + + public SessionScheduleCancelledEventData getData() { return data; } + public void setData(SessionScheduleCancelledEventData data) { this.data = data; } + + /** Data payload for {@link SessionScheduleCancelledEvent}. */ + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record SessionScheduleCancelledEventData( + /** Id of the scheduled prompt that was cancelled */ + @JsonProperty("id") Long id + ) { + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionScheduleCreatedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionScheduleCreatedEvent.java new file mode 100644 index 0000000000..eb051a0142 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionScheduleCreatedEvent.java @@ -0,0 +1,50 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Session event "session.schedule_created". Scheduled prompt registered via /every or /after + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionScheduleCreatedEvent extends SessionEvent { + + @Override + public String getType() { return "session.schedule_created"; } + + @JsonProperty("data") + private SessionScheduleCreatedEventData data; + + public SessionScheduleCreatedEventData getData() { return data; } + public void setData(SessionScheduleCreatedEventData data) { this.data = data; } + + /** Data payload for {@link SessionScheduleCreatedEvent}. */ + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record SessionScheduleCreatedEventData( + /** Sequential id assigned to the scheduled prompt within the session */ + @JsonProperty("id") Long id, + /** Interval between ticks in milliseconds */ + @JsonProperty("intervalMs") Long intervalMs, + /** Prompt text that gets enqueued on every tick */ + @JsonProperty("prompt") String prompt, + /** Whether the schedule re-arms after each tick (`/every`) or fires once (`/after`) */ + @JsonProperty("recurring") Boolean recurring, + /** Optional user-facing label shown in the timeline instead of the actual prompt (e.g. `/skill-name args` when the prompt is a skill invocation expansion) */ + @JsonProperty("displayPrompt") String displayPrompt + ) { + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionShutdownEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionShutdownEvent.java index 929d7eb797..e9d3c44323 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionShutdownEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionShutdownEvent.java @@ -10,12 +10,11 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; import java.util.Map; import javax.annotation.processing.Generated; /** - * The {@code session.shutdown} session event. + * Session event "session.shutdown". Session termination metrics including usage statistics, code changes, and shutdown reason * * @since 1.0.0 */ @@ -38,100 +37,33 @@ public final class SessionShutdownEvent extends SessionEvent { @JsonInclude(JsonInclude.Include.NON_NULL) public record SessionShutdownEventData( /** Whether the session ended normally ("routine") or due to a crash/fatal error ("error") */ - @JsonProperty("shutdownType") SessionShutdownEventDataShutdownType shutdownType, + @JsonProperty("shutdownType") ShutdownType shutdownType, /** Error description when shutdownType is "error" */ @JsonProperty("errorReason") String errorReason, /** Total number of premium API requests used during the session */ @JsonProperty("totalPremiumRequests") Double totalPremiumRequests, + /** Session-wide accumulated nano-AI units cost */ + @JsonProperty("totalNanoAiu") Double totalNanoAiu, + /** Session-wide per-token-type accumulated token counts */ + @JsonProperty("tokenDetails") Map tokenDetails, /** Cumulative time spent in API calls during the session, in milliseconds */ - @JsonProperty("totalApiDurationMs") Double totalApiDurationMs, + @JsonProperty("totalApiDurationMs") Long totalApiDurationMs, /** Unix timestamp (milliseconds) when the session started */ - @JsonProperty("sessionStartTime") Double sessionStartTime, + @JsonProperty("sessionStartTime") Long sessionStartTime, /** Aggregate code change metrics for the session */ - @JsonProperty("codeChanges") SessionShutdownEventDataCodeChanges codeChanges, + @JsonProperty("codeChanges") ShutdownCodeChanges codeChanges, /** Per-model usage breakdown, keyed by model identifier */ - @JsonProperty("modelMetrics") Map modelMetrics, + @JsonProperty("modelMetrics") Map modelMetrics, /** Model that was selected at the time of shutdown */ @JsonProperty("currentModel") String currentModel, /** Total tokens in context window at shutdown */ - @JsonProperty("currentTokens") Double currentTokens, + @JsonProperty("currentTokens") Long currentTokens, /** System message token count at shutdown */ - @JsonProperty("systemTokens") Double systemTokens, + @JsonProperty("systemTokens") Long systemTokens, /** Non-system message token count at shutdown */ - @JsonProperty("conversationTokens") Double conversationTokens, + @JsonProperty("conversationTokens") Long conversationTokens, /** Tool definitions token count at shutdown */ - @JsonProperty("toolDefinitionsTokens") Double toolDefinitionsTokens + @JsonProperty("toolDefinitionsTokens") Long toolDefinitionsTokens ) { - - /** Whether the session ended normally ("routine") or due to a crash/fatal error ("error") */ - public enum SessionShutdownEventDataShutdownType { - /** The {@code routine} variant. */ - ROUTINE("routine"), - /** The {@code error} variant. */ - ERROR("error"); - - private final String value; - SessionShutdownEventDataShutdownType(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionShutdownEventDataShutdownType fromValue(String value) { - for (SessionShutdownEventDataShutdownType v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionShutdownEventDataShutdownType value: " + value); - } - } - - /** Aggregate code change metrics for the session */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionShutdownEventDataCodeChanges( - /** Total number of lines added during the session */ - @JsonProperty("linesAdded") Double linesAdded, - /** Total number of lines removed during the session */ - @JsonProperty("linesRemoved") Double linesRemoved, - /** List of file paths that were modified during the session */ - @JsonProperty("filesModified") List filesModified - ) { - } - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionShutdownEventDataModelMetricsValue( - /** Request count and cost metrics */ - @JsonProperty("requests") SessionShutdownEventDataModelMetricsValueRequests requests, - /** Token usage breakdown */ - @JsonProperty("usage") SessionShutdownEventDataModelMetricsValueUsage usage - ) { - - /** Request count and cost metrics */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionShutdownEventDataModelMetricsValueRequests( - /** Total number of API requests made to this model */ - @JsonProperty("count") Double count, - /** Cumulative cost multiplier for requests to this model */ - @JsonProperty("cost") Double cost - ) { - } - - /** Token usage breakdown */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionShutdownEventDataModelMetricsValueUsage( - /** Total input tokens consumed across all requests to this model */ - @JsonProperty("inputTokens") Double inputTokens, - /** Total output tokens produced across all requests to this model */ - @JsonProperty("outputTokens") Double outputTokens, - /** Total tokens read from prompt cache across all requests */ - @JsonProperty("cacheReadTokens") Double cacheReadTokens, - /** Total tokens written to prompt cache across all requests */ - @JsonProperty("cacheWriteTokens") Double cacheWriteTokens, - /** Total reasoning tokens produced across all requests to this model */ - @JsonProperty("reasoningTokens") Double reasoningTokens - ) { - } - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionSkillsLoadedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionSkillsLoadedEvent.java index e1a2857cd8..c429125bf8 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionSkillsLoadedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionSkillsLoadedEvent.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.skills_loaded} session event. + * Session event "session.skills_loaded". * * @since 1.0.0 */ @@ -37,25 +37,7 @@ public final class SessionSkillsLoadedEvent extends SessionEvent { @JsonInclude(JsonInclude.Include.NON_NULL) public record SessionSkillsLoadedEventData( /** Array of resolved skill metadata */ - @JsonProperty("skills") List skills + @JsonProperty("skills") List skills ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionSkillsLoadedEventDataSkillsItem( - /** Unique identifier for the skill */ - @JsonProperty("name") String name, - /** Description of what the skill does */ - @JsonProperty("description") String description, - /** Source location type of the skill (e.g., project, personal, plugin) */ - @JsonProperty("source") String source, - /** Whether the skill can be invoked by the user as a slash command */ - @JsonProperty("userInvocable") Boolean userInvocable, - /** Whether the skill is currently enabled */ - @JsonProperty("enabled") Boolean enabled, - /** Absolute path to the skill file, if available */ - @JsonProperty("path") String path - ) { - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionSnapshotRewindEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionSnapshotRewindEvent.java index 8842827fbc..b121fdff3a 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionSnapshotRewindEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionSnapshotRewindEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.snapshot_rewind} session event. + * Session event "session.snapshot_rewind". Session rewind details including target event and count of removed events * * @since 1.0.0 */ @@ -38,7 +38,7 @@ public record SessionSnapshotRewindEventData( /** Event ID that was rewound to; this event and all after it were removed */ @JsonProperty("upToEventId") String upToEventId, /** Number of events that were removed by the rewind */ - @JsonProperty("eventsRemoved") Double eventsRemoved + @JsonProperty("eventsRemoved") Long eventsRemoved ) { } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionStartEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionStartEvent.java index 2db2d3fe7e..0143908f5f 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionStartEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionStartEvent.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.start} session event. + * Session event "session.start". Session initialization metadata including context and configuration * * @since 1.0.0 */ @@ -39,7 +39,7 @@ public record SessionStartEventData( /** Unique identifier for the session */ @JsonProperty("sessionId") String sessionId, /** Schema version number for the session event format */ - @JsonProperty("version") Double version, + @JsonProperty("version") Long version, /** Identifier of the software producing the events (e.g., "copilot-agent") */ @JsonProperty("producer") String producer, /** Version string of the Copilot application */ @@ -48,55 +48,18 @@ public record SessionStartEventData( @JsonProperty("startTime") OffsetDateTime startTime, /** Model selected at session creation time, if any */ @JsonProperty("selectedModel") String selectedModel, - /** Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh") */ + /** Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max") */ @JsonProperty("reasoningEffort") String reasoningEffort, + /** Reasoning summary mode used for model calls, if applicable (e.g. "none", "concise", "detailed") */ + @JsonProperty("reasoningSummary") ReasoningSummary reasoningSummary, /** Working directory and git context at session start */ - @JsonProperty("context") SessionStartEventDataContext context, + @JsonProperty("context") WorkingDirectoryContext context, /** Whether the session was already in use by another client at start time */ @JsonProperty("alreadyInUse") Boolean alreadyInUse, - /** Whether this session supports remote steering via Mission Control */ - @JsonProperty("remoteSteerable") Boolean remoteSteerable + /** Whether this session supports remote steering via GitHub */ + @JsonProperty("remoteSteerable") Boolean remoteSteerable, + /** When set, identifies a parent session whose context this session continues β€” e.g., a detached headless rem-agent run launched on the parent's interactive shutdown. Telemetry from this session is reported under the parent's session_id. */ + @JsonProperty("detachedFromSpawningParentSessionId") String detachedFromSpawningParentSessionId ) { - - /** Working directory and git context at session start */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionStartEventDataContext( - /** Current working directory path */ - @JsonProperty("cwd") String cwd, - /** Root directory of the git repository, resolved via git rev-parse */ - @JsonProperty("gitRoot") String gitRoot, - /** Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps) */ - @JsonProperty("repository") String repository, - /** Hosting platform type of the repository (github or ado) */ - @JsonProperty("hostType") SessionStartEventDataContextHostType hostType, - /** Current git branch name */ - @JsonProperty("branch") String branch, - /** Head commit of current git branch at session start time */ - @JsonProperty("headCommit") String headCommit, - /** Base commit of current git branch at session start time */ - @JsonProperty("baseCommit") String baseCommit - ) { - - /** Hosting platform type of the repository (github or ado) */ - public enum SessionStartEventDataContextHostType { - /** The {@code github} variant. */ - GITHUB("github"), - /** The {@code ado} variant. */ - ADO("ado"); - - private final String value; - SessionStartEventDataContextHostType(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionStartEventDataContextHostType fromValue(String value) { - for (SessionStartEventDataContextHostType v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionStartEventDataContextHostType value: " + value); - } - } - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionTaskCompleteEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionTaskCompleteEvent.java index 1af7e699bf..f114ff82b3 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionTaskCompleteEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionTaskCompleteEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.task_complete} session event. + * Session event "session.task_complete". Task completion notification with summary from the agent * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionTitleChangedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionTitleChangedEvent.java index 3093301883..4d6086bf3e 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionTitleChangedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionTitleChangedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.title_changed} session event. + * Session event "session.title_changed". Session title change payload containing the new display title * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionToolsUpdatedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionToolsUpdatedEvent.java index a3b5313cf7..0cb8614c7a 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionToolsUpdatedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionToolsUpdatedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.tools_updated} session event. + * Session event "session.tools_updated". * * @since 1.0.0 */ @@ -35,6 +35,7 @@ public final class SessionToolsUpdatedEvent extends SessionEvent { @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) public record SessionToolsUpdatedEventData( + /** Identifier of the model the resolved tools apply to. */ @JsonProperty("model") String model ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionTruncationEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionTruncationEvent.java index 103d1d0173..60e7134e69 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionTruncationEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionTruncationEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.truncation} session event. + * Session event "session.truncation". Conversation truncation statistics including token counts and removed content metrics * * @since 1.0.0 */ @@ -36,19 +36,19 @@ public final class SessionTruncationEvent extends SessionEvent { @JsonInclude(JsonInclude.Include.NON_NULL) public record SessionTruncationEventData( /** Maximum token count for the model's context window */ - @JsonProperty("tokenLimit") Double tokenLimit, + @JsonProperty("tokenLimit") Long tokenLimit, /** Total tokens in conversation messages before truncation */ - @JsonProperty("preTruncationTokensInMessages") Double preTruncationTokensInMessages, + @JsonProperty("preTruncationTokensInMessages") Long preTruncationTokensInMessages, /** Number of conversation messages before truncation */ - @JsonProperty("preTruncationMessagesLength") Double preTruncationMessagesLength, + @JsonProperty("preTruncationMessagesLength") Long preTruncationMessagesLength, /** Total tokens in conversation messages after truncation */ - @JsonProperty("postTruncationTokensInMessages") Double postTruncationTokensInMessages, + @JsonProperty("postTruncationTokensInMessages") Long postTruncationTokensInMessages, /** Number of conversation messages after truncation */ - @JsonProperty("postTruncationMessagesLength") Double postTruncationMessagesLength, + @JsonProperty("postTruncationMessagesLength") Long postTruncationMessagesLength, /** Number of tokens removed by truncation */ - @JsonProperty("tokensRemovedDuringTruncation") Double tokensRemovedDuringTruncation, + @JsonProperty("tokensRemovedDuringTruncation") Long tokensRemovedDuringTruncation, /** Number of messages removed by truncation */ - @JsonProperty("messagesRemovedDuringTruncation") Double messagesRemovedDuringTruncation, + @JsonProperty("messagesRemovedDuringTruncation") Long messagesRemovedDuringTruncation, /** Identifier of the component that performed truncation (e.g., "BasicTruncator") */ @JsonProperty("performedBy") String performedBy ) { diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionUsageInfoEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionUsageInfoEvent.java index f83c360246..84d73703a5 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionUsageInfoEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionUsageInfoEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.usage_info} session event. + * Session event "session.usage_info". Current context window usage statistics including token and message counts * * @since 1.0.0 */ @@ -36,17 +36,17 @@ public final class SessionUsageInfoEvent extends SessionEvent { @JsonInclude(JsonInclude.Include.NON_NULL) public record SessionUsageInfoEventData( /** Maximum token count for the model's context window */ - @JsonProperty("tokenLimit") Double tokenLimit, + @JsonProperty("tokenLimit") Long tokenLimit, /** Current number of tokens in the context window */ - @JsonProperty("currentTokens") Double currentTokens, + @JsonProperty("currentTokens") Long currentTokens, /** Current number of messages in the conversation */ - @JsonProperty("messagesLength") Double messagesLength, + @JsonProperty("messagesLength") Long messagesLength, /** Token count from system message(s) */ - @JsonProperty("systemTokens") Double systemTokens, + @JsonProperty("systemTokens") Long systemTokens, /** Token count from non-system messages (user, assistant, tool) */ - @JsonProperty("conversationTokens") Double conversationTokens, + @JsonProperty("conversationTokens") Long conversationTokens, /** Token count from tool definitions */ - @JsonProperty("toolDefinitionsTokens") Double toolDefinitionsTokens, + @JsonProperty("toolDefinitionsTokens") Long toolDefinitionsTokens, /** Whether this is the first usage_info event emitted in this session */ @JsonProperty("isInitial") Boolean isInitial ) { diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionWarningEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionWarningEvent.java index 1870a26e8a..fc0a0778e6 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionWarningEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionWarningEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.warning} session event. + * Session event "session.warning". Warning message for timeline display with categorization * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionWorkspaceFileChangedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionWorkspaceFileChangedEvent.java index ea2245adfa..ba9032664d 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionWorkspaceFileChangedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionWorkspaceFileChangedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code session.workspace_file_changed} session event. + * Session event "session.workspace_file_changed". Workspace file change details including path and operation type * * @since 1.0.0 */ @@ -38,27 +38,7 @@ public record SessionWorkspaceFileChangedEventData( /** Relative path within the session workspace files directory */ @JsonProperty("path") String path, /** Whether the file was newly created or updated */ - @JsonProperty("operation") SessionWorkspaceFileChangedEventDataOperation operation + @JsonProperty("operation") WorkspaceFileChangedOperation operation ) { - - /** Whether the file was newly created or updated */ - public enum SessionWorkspaceFileChangedEventDataOperation { - /** The {@code create} variant. */ - CREATE("create"), - /** The {@code update} variant. */ - UPDATE("update"); - - private final String value; - SessionWorkspaceFileChangedEventDataOperation(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionWorkspaceFileChangedEventDataOperation fromValue(String value) { - for (SessionWorkspaceFileChangedEventDataOperation v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionWorkspaceFileChangedEventDataOperation value: " + value); - } - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/ShutdownCodeChanges.java b/src/generated/java/com/github/copilot/sdk/generated/ShutdownCodeChanges.java new file mode 100644 index 0000000000..9512573bdb --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ShutdownCodeChanges.java @@ -0,0 +1,32 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Aggregate code change metrics for the session + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ShutdownCodeChanges( + /** Total number of lines added during the session */ + @JsonProperty("linesAdded") Long linesAdded, + /** Total number of lines removed during the session */ + @JsonProperty("linesRemoved") Long linesRemoved, + /** List of file paths that were modified during the session */ + @JsonProperty("filesModified") List filesModified +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ShutdownModelMetric.java b/src/generated/java/com/github/copilot/sdk/generated/ShutdownModelMetric.java new file mode 100644 index 0000000000..bc7d41d8b3 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ShutdownModelMetric.java @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import javax.annotation.processing.Generated; + +/** + * Schema for the `ShutdownModelMetric` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ShutdownModelMetric( + /** Request count and cost metrics */ + @JsonProperty("requests") ShutdownModelMetricRequests requests, + /** Token usage breakdown */ + @JsonProperty("usage") ShutdownModelMetricUsage usage, + /** Accumulated nano-AI units cost for this model */ + @JsonProperty("totalNanoAiu") Double totalNanoAiu, + /** Token count details per type */ + @JsonProperty("tokenDetails") Map tokenDetails +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ShutdownModelMetricRequests.java b/src/generated/java/com/github/copilot/sdk/generated/ShutdownModelMetricRequests.java new file mode 100644 index 0000000000..901d2a3e73 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ShutdownModelMetricRequests.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Request count and cost metrics + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ShutdownModelMetricRequests( + /** Total number of API requests made to this model */ + @JsonProperty("count") Long count, + /** Cumulative cost multiplier for requests to this model */ + @JsonProperty("cost") Double cost +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ShutdownModelMetricTokenDetail.java b/src/generated/java/com/github/copilot/sdk/generated/ShutdownModelMetricTokenDetail.java new file mode 100644 index 0000000000..f179898a3d --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ShutdownModelMetricTokenDetail.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `ShutdownModelMetricTokenDetail` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ShutdownModelMetricTokenDetail( + /** Accumulated token count for this token type */ + @JsonProperty("tokenCount") Long tokenCount +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ShutdownModelMetricUsage.java b/src/generated/java/com/github/copilot/sdk/generated/ShutdownModelMetricUsage.java new file mode 100644 index 0000000000..a2301664bd --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ShutdownModelMetricUsage.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Token usage breakdown + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ShutdownModelMetricUsage( + /** Total input tokens consumed across all requests to this model */ + @JsonProperty("inputTokens") Long inputTokens, + /** Total output tokens produced across all requests to this model */ + @JsonProperty("outputTokens") Long outputTokens, + /** Total tokens read from prompt cache across all requests */ + @JsonProperty("cacheReadTokens") Long cacheReadTokens, + /** Total tokens written to prompt cache across all requests */ + @JsonProperty("cacheWriteTokens") Long cacheWriteTokens, + /** Total reasoning tokens produced across all requests to this model */ + @JsonProperty("reasoningTokens") Long reasoningTokens +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ShutdownTokenDetail.java b/src/generated/java/com/github/copilot/sdk/generated/ShutdownTokenDetail.java new file mode 100644 index 0000000000..856e4d2f68 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ShutdownTokenDetail.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `ShutdownTokenDetail` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ShutdownTokenDetail( + /** Accumulated token count for this token type */ + @JsonProperty("tokenCount") Long tokenCount +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ShutdownType.java b/src/generated/java/com/github/copilot/sdk/generated/ShutdownType.java new file mode 100644 index 0000000000..fbc627df8f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ShutdownType.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * Whether the session ended normally ("routine") or due to a crash/fatal error ("error") + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ShutdownType { + /** The {@code routine} variant. */ + ROUTINE("routine"), + /** The {@code error} variant. */ + ERROR("error"); + + private final String value; + ShutdownType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ShutdownType fromValue(String value) { + for (ShutdownType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ShutdownType value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/SkillInvokedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SkillInvokedEvent.java index e6c696eb0b..6aa2385443 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SkillInvokedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SkillInvokedEvent.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * The {@code skill.invoked} session event. + * Session event "skill.invoked". Skill invocation details including content, allowed tools, and plugin metadata * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/SkillSource.java b/src/generated/java/com/github/copilot/sdk/generated/SkillSource.java new file mode 100644 index 0000000000..9951c1da93 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/SkillSource.java @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * Source location type (e.g., project, personal-copilot, plugin, builtin) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SkillSource { + /** The {@code project} variant. */ + PROJECT("project"), + /** The {@code inherited} variant. */ + INHERITED("inherited"), + /** The {@code personal-copilot} variant. */ + PERSONAL_COPILOT("personal-copilot"), + /** The {@code personal-agents} variant. */ + PERSONAL_AGENTS("personal-agents"), + /** The {@code plugin} variant. */ + PLUGIN("plugin"), + /** The {@code custom} variant. */ + CUSTOM("custom"), + /** The {@code builtin} variant. */ + BUILTIN("builtin"); + + private final String value; + SkillSource(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SkillSource fromValue(String value) { + for (SkillSource v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SkillSource value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/SkillsLoadedSkill.java b/src/generated/java/com/github/copilot/sdk/generated/SkillsLoadedSkill.java new file mode 100644 index 0000000000..21f0dc0f45 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/SkillsLoadedSkill.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `SkillsLoadedSkill` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SkillsLoadedSkill( + /** Unique identifier for the skill */ + @JsonProperty("name") String name, + /** Description of what the skill does */ + @JsonProperty("description") String description, + /** Source location type (e.g., project, personal-copilot, plugin, builtin) */ + @JsonProperty("source") SkillSource source, + /** Whether the skill can be invoked by the user as a slash command */ + @JsonProperty("userInvocable") Boolean userInvocable, + /** Whether the skill is currently enabled */ + @JsonProperty("enabled") Boolean enabled, + /** Absolute path to the skill file, if available */ + @JsonProperty("path") String path +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/SubagentCompletedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SubagentCompletedEvent.java index b2cce20c31..45bdade9a9 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SubagentCompletedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SubagentCompletedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code subagent.completed} session event. + * Session event "subagent.completed". Sub-agent completion details for successful execution * * @since 1.0.0 */ @@ -44,11 +44,11 @@ public record SubagentCompletedEventData( /** Model used by the sub-agent */ @JsonProperty("model") String model, /** Total number of tool calls made by the sub-agent */ - @JsonProperty("totalToolCalls") Double totalToolCalls, + @JsonProperty("totalToolCalls") Long totalToolCalls, /** Total tokens (input + output) consumed by the sub-agent */ - @JsonProperty("totalTokens") Double totalTokens, + @JsonProperty("totalTokens") Long totalTokens, /** Wall-clock duration of the sub-agent execution in milliseconds */ - @JsonProperty("durationMs") Double durationMs + @JsonProperty("durationMs") Long durationMs ) { } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SubagentDeselectedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SubagentDeselectedEvent.java index 3db9429dbf..391df6d49a 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SubagentDeselectedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SubagentDeselectedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code subagent.deselected} session event. + * Session event "subagent.deselected". Empty payload; the event signals that the custom agent was deselected, returning to the default agent * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/SubagentFailedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SubagentFailedEvent.java index 490532fc38..3437e93baa 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SubagentFailedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SubagentFailedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code subagent.failed} session event. + * Session event "subagent.failed". Sub-agent failure details including error message and agent information * * @since 1.0.0 */ @@ -46,11 +46,11 @@ public record SubagentFailedEventData( /** Model used by the sub-agent (if any model calls succeeded before failure) */ @JsonProperty("model") String model, /** Total number of tool calls made before the sub-agent failed */ - @JsonProperty("totalToolCalls") Double totalToolCalls, + @JsonProperty("totalToolCalls") Long totalToolCalls, /** Total tokens (input + output) consumed before the sub-agent failed */ - @JsonProperty("totalTokens") Double totalTokens, + @JsonProperty("totalTokens") Long totalTokens, /** Wall-clock duration of the sub-agent execution in milliseconds */ - @JsonProperty("durationMs") Double durationMs + @JsonProperty("durationMs") Long durationMs ) { } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SubagentSelectedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SubagentSelectedEvent.java index e910bc9c27..b342e4230c 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SubagentSelectedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SubagentSelectedEvent.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * The {@code subagent.selected} session event. + * Session event "subagent.selected". Custom agent selection details including name and available tools * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/SubagentStartedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SubagentStartedEvent.java index 6e9926bd4e..737d773f12 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SubagentStartedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SubagentStartedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code subagent.started} session event. + * Session event "subagent.started". Sub-agent startup details including parent tool call and agent information * * @since 1.0.0 */ @@ -42,7 +42,9 @@ public record SubagentStartedEventData( /** Human-readable display name of the sub-agent */ @JsonProperty("agentDisplayName") String agentDisplayName, /** Description of what the sub-agent does */ - @JsonProperty("agentDescription") String agentDescription + @JsonProperty("agentDescription") String agentDescription, + /** Model the sub-agent will run with, when known at start. Surfaced in the timeline for auto-selected sub-agents (e.g. rubber-duck). */ + @JsonProperty("model") String model ) { } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SystemMessageEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SystemMessageEvent.java index 8df24f3a6b..82976c0044 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SystemMessageEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SystemMessageEvent.java @@ -10,11 +10,10 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Map; import javax.annotation.processing.Generated; /** - * The {@code system.message} session event. + * Session event "system.message". System/developer instruction content with role and optional template metadata * * @since 1.0.0 */ @@ -36,45 +35,14 @@ public final class SystemMessageEvent extends SessionEvent { @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) public record SystemMessageEventData( - /** The system or developer prompt text */ + /** The system or developer prompt text sent as model input */ @JsonProperty("content") String content, /** Message role: "system" for system prompts, "developer" for developer-injected instructions */ - @JsonProperty("role") SystemMessageEventDataRole role, + @JsonProperty("role") SystemMessageRole role, /** Optional name identifier for the message source */ @JsonProperty("name") String name, /** Metadata about the prompt template and its construction */ - @JsonProperty("metadata") SystemMessageEventDataMetadata metadata + @JsonProperty("metadata") SystemMessageMetadata metadata ) { - - /** Message role: "system" for system prompts, "developer" for developer-injected instructions */ - public enum SystemMessageEventDataRole { - /** The {@code system} variant. */ - SYSTEM("system"), - /** The {@code developer} variant. */ - DEVELOPER("developer"); - - private final String value; - SystemMessageEventDataRole(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SystemMessageEventDataRole fromValue(String value) { - for (SystemMessageEventDataRole v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SystemMessageEventDataRole value: " + value); - } - } - - /** Metadata about the prompt template and its construction */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SystemMessageEventDataMetadata( - /** Version identifier of the prompt template used */ - @JsonProperty("promptVersion") String promptVersion, - /** Template variables used when constructing the prompt */ - @JsonProperty("variables") Map variables - ) { - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/SystemMessageMetadata.java b/src/generated/java/com/github/copilot/sdk/generated/SystemMessageMetadata.java new file mode 100644 index 0000000000..2b054dc943 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/SystemMessageMetadata.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import javax.annotation.processing.Generated; + +/** + * Metadata about the prompt template and its construction + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SystemMessageMetadata( + /** Version identifier of the prompt template used */ + @JsonProperty("promptVersion") String promptVersion, + /** Template variables used when constructing the prompt */ + @JsonProperty("variables") Map variables +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/SystemMessageRole.java b/src/generated/java/com/github/copilot/sdk/generated/SystemMessageRole.java new file mode 100644 index 0000000000..921b69ec06 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/SystemMessageRole.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * Message role: "system" for system prompts, "developer" for developer-injected instructions + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SystemMessageRole { + /** The {@code system} variant. */ + SYSTEM("system"), + /** The {@code developer} variant. */ + DEVELOPER("developer"); + + private final String value; + SystemMessageRole(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SystemMessageRole fromValue(String value) { + for (SystemMessageRole v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SystemMessageRole value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/SystemNotificationEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SystemNotificationEvent.java index 877b3db984..ba11910e03 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SystemNotificationEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SystemNotificationEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code system.notification} session event. + * Session event "system.notification". System-generated notification for runtime events like background task completion * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionCompleteError.java b/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionCompleteError.java new file mode 100644 index 0000000000..dbdc99ba7e --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionCompleteError.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Error details when the tool execution failed + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ToolExecutionCompleteError( + /** Human-readable error message */ + @JsonProperty("message") String message, + /** Machine-readable error code */ + @JsonProperty("code") String code +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionCompleteEvent.java b/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionCompleteEvent.java index 41ca020ff5..8d1c1c5c25 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionCompleteEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionCompleteEvent.java @@ -10,12 +10,11 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; import java.util.Map; import javax.annotation.processing.Generated; /** - * The {@code tool.execution_complete} session event. + * Session event "tool.execution_complete". Tool execution completion results including success status, detailed output, and error information * * @since 1.0.0 */ @@ -48,37 +47,17 @@ public record ToolExecutionCompleteEventData( /** Whether this tool call was explicitly requested by the user rather than the assistant */ @JsonProperty("isUserRequested") Boolean isUserRequested, /** Tool execution result on success */ - @JsonProperty("result") ToolExecutionCompleteEventDataResult result, + @JsonProperty("result") ToolExecutionCompleteResult result, /** Error details when the tool execution failed */ - @JsonProperty("error") ToolExecutionCompleteEventDataError error, + @JsonProperty("error") ToolExecutionCompleteError error, /** Tool-specific telemetry data (e.g., CodeQL check counts, grep match counts) */ @JsonProperty("toolTelemetry") Map toolTelemetry, + /** Identifier for the agent loop turn this tool was invoked in, matching the corresponding assistant.turn_start event */ + @JsonProperty("turnId") String turnId, + /** Whether this tool execution ran inside a sandbox container */ + @JsonProperty("sandboxed") Boolean sandboxed, /** Tool call ID of the parent tool invocation when this event originates from a sub-agent */ @JsonProperty("parentToolCallId") String parentToolCallId ) { - - /** Tool execution result on success */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record ToolExecutionCompleteEventDataResult( - /** Concise tool result text sent to the LLM for chat completion, potentially truncated for token efficiency */ - @JsonProperty("content") String content, - /** Full detailed tool result for UI/timeline display, preserving complete content such as diffs. Falls back to content when absent. */ - @JsonProperty("detailedContent") String detailedContent, - /** Structured content blocks (text, images, audio, resources) returned by the tool in their native format */ - @JsonProperty("contents") List contents - ) { - } - - /** Error details when the tool execution failed */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record ToolExecutionCompleteEventDataError( - /** Human-readable error message */ - @JsonProperty("message") String message, - /** Machine-readable error code */ - @JsonProperty("code") String code - ) { - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionCompleteResult.java b/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionCompleteResult.java new file mode 100644 index 0000000000..8f2830541f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionCompleteResult.java @@ -0,0 +1,32 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Tool execution result on success + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ToolExecutionCompleteResult( + /** Concise tool result text sent to the LLM for chat completion, potentially truncated for token efficiency */ + @JsonProperty("content") String content, + /** Full detailed tool result for UI/timeline display, preserving complete content such as diffs. Falls back to content when absent. */ + @JsonProperty("detailedContent") String detailedContent, + /** Structured content blocks (text, images, audio, resources) returned by the tool in their native format */ + @JsonProperty("contents") List contents +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionPartialResultEvent.java b/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionPartialResultEvent.java index 5fbddc5cca..e548cc1b03 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionPartialResultEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionPartialResultEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code tool.execution_partial_result} session event. + * Session event "tool.execution_partial_result". Streaming tool execution output for incremental result display * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionProgressEvent.java b/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionProgressEvent.java index 2a77c05ffe..d2b20312a3 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionProgressEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionProgressEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code tool.execution_progress} session event. + * Session event "tool.execution_progress". Tool execution progress notification with status message * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionStartEvent.java b/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionStartEvent.java index 7da7572864..a98f7dec3d 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionStartEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionStartEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code tool.execution_start} session event. + * Session event "tool.execution_start". Tool execution startup details including MCP server information when applicable * * @since 1.0.0 */ @@ -45,6 +45,8 @@ public record ToolExecutionStartEventData( @JsonProperty("mcpServerName") String mcpServerName, /** Original tool name on the MCP server, when the tool is an MCP tool */ @JsonProperty("mcpToolName") String mcpToolName, + /** Identifier for the agent loop turn this tool was invoked in, matching the corresponding assistant.turn_start event */ + @JsonProperty("turnId") String turnId, /** Tool call ID of the parent tool invocation when this event originates from a sub-agent */ @JsonProperty("parentToolCallId") String parentToolCallId ) { diff --git a/src/generated/java/com/github/copilot/sdk/generated/ToolUserRequestedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/ToolUserRequestedEvent.java index ac798fd3f3..ffd69535dd 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/ToolUserRequestedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/ToolUserRequestedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code tool.user_requested} session event. + * Session event "tool.user_requested". User-initiated tool invocation request with tool name and arguments * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/UserInputCompletedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/UserInputCompletedEvent.java index 7b69bfd926..66883aa629 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/UserInputCompletedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/UserInputCompletedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * The {@code user_input.completed} session event. + * Session event "user_input.completed". User input request completion with the user's response * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/UserInputRequestedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/UserInputRequestedEvent.java index 69581e20a2..bb903191b3 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/UserInputRequestedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/UserInputRequestedEvent.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * The {@code user_input.requested} session event. + * Session event "user_input.requested". User input request notification with question and optional predefined choices * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/UserMessageAgentMode.java b/src/generated/java/com/github/copilot/sdk/generated/UserMessageAgentMode.java new file mode 100644 index 0000000000..6c1710602d --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/UserMessageAgentMode.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * The agent mode that was active when this message was sent + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum UserMessageAgentMode { + /** The {@code interactive} variant. */ + INTERACTIVE("interactive"), + /** The {@code plan} variant. */ + PLAN("plan"), + /** The {@code autopilot} variant. */ + AUTOPILOT("autopilot"), + /** The {@code shell} variant. */ + SHELL("shell"); + + private final String value; + UserMessageAgentMode(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static UserMessageAgentMode fromValue(String value) { + for (UserMessageAgentMode v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown UserMessageAgentMode value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/UserMessageEvent.java b/src/generated/java/com/github/copilot/sdk/generated/UserMessageEvent.java index e3efe40884..0e0de5dd2e 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/UserMessageEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/UserMessageEvent.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * The {@code user.message} session event. + * Session event "user.message". * * @since 1.0.0 */ @@ -42,36 +42,20 @@ public record UserMessageEventData( @JsonProperty("transformedContent") String transformedContent, /** Files, selections, or GitHub references attached to the message */ @JsonProperty("attachments") List attachments, + /** Normalized document MIME types that were sent natively instead of through tagged_files XML */ + @JsonProperty("supportedNativeDocumentMimeTypes") List supportedNativeDocumentMimeTypes, + /** Path-backed native document attachments that stayed on the tagged_files path flow because native upload could not read them or would exceed the request size limit */ + @JsonProperty("nativeDocumentPathFallbackPaths") List nativeDocumentPathFallbackPaths, /** Origin of this message, used for timeline filtering (e.g., "skill-pdf" for skill-injected messages that should be hidden from the user) */ @JsonProperty("source") String source, /** The agent mode that was active when this message was sent */ - @JsonProperty("agentMode") UserMessageEventDataAgentMode agentMode, + @JsonProperty("agentMode") UserMessageAgentMode agentMode, + /** True when this user message was auto-injected by autopilot's continuation loop rather than typed by the user; used to distinguish autopilot-driven turns in telemetry. */ + @JsonProperty("isAutopilotContinuation") Boolean isAutopilotContinuation, /** CAPI interaction ID for correlating this user message with its turn */ - @JsonProperty("interactionId") String interactionId + @JsonProperty("interactionId") String interactionId, + /** Parent agent task ID for background telemetry correlated to this user turn */ + @JsonProperty("parentAgentTaskId") String parentAgentTaskId ) { - - /** The agent mode that was active when this message was sent */ - public enum UserMessageEventDataAgentMode { - /** The {@code interactive} variant. */ - INTERACTIVE("interactive"), - /** The {@code plan} variant. */ - PLAN("plan"), - /** The {@code autopilot} variant. */ - AUTOPILOT("autopilot"), - /** The {@code shell} variant. */ - SHELL("shell"); - - private final String value; - UserMessageEventDataAgentMode(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static UserMessageEventDataAgentMode fromValue(String value) { - for (UserMessageEventDataAgentMode v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown UserMessageEventDataAgentMode value: " + value); - } - } } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/WorkingDirectoryContext.java b/src/generated/java/com/github/copilot/sdk/generated/WorkingDirectoryContext.java new file mode 100644 index 0000000000..b023859e2f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/WorkingDirectoryContext.java @@ -0,0 +1,41 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Working directory and git context at session start + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record WorkingDirectoryContext( + /** Current working directory path */ + @JsonProperty("cwd") String cwd, + /** Root directory of the git repository, resolved via git rev-parse */ + @JsonProperty("gitRoot") String gitRoot, + /** Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps) */ + @JsonProperty("repository") String repository, + /** Hosting platform type of the repository (github or ado) */ + @JsonProperty("hostType") WorkingDirectoryContextHostType hostType, + /** Raw host string from the git remote URL (e.g. "github.com", "mycompany.ghe.com", "dev.azure.com") */ + @JsonProperty("repositoryHost") String repositoryHost, + /** Current git branch name */ + @JsonProperty("branch") String branch, + /** Head commit of current git branch at session start time */ + @JsonProperty("headCommit") String headCommit, + /** Base commit of current git branch at session start time */ + @JsonProperty("baseCommit") String baseCommit +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/WorkingDirectoryContextHostType.java b/src/generated/java/com/github/copilot/sdk/generated/WorkingDirectoryContextHostType.java new file mode 100644 index 0000000000..4786b8bc0c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/WorkingDirectoryContextHostType.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * Hosting platform type of the repository (github or ado) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum WorkingDirectoryContextHostType { + /** The {@code github} variant. */ + GITHUB("github"), + /** The {@code ado} variant. */ + ADO("ado"); + + private final String value; + WorkingDirectoryContextHostType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static WorkingDirectoryContextHostType fromValue(String value) { + for (WorkingDirectoryContextHostType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown WorkingDirectoryContextHostType value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/WorkspaceFileChangedOperation.java b/src/generated/java/com/github/copilot/sdk/generated/WorkspaceFileChangedOperation.java new file mode 100644 index 0000000000..7e21ec5484 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/WorkspaceFileChangedOperation.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * Whether the file was newly created or updated + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum WorkspaceFileChangedOperation { + /** The {@code create} variant. */ + CREATE("create"), + /** The {@code update} variant. */ + UPDATE("update"); + + private final String value; + WorkspaceFileChangedOperation(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static WorkspaceFileChangedOperation fromValue(String value) { + for (WorkspaceFileChangedOperation v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown WorkspaceFileChangedOperation value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/AbortReason.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/AbortReason.java new file mode 100644 index 0000000000..0d0302fa4a --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/AbortReason.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Finite reason code describing why the current turn was aborted + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum AbortReason { + /** The {@code user_initiated} variant. */ + USER_INITIATED("user_initiated"), + /** The {@code remote_command} variant. */ + REMOTE_COMMAND("remote_command"), + /** The {@code user_abort} variant. */ + USER_ABORT("user_abort"); + + private final String value; + AbortReason(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static AbortReason fromValue(String value) { + for (AbortReason v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown AbortReason value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/AccountGetQuotaResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/AccountGetQuotaResult.java index 29ebfa7e38..4685196234 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/AccountGetQuotaResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/AccountGetQuotaResult.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code account.getQuota} RPC method. + * Quota usage snapshots for the resolved user, keyed by quota type. * * @since 1.0.0 */ @@ -23,24 +23,6 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record AccountGetQuotaResult( /** Quota snapshots keyed by type (e.g., chat, completions, premium_interactions) */ - @JsonProperty("quotaSnapshots") Map quotaSnapshots + @JsonProperty("quotaSnapshots") Map quotaSnapshots ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record AccountGetQuotaResultQuotaSnapshotsValue( - /** Number of requests included in the entitlement */ - @JsonProperty("entitlementRequests") Double entitlementRequests, - /** Number of requests used so far this period */ - @JsonProperty("usedRequests") Double usedRequests, - /** Percentage of entitlement remaining */ - @JsonProperty("remainingPercentage") Double remainingPercentage, - /** Number of overage requests made this period */ - @JsonProperty("overage") Double overage, - /** Whether pay-per-request usage is allowed when quota is exhausted */ - @JsonProperty("overageAllowedWithExhaustedQuota") Boolean overageAllowedWithExhaustedQuota, - /** Date when the quota resets (ISO 8601) */ - @JsonProperty("resetDate") String resetDate - ) { - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/AccountQuotaSnapshot.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/AccountQuotaSnapshot.java new file mode 100644 index 0000000000..a13f011958 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/AccountQuotaSnapshot.java @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import javax.annotation.processing.Generated; + +/** + * Schema for the `AccountQuotaSnapshot` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record AccountQuotaSnapshot( + /** Whether the user has an unlimited usage entitlement */ + @JsonProperty("isUnlimitedEntitlement") Boolean isUnlimitedEntitlement, + /** Number of requests included in the entitlement, or -1 for unlimited entitlements */ + @JsonProperty("entitlementRequests") Long entitlementRequests, + /** Number of requests used so far this period */ + @JsonProperty("usedRequests") Long usedRequests, + /** Whether usage is still permitted after quota exhaustion */ + @JsonProperty("usageAllowedWithExhaustedQuota") Boolean usageAllowedWithExhaustedQuota, + /** Percentage of entitlement remaining */ + @JsonProperty("remainingPercentage") Double remainingPercentage, + /** Number of additional usage requests made this period */ + @JsonProperty("overage") Double overage, + /** Whether additional usage is allowed when quota is exhausted */ + @JsonProperty("overageAllowedWithExhaustedQuota") Boolean overageAllowedWithExhaustedQuota, + /** Date when the quota resets (ISO 8601 string) */ + @JsonProperty("resetDate") OffsetDateTime resetDate +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/AgentInfo.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/AgentInfo.java new file mode 100644 index 0000000000..df2a246225 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/AgentInfo.java @@ -0,0 +1,49 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; +import javax.annotation.processing.Generated; + +/** + * Schema for the `AgentInfo` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record AgentInfo( + /** Unique identifier of the custom agent */ + @JsonProperty("name") String name, + /** Human-readable display name */ + @JsonProperty("displayName") String displayName, + /** Description of the agent's purpose */ + @JsonProperty("description") String description, + /** Absolute local file path of the agent definition. Only set for file-based agents loaded from disk; remote agents do not have a path. */ + @JsonProperty("path") String path, + /** Stable identifier for selection. For most agents this is the same as `name`; for plugin/builtin agents it may differ. Always populated; defaults to `name` when no distinct id was assigned. */ + @JsonProperty("id") String id, + /** Where the agent definition was loaded from */ + @JsonProperty("source") AgentInfoSource source, + /** Whether the agent can be selected directly by the user. Agents marked `false` are subagent-only. */ + @JsonProperty("userInvocable") Boolean userInvocable, + /** Allowed tool names for this agent. Empty array means none; omitted means inherit defaults. */ + @JsonProperty("tools") List tools, + /** Preferred model id for this agent. When omitted, inherits the outer agent's model. */ + @JsonProperty("model") String model, + /** MCP server configurations attached to this agent, keyed by server name. Server config shape mirrors the MCP `mcpServers` schema. */ + @JsonProperty("mcpServers") Map mcpServers, + /** Skill names preloaded into this agent's context. Omitted means none. */ + @JsonProperty("skills") List skills +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/AgentInfoSource.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/AgentInfoSource.java new file mode 100644 index 0000000000..699df17877 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/AgentInfoSource.java @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Where the agent definition was loaded from + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum AgentInfoSource { + /** The {@code user} variant. */ + USER("user"), + /** The {@code project} variant. */ + PROJECT("project"), + /** The {@code inherited} variant. */ + INHERITED("inherited"), + /** The {@code remote} variant. */ + REMOTE("remote"), + /** The {@code plugin} variant. */ + PLUGIN("plugin"), + /** The {@code builtin} variant. */ + BUILTIN("builtin"); + + private final String value; + AgentInfoSource(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static AgentInfoSource fromValue(String value) { + for (AgentInfoSource v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown AgentInfoSource value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/AuthInfoType.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/AuthInfoType.java new file mode 100644 index 0000000000..89c5db85ce --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/AuthInfoType.java @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Authentication type + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum AuthInfoType { + /** The {@code hmac} variant. */ + HMAC("hmac"), + /** The {@code env} variant. */ + ENV("env"), + /** The {@code user} variant. */ + USER("user"), + /** The {@code gh-cli} variant. */ + GH_CLI("gh-cli"), + /** The {@code api-key} variant. */ + API_KEY("api-key"), + /** The {@code token} variant. */ + TOKEN("token"), + /** The {@code copilot-api-token} variant. */ + COPILOT_API_TOKEN("copilot-api-token"); + + private final String value; + AuthInfoType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static AuthInfoType fromValue(String value) { + for (AuthInfoType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown AuthInfoType value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ConnectParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ConnectParams.java new file mode 100644 index 0000000000..b22245ed93 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ConnectParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Optional connection token presented by the SDK client during the handshake. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ConnectParams( + /** Connection token; required when the server was started with COPILOT_CONNECTION_TOKEN */ + @JsonProperty("token") String token +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ConnectResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ConnectResult.java new file mode 100644 index 0000000000..f51b1a9c39 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ConnectResult.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Handshake result reporting the server's protocol version and package version on success. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ConnectResult( + /** Always true on success */ + @JsonProperty("ok") Boolean ok, + /** Server protocol version number */ + @JsonProperty("protocolVersion") Long protocolVersion, + /** Server package version */ + @JsonProperty("version") String version +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ConnectedRemoteSessionMetadata.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ConnectedRemoteSessionMetadata.java new file mode 100644 index 0000000000..006b750c17 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ConnectedRemoteSessionMetadata.java @@ -0,0 +1,48 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import javax.annotation.processing.Generated; + +/** + * Metadata for a connected remote session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ConnectedRemoteSessionMetadata( + /** SDK session ID for the connected remote session. */ + @JsonProperty("sessionId") String sessionId, + /** Optional friendly session name. */ + @JsonProperty("name") String name, + /** Optional session summary. */ + @JsonProperty("summary") String summary, + /** Session start time as an ISO 8601 string. */ + @JsonProperty("startTime") OffsetDateTime startTime, + /** Last session update time as an ISO 8601 string. */ + @JsonProperty("modifiedTime") OffsetDateTime modifiedTime, + /** Repository associated with the connected remote session. */ + @JsonProperty("repository") ConnectedRemoteSessionMetadataRepository repository, + /** Pull request number associated with the session. */ + @JsonProperty("pullRequestNumber") Long pullRequestNumber, + /** Original remote resource identifier. */ + @JsonProperty("resourceId") String resourceId, + /** Neutral SDK discriminator for the connected remote session kind. */ + @JsonProperty("kind") ConnectedRemoteSessionMetadataKind kind, + /** Remote session staleness deadline as an ISO 8601 string. */ + @JsonProperty("staleAt") OffsetDateTime staleAt, + /** Remote session state returned by the backing service. */ + @JsonProperty("state") String state +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ConnectedRemoteSessionMetadataKind.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ConnectedRemoteSessionMetadataKind.java new file mode 100644 index 0000000000..14e4e4b22a --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ConnectedRemoteSessionMetadataKind.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Neutral SDK discriminator for the connected remote session kind. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ConnectedRemoteSessionMetadataKind { + /** The {@code remote-session} variant. */ + REMOTE_SESSION("remote-session"), + /** The {@code coding-agent} variant. */ + CODING_AGENT("coding-agent"); + + private final String value; + ConnectedRemoteSessionMetadataKind(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ConnectedRemoteSessionMetadataKind fromValue(String value) { + for (ConnectedRemoteSessionMetadataKind v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ConnectedRemoteSessionMetadataKind value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ConnectedRemoteSessionMetadataRepository.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ConnectedRemoteSessionMetadataRepository.java new file mode 100644 index 0000000000..562dfba8ab --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ConnectedRemoteSessionMetadataRepository.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Repository associated with the connected remote session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ConnectedRemoteSessionMetadataRepository( + /** Repository owner or organization login. */ + @JsonProperty("owner") String owner, + /** Repository name. */ + @JsonProperty("name") String name, + /** Branch associated with the remote session. */ + @JsonProperty("branch") String branch +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/DiscoveredMcpServer.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/DiscoveredMcpServer.java new file mode 100644 index 0000000000..2cfe49334d --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/DiscoveredMcpServer.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `DiscoveredMcpServer` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record DiscoveredMcpServer( + /** Server name (config key) */ + @JsonProperty("name") String name, + /** Server transport type: stdio, http, sse, or memory */ + @JsonProperty("type") DiscoveredMcpServerType type, + /** Configuration source: user, workspace, plugin, or builtin */ + @JsonProperty("source") McpServerSource source, + /** Whether the server is enabled (not in the disabled list) */ + @JsonProperty("enabled") Boolean enabled +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/DiscoveredMcpServerSource.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/DiscoveredMcpServerSource.java new file mode 100644 index 0000000000..6bc451b349 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/DiscoveredMcpServerSource.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Configuration source + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum DiscoveredMcpServerSource { + /** The {@code user} variant. */ + USER("user"), + /** The {@code workspace} variant. */ + WORKSPACE("workspace"), + /** The {@code plugin} variant. */ + PLUGIN("plugin"), + /** The {@code builtin} variant. */ + BUILTIN("builtin"); + + private final String value; + DiscoveredMcpServerSource(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static DiscoveredMcpServerSource fromValue(String value) { + for (DiscoveredMcpServerSource v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown DiscoveredMcpServerSource value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/DiscoveredMcpServerType.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/DiscoveredMcpServerType.java new file mode 100644 index 0000000000..0d4293d9a9 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/DiscoveredMcpServerType.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Server transport type: stdio, http, sse, or memory + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum DiscoveredMcpServerType { + /** The {@code stdio} variant. */ + STDIO("stdio"), + /** The {@code http} variant. */ + HTTP("http"), + /** The {@code sse} variant. */ + SSE("sse"), + /** The {@code memory} variant. */ + MEMORY("memory"); + + private final String value; + DiscoveredMcpServerType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static DiscoveredMcpServerType fromValue(String value) { + for (DiscoveredMcpServerType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown DiscoveredMcpServerType value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/EventsAgentScope.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/EventsAgentScope.java new file mode 100644 index 0000000000..e748df0d30 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/EventsAgentScope.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Agent-scope filter: 'primary' returns only main-agent events plus events whose type starts with 'subagent.' (matching the typed-subscription default behavior); 'all' returns events from all agents (matching wildcard-subscription behavior). Default is 'all' to preserve wildcard semantics for catch-up callers. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum EventsAgentScope { + /** The {@code primary} variant. */ + PRIMARY("primary"), + /** The {@code all} variant. */ + ALL("all"); + + private final String value; + EventsAgentScope(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static EventsAgentScope fromValue(String value) { + for (EventsAgentScope v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown EventsAgentScope value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/EventsCursorStatus.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/EventsCursorStatus.java new file mode 100644 index 0000000000..eb68386adc --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/EventsCursorStatus.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Cursor status: 'ok' means the cursor was applied successfully; 'expired' means the cursor referred to an event that no longer exists in history (e.g. truncated or compacted away) and the read started from the beginning of the remaining history. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum EventsCursorStatus { + /** The {@code ok} variant. */ + OK("ok"), + /** The {@code expired} variant. */ + EXPIRED("expired"); + + private final String value; + EventsCursorStatus(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static EventsCursorStatus fromValue(String value) { + for (EventsCursorStatus v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown EventsCursorStatus value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/Extension.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/Extension.java new file mode 100644 index 0000000000..7784fa5a44 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/Extension.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `Extension` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record Extension( + /** Source-qualified ID (e.g., 'project:my-ext', 'user:auth-helper') */ + @JsonProperty("id") String id, + /** Extension name (directory name) */ + @JsonProperty("name") String name, + /** Discovery source: project (.github/extensions/) or user (~/.copilot/extensions/) */ + @JsonProperty("source") ExtensionSource source, + /** Current status: running, disabled, failed, or starting */ + @JsonProperty("status") ExtensionStatus status, + /** Process ID if the extension is running */ + @JsonProperty("pid") Long pid +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ExtensionSource.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ExtensionSource.java new file mode 100644 index 0000000000..2ec3da3973 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ExtensionSource.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Discovery source: project (.github/extensions/) or user (~/.copilot/extensions/) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ExtensionSource { + /** The {@code project} variant. */ + PROJECT("project"), + /** The {@code user} variant. */ + USER("user"); + + private final String value; + ExtensionSource(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ExtensionSource fromValue(String value) { + for (ExtensionSource v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ExtensionSource value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ExtensionStatus.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ExtensionStatus.java new file mode 100644 index 0000000000..241a5cd60c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ExtensionStatus.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Current status: running, disabled, failed, or starting + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ExtensionStatus { + /** The {@code running} variant. */ + RUNNING("running"), + /** The {@code disabled} variant. */ + DISABLED("disabled"), + /** The {@code failed} variant. */ + FAILED("failed"), + /** The {@code starting} variant. */ + STARTING("starting"); + + private final String value; + ExtensionStatus(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ExtensionStatus fromValue(String value) { + for (ExtensionStatus v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ExtensionStatus value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/HistoryCompactContextWindow.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/HistoryCompactContextWindow.java new file mode 100644 index 0000000000..4ac1a8fa9e --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/HistoryCompactContextWindow.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Post-compaction context window usage breakdown + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record HistoryCompactContextWindow( + /** Maximum token count for the model's context window */ + @JsonProperty("tokenLimit") Long tokenLimit, + /** Current total tokens in the context window (system + conversation + tool definitions) */ + @JsonProperty("currentTokens") Long currentTokens, + /** Current number of messages in the conversation */ + @JsonProperty("messagesLength") Long messagesLength, + /** Token count from system message(s) */ + @JsonProperty("systemTokens") Long systemTokens, + /** Token count from non-system messages (user, assistant, tool) */ + @JsonProperty("conversationTokens") Long conversationTokens, + /** Token count from tool definitions */ + @JsonProperty("toolDefinitionsTokens") Long toolDefinitionsTokens +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/InstalledPlugin.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/InstalledPlugin.java new file mode 100644 index 0000000000..9f48489da7 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/InstalledPlugin.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `InstalledPlugin` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record InstalledPlugin( + /** Plugin name */ + @JsonProperty("name") String name, + /** Marketplace the plugin came from (empty string for direct repo installs) */ + @JsonProperty("marketplace") String marketplace, + /** Version installed (if available) */ + @JsonProperty("version") String version, + /** Installation timestamp */ + @JsonProperty("installed_at") String installedAt, + /** Whether the plugin is currently enabled */ + @JsonProperty("enabled") Boolean enabled, + /** Path where the plugin is cached locally */ + @JsonProperty("cache_path") String cachePath, + /** Source for direct repo installs (when marketplace is empty) */ + @JsonProperty("source") Object source +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/InstructionsSources.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/InstructionsSources.java new file mode 100644 index 0000000000..0cc669e226 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/InstructionsSources.java @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Schema for the `InstructionsSources` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record InstructionsSources( + /** Unique identifier for this source (used for toggling) */ + @JsonProperty("id") String id, + /** Human-readable label */ + @JsonProperty("label") String label, + /** File path relative to repo or absolute for home */ + @JsonProperty("sourcePath") String sourcePath, + /** Raw content of the instruction file */ + @JsonProperty("content") String content, + /** Category of instruction source β€” used for merge logic */ + @JsonProperty("type") InstructionsSourcesType type, + /** Where this source lives β€” used for UI grouping */ + @JsonProperty("location") InstructionsSourcesLocation location, + /** Glob pattern(s) from frontmatter β€” when set, this instruction applies only to matching files */ + @JsonProperty("applyTo") List applyTo, + /** Short description (body after frontmatter) for use in instruction tables */ + @JsonProperty("description") String description, + /** When true, this source starts disabled and must be toggled on by the user */ + @JsonProperty("defaultDisabled") Boolean defaultDisabled +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/InstructionsSourcesLocation.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/InstructionsSourcesLocation.java new file mode 100644 index 0000000000..943591213a --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/InstructionsSourcesLocation.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Where this source lives β€” used for UI grouping + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum InstructionsSourcesLocation { + /** The {@code user} variant. */ + USER("user"), + /** The {@code repository} variant. */ + REPOSITORY("repository"), + /** The {@code working-directory} variant. */ + WORKING_DIRECTORY("working-directory"), + /** The {@code plugin} variant. */ + PLUGIN("plugin"); + + private final String value; + InstructionsSourcesLocation(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static InstructionsSourcesLocation fromValue(String value) { + for (InstructionsSourcesLocation v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown InstructionsSourcesLocation value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/InstructionsSourcesType.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/InstructionsSourcesType.java new file mode 100644 index 0000000000..b451f40c60 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/InstructionsSourcesType.java @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Category of instruction source β€” used for merge logic + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum InstructionsSourcesType { + /** The {@code home} variant. */ + HOME("home"), + /** The {@code repo} variant. */ + REPO("repo"), + /** The {@code model} variant. */ + MODEL("model"), + /** The {@code vscode} variant. */ + VSCODE("vscode"), + /** The {@code nested-agents} variant. */ + NESTED_AGENTS("nested-agents"), + /** The {@code child-instructions} variant. */ + CHILD_INSTRUCTIONS("child-instructions"), + /** The {@code plugin} variant. */ + PLUGIN("plugin"); + + private final String value; + InstructionsSourcesType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static InstructionsSourcesType fromValue(String value) { + for (InstructionsSourcesType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown InstructionsSourcesType value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigAddParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigAddParams.java index 0f33fdcdad..a865e900e4 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigAddParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigAddParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code mcp.config.add} RPC method. + * MCP server name and configuration to add to user configuration. * * @since 1.0.0 */ @@ -23,7 +23,7 @@ public record McpConfigAddParams( /** Unique name for the MCP server */ @JsonProperty("name") String name, - /** MCP server configuration (local/stdio or remote/http) */ + /** MCP server configuration (stdio process or remote HTTP/SSE) */ @JsonProperty("config") Object config ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigDisableParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigDisableParams.java new file mode 100644 index 0000000000..49664f8e86 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigDisableParams.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * MCP server names to disable for new sessions. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpConfigDisableParams( + /** Names of MCP servers to disable. Each server is added to the persisted disabled list so new sessions skip it. Already-disabled names are ignored. Active sessions keep their current connections until they end. */ + @JsonProperty("names") List names +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigEnableParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigEnableParams.java new file mode 100644 index 0000000000..4bf6284655 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigEnableParams.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * MCP server names to enable for new sessions. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpConfigEnableParams( + /** Names of MCP servers to enable. Each server is removed from the persisted disabled list so new sessions spawn it. Unknown or already-enabled names are ignored. */ + @JsonProperty("names") List names +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigListResult.java index 1391b451cb..f2be8641a9 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigListResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigListResult.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code mcp.config.list} RPC method. + * User-configured MCP servers, keyed by server name. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigRemoveParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigRemoveParams.java index 6c24be4311..9e87063c4b 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigRemoveParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigRemoveParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code mcp.config.remove} RPC method. + * MCP server name to remove from user configuration. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigUpdateParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigUpdateParams.java index 327234515f..8c2df60725 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigUpdateParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigUpdateParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code mcp.config.update} RPC method. + * MCP server name and replacement configuration to write to user configuration. * * @since 1.0.0 */ @@ -23,7 +23,7 @@ public record McpConfigUpdateParams( /** Name of the MCP server to update */ @JsonProperty("name") String name, - /** MCP server configuration (local/stdio or remote/http) */ + /** MCP server configuration (stdio process or remote HTTP/SSE) */ @JsonProperty("config") Object config ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpDiscoverParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpDiscoverParams.java index 24d52cffcd..29b3860520 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpDiscoverParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpDiscoverParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code mcp.discover} RPC method. + * Optional working directory used as context for MCP server discovery. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpDiscoverResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpDiscoverResult.java index 01561b9f49..074aedc613 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpDiscoverResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpDiscoverResult.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code mcp.discover} RPC method. + * MCP servers discovered from user, workspace, plugin, and built-in sources. * * @since 1.0.0 */ @@ -23,44 +23,6 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record McpDiscoverResult( /** MCP servers discovered from all sources */ - @JsonProperty("servers") List servers + @JsonProperty("servers") List servers ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record McpDiscoverResultServersItem( - /** Server name (config key) */ - @JsonProperty("name") String name, - /** Server type: local, stdio, http, or sse */ - @JsonProperty("type") String type, - /** Configuration source */ - @JsonProperty("source") McpDiscoverResultServersItemSource source, - /** Whether the server is enabled (not in the disabled list) */ - @JsonProperty("enabled") Boolean enabled - ) { - - /** Configuration source */ - public enum McpDiscoverResultServersItemSource { - /** The {@code user} variant. */ - USER("user"), - /** The {@code workspace} variant. */ - WORKSPACE("workspace"), - /** The {@code plugin} variant. */ - PLUGIN("plugin"), - /** The {@code builtin} variant. */ - BUILTIN("builtin"); - - private final String value; - McpDiscoverResultServersItemSource(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static McpDiscoverResultServersItemSource fromValue(String value) { - for (McpDiscoverResultServersItemSource v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown McpDiscoverResultServersItemSource value: " + value); - } - } - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpExecuteSamplingRequest.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpExecuteSamplingRequest.java new file mode 100644 index 0000000000..9dcf307eae --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpExecuteSamplingRequest.java @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Raw MCP CreateMessageRequest params, as received in the `sampling.requested` event. Treated as opaque at the schema layer; the runtime converts the embedded MCP messages into the OpenAI chat-completion shape internally. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpExecuteSamplingRequest() { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpExecuteSamplingResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpExecuteSamplingResult.java new file mode 100644 index 0000000000..6524610d03 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpExecuteSamplingResult.java @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * MCP CreateMessageResult payload (with optional 'tools' extension), present when action='success'. Treated as opaque at the schema layer; consumers should construct/consume it per the MCP CreateMessageResult shape. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpExecuteSamplingResult() { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpSamplingExecutionAction.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpSamplingExecutionAction.java new file mode 100644 index 0000000000..a00f41e824 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpSamplingExecutionAction.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Outcome of the sampling inference. 'success' produced a response; 'failure' encountered an error (including agent-side rejection by content filter or criteria); 'cancelled' the caller cancelled this execution via cancelSamplingExecution. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpSamplingExecutionAction { + /** The {@code success} variant. */ + SUCCESS("success"), + /** The {@code failure} variant. */ + FAILURE("failure"), + /** The {@code cancelled} variant. */ + CANCELLED("cancelled"); + + private final String value; + McpSamplingExecutionAction(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpSamplingExecutionAction fromValue(String value) { + for (McpSamplingExecutionAction v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpSamplingExecutionAction value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpServer.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpServer.java new file mode 100644 index 0000000000..e8b71f7e8f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpServer.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `McpServer` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpServer( + /** Server name (config key) */ + @JsonProperty("name") String name, + /** Connection status: connected, failed, needs-auth, pending, disabled, or not_configured */ + @JsonProperty("status") McpServerStatus status, + /** Configuration source: user, workspace, plugin, or builtin */ + @JsonProperty("source") McpServerSource source, + /** Error message if the server failed to connect */ + @JsonProperty("error") String error +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpServerSource.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpServerSource.java new file mode 100644 index 0000000000..3ffe4b7978 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpServerSource.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Configuration source: user, workspace, plugin, or builtin + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpServerSource { + /** The {@code user} variant. */ + USER("user"), + /** The {@code workspace} variant. */ + WORKSPACE("workspace"), + /** The {@code plugin} variant. */ + PLUGIN("plugin"), + /** The {@code builtin} variant. */ + BUILTIN("builtin"); + + private final String value; + McpServerSource(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpServerSource fromValue(String value) { + for (McpServerSource v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpServerSource value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpServerStatus.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpServerStatus.java new file mode 100644 index 0000000000..06bec4f307 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpServerStatus.java @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Connection status: connected, failed, needs-auth, pending, disabled, or not_configured + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpServerStatus { + /** The {@code connected} variant. */ + CONNECTED("connected"), + /** The {@code failed} variant. */ + FAILED("failed"), + /** The {@code needs-auth} variant. */ + NEEDS_AUTH("needs-auth"), + /** The {@code pending} variant. */ + PENDING("pending"), + /** The {@code disabled} variant. */ + DISABLED("disabled"), + /** The {@code not_configured} variant. */ + NOT_CONFIGURED("not_configured"); + + private final String value; + McpServerStatus(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpServerStatus fromValue(String value) { + for (McpServerStatus v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpServerStatus value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/McpSetEnvValueModeDetails.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpSetEnvValueModeDetails.java new file mode 100644 index 0000000000..d62e10c30d --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpSetEnvValueModeDetails.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * How environment-variable values supplied to MCP servers are resolved. "direct" passes literal string values; "indirect" treats values as references (e.g. names of environment variables on the host) that the runtime resolves before launch. Defaults to the runtime's startup mode; clients that intentionally launch MCP servers with literal values (e.g. CLI prompt mode and ACP) set this to "direct". + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpSetEnvValueModeDetails { + /** The {@code direct} variant. */ + DIRECT("direct"), + /** The {@code indirect} variant. */ + INDIRECT("indirect"); + + private final String value; + McpSetEnvValueModeDetails(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpSetEnvValueModeDetails fromValue(String value) { + for (McpSetEnvValueModeDetails v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpSetEnvValueModeDetails value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/MetadataSnapshotCurrentMode.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/MetadataSnapshotCurrentMode.java new file mode 100644 index 0000000000..5d55d1c4b8 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/MetadataSnapshotCurrentMode.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * The current agent mode for this session (e.g., 'interactive', 'plan', 'autopilot') + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum MetadataSnapshotCurrentMode { + /** The {@code interactive} variant. */ + INTERACTIVE("interactive"), + /** The {@code plan} variant. */ + PLAN("plan"), + /** The {@code autopilot} variant. */ + AUTOPILOT("autopilot"); + + private final String value; + MetadataSnapshotCurrentMode(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static MetadataSnapshotCurrentMode fromValue(String value) { + for (MetadataSnapshotCurrentMode v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown MetadataSnapshotCurrentMode value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/MetadataSnapshotRemoteMetadata.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/MetadataSnapshotRemoteMetadata.java new file mode 100644 index 0000000000..b97a5f12c9 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/MetadataSnapshotRemoteMetadata.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record MetadataSnapshotRemoteMetadata( + /** The original resource identifier (task ID or PR node ID), preserved across event-replay reconstructions. Falls back to `sessionId` when absent. */ + @JsonProperty("resourceId") String resourceId, + /** The repository the remote session targets. */ + @JsonProperty("repository") MetadataSnapshotRemoteMetadataRepository repository, + /** The pull request number the remote session is associated with, if any. */ + @JsonProperty("pullRequestNumber") Long pullRequestNumber, + /** Whether the remote task originated from Copilot Coding Agent (cca) or a CLI `--remote` invocation. */ + @JsonProperty("taskType") MetadataSnapshotRemoteMetadataTaskType taskType +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/MetadataSnapshotRemoteMetadataRepository.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/MetadataSnapshotRemoteMetadataRepository.java new file mode 100644 index 0000000000..fb6c62e8ae --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/MetadataSnapshotRemoteMetadataRepository.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * The repository the remote session targets. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record MetadataSnapshotRemoteMetadataRepository( + /** The GitHub owner (user or organization) of the target repository. */ + @JsonProperty("owner") String owner, + /** The GitHub repository name (without owner). */ + @JsonProperty("name") String name, + /** The branch the remote session is operating on. */ + @JsonProperty("branch") String branch +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/MetadataSnapshotRemoteMetadataTaskType.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/MetadataSnapshotRemoteMetadataTaskType.java new file mode 100644 index 0000000000..387d39234b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/MetadataSnapshotRemoteMetadataTaskType.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Whether the remote task originated from Copilot Coding Agent (cca) or a CLI `--remote` invocation. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum MetadataSnapshotRemoteMetadataTaskType { + /** The {@code cca} variant. */ + CCA("cca"), + /** The {@code cli} variant. */ + CLI("cli"); + + private final String value; + MetadataSnapshotRemoteMetadataTaskType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static MetadataSnapshotRemoteMetadataTaskType fromValue(String value) { + for (MetadataSnapshotRemoteMetadataTaskType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown MetadataSnapshotRemoteMetadataTaskType value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/Model.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/Model.java new file mode 100644 index 0000000000..1a808911ca --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/Model.java @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Schema for the `Model` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record Model( + /** Model identifier (e.g., "claude-sonnet-4.5") */ + @JsonProperty("id") String id, + /** Display name */ + @JsonProperty("name") String name, + /** Model capabilities and limits */ + @JsonProperty("capabilities") ModelCapabilities capabilities, + /** Policy state (if applicable) */ + @JsonProperty("policy") ModelPolicy policy, + /** Billing information */ + @JsonProperty("billing") ModelBilling billing, + /** Supported reasoning effort levels (only present if model supports reasoning effort) */ + @JsonProperty("supportedReasoningEfforts") List supportedReasoningEfforts, + /** Default reasoning effort level (only present if model supports reasoning effort) */ + @JsonProperty("defaultReasoningEffort") String defaultReasoningEffort, + /** Model capability category for grouping in the model picker */ + @JsonProperty("modelPickerCategory") ModelPickerCategory modelPickerCategory, + /** Relative cost tier for token-based billing users */ + @JsonProperty("modelPickerPriceCategory") ModelPickerPriceCategory modelPickerPriceCategory +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelBilling.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelBilling.java new file mode 100644 index 0000000000..9e634bb79a --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelBilling.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Billing information + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ModelBilling( + /** Billing cost multiplier relative to the base rate */ + @JsonProperty("multiplier") Double multiplier, + /** Token-level pricing information for this model */ + @JsonProperty("tokenPrices") ModelBillingTokenPrices tokenPrices +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelBillingTokenPrices.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelBillingTokenPrices.java new file mode 100644 index 0000000000..34005daf1b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelBillingTokenPrices.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Token-level pricing information for this model + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ModelBillingTokenPrices( + /** Price per billing batch of input tokens in nano-AIUs (1 nano-AIU = 0.000000001 AIU, 1 AIU = $0.01 USD) */ + @JsonProperty("inputPrice") Long inputPrice, + /** Price per billing batch of output tokens in nano-AIUs (1 nano-AIU = 0.000000001 AIU, 1 AIU = $0.01 USD) */ + @JsonProperty("outputPrice") Long outputPrice, + /** Price per billing batch of cached tokens in nano-AIUs (1 nano-AIU = 0.000000001 AIU, 1 AIU = $0.01 USD) */ + @JsonProperty("cachePrice") Long cachePrice, + /** Number of tokens per standard billing batch */ + @JsonProperty("batchSize") Long batchSize +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilities.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilities.java new file mode 100644 index 0000000000..4c6b5e3af5 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilities.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Model capabilities and limits + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ModelCapabilities( + /** Feature flags indicating what the model supports */ + @JsonProperty("supports") ModelCapabilitiesSupports supports, + /** Token limits for prompts, outputs, and context window */ + @JsonProperty("limits") ModelCapabilitiesLimits limits +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesLimits.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesLimits.java new file mode 100644 index 0000000000..8adf6812b2 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesLimits.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Token limits for prompts, outputs, and context window + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ModelCapabilitiesLimits( + /** Maximum number of prompt/input tokens */ + @JsonProperty("max_prompt_tokens") Long maxPromptTokens, + /** Maximum number of output/completion tokens */ + @JsonProperty("max_output_tokens") Long maxOutputTokens, + /** Maximum total context window size in tokens */ + @JsonProperty("max_context_window_tokens") Long maxContextWindowTokens, + /** Vision-specific limits */ + @JsonProperty("vision") ModelCapabilitiesLimitsVision vision +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesLimitsVision.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesLimitsVision.java new file mode 100644 index 0000000000..cbfc7c3b89 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesLimitsVision.java @@ -0,0 +1,32 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Vision-specific limits + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ModelCapabilitiesLimitsVision( + /** MIME types the model accepts */ + @JsonProperty("supported_media_types") List supportedMediaTypes, + /** Maximum number of images per prompt */ + @JsonProperty("max_prompt_images") Long maxPromptImages, + /** Maximum image size in bytes */ + @JsonProperty("max_prompt_image_size") Long maxPromptImageSize +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesOverride.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesOverride.java new file mode 100644 index 0000000000..1ec67824ec --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesOverride.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Override individual model capabilities resolved by the runtime + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ModelCapabilitiesOverride( + /** Feature flags indicating what the model supports */ + @JsonProperty("supports") ModelCapabilitiesOverrideSupports supports, + /** Token limits for prompts, outputs, and context window */ + @JsonProperty("limits") ModelCapabilitiesOverrideLimits limits +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesOverrideLimits.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesOverrideLimits.java new file mode 100644 index 0000000000..f5b0b4e5e8 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesOverrideLimits.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Token limits for prompts, outputs, and context window + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ModelCapabilitiesOverrideLimits( + /** Maximum number of prompt/input tokens */ + @JsonProperty("max_prompt_tokens") Long maxPromptTokens, + /** Maximum number of output/completion tokens */ + @JsonProperty("max_output_tokens") Long maxOutputTokens, + /** Maximum total context window size in tokens */ + @JsonProperty("max_context_window_tokens") Long maxContextWindowTokens, + /** Vision-specific limits */ + @JsonProperty("vision") ModelCapabilitiesOverrideLimitsVision vision +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesOverrideLimitsVision.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesOverrideLimitsVision.java new file mode 100644 index 0000000000..0d53e85321 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesOverrideLimitsVision.java @@ -0,0 +1,32 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Vision-specific limits + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ModelCapabilitiesOverrideLimitsVision( + /** MIME types the model accepts */ + @JsonProperty("supported_media_types") List supportedMediaTypes, + /** Maximum number of images per prompt */ + @JsonProperty("max_prompt_images") Long maxPromptImages, + /** Maximum image size in bytes */ + @JsonProperty("max_prompt_image_size") Long maxPromptImageSize +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesOverrideSupports.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesOverrideSupports.java new file mode 100644 index 0000000000..23304c82d8 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesOverrideSupports.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Feature flags indicating what the model supports + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ModelCapabilitiesOverrideSupports( + /** Whether this model supports vision/image input */ + @JsonProperty("vision") Boolean vision, + /** Whether this model supports reasoning effort configuration */ + @JsonProperty("reasoningEffort") Boolean reasoningEffort +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesSupports.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesSupports.java new file mode 100644 index 0000000000..f898f130f5 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesSupports.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Feature flags indicating what the model supports + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ModelCapabilitiesSupports( + /** Whether this model supports vision/image input */ + @JsonProperty("vision") Boolean vision, + /** Whether this model supports reasoning effort configuration */ + @JsonProperty("reasoningEffort") Boolean reasoningEffort +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPickerCategory.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPickerCategory.java new file mode 100644 index 0000000000..ba0bdddfd1 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPickerCategory.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Model capability category for grouping in the model picker + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ModelPickerCategory { + /** The {@code lightweight} variant. */ + LIGHTWEIGHT("lightweight"), + /** The {@code versatile} variant. */ + VERSATILE("versatile"), + /** The {@code powerful} variant. */ + POWERFUL("powerful"); + + private final String value; + ModelPickerCategory(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ModelPickerCategory fromValue(String value) { + for (ModelPickerCategory v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ModelPickerCategory value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPickerPriceCategory.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPickerPriceCategory.java new file mode 100644 index 0000000000..cf722e4968 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPickerPriceCategory.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Relative cost tier for token-based billing users + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ModelPickerPriceCategory { + /** The {@code low} variant. */ + LOW("low"), + /** The {@code medium} variant. */ + MEDIUM("medium"), + /** The {@code high} variant. */ + HIGH("high"), + /** The {@code very_high} variant. */ + VERY_HIGH("very_high"); + + private final String value; + ModelPickerPriceCategory(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ModelPickerPriceCategory fromValue(String value) { + for (ModelPickerPriceCategory v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ModelPickerPriceCategory value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPolicy.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPolicy.java new file mode 100644 index 0000000000..a6cdeb5d56 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPolicy.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Policy state (if applicable) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ModelPolicy( + /** Current policy state for this model */ + @JsonProperty("state") ModelPolicyState state, + /** Usage terms or conditions for this model */ + @JsonProperty("terms") String terms +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPolicyState.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPolicyState.java new file mode 100644 index 0000000000..1673080d0d --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPolicyState.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Current policy state for this model + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ModelPolicyState { + /** The {@code enabled} variant. */ + ENABLED("enabled"), + /** The {@code disabled} variant. */ + DISABLED("disabled"), + /** The {@code unconfigured} variant. */ + UNCONFIGURED("unconfigured"); + + private final String value; + ModelPolicyState(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ModelPolicyState fromValue(String value) { + for (ModelPolicyState v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ModelPolicyState value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelsListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelsListResult.java index 6b233a7370..db9dd791a2 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelsListResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelsListResult.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code models.list} RPC method. + * List of Copilot models available to the resolved user, including capabilities and billing metadata. * * @since 1.0.0 */ @@ -23,96 +23,6 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record ModelsListResult( /** List of available models with full metadata */ - @JsonProperty("models") List models + @JsonProperty("models") List models ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record ModelsListResultModelsItem( - /** Model identifier (e.g., "claude-sonnet-4.5") */ - @JsonProperty("id") String id, - /** Display name */ - @JsonProperty("name") String name, - /** Model capabilities and limits */ - @JsonProperty("capabilities") ModelsListResultModelsItemCapabilities capabilities, - /** Policy state (if applicable) */ - @JsonProperty("policy") ModelsListResultModelsItemPolicy policy, - /** Billing information */ - @JsonProperty("billing") ModelsListResultModelsItemBilling billing, - /** Supported reasoning effort levels (only present if model supports reasoning effort) */ - @JsonProperty("supportedReasoningEfforts") List supportedReasoningEfforts, - /** Default reasoning effort level (only present if model supports reasoning effort) */ - @JsonProperty("defaultReasoningEffort") String defaultReasoningEffort - ) { - - /** Model capabilities and limits */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record ModelsListResultModelsItemCapabilities( - /** Feature flags indicating what the model supports */ - @JsonProperty("supports") ModelsListResultModelsItemCapabilitiesSupports supports, - /** Token limits for prompts, outputs, and context window */ - @JsonProperty("limits") ModelsListResultModelsItemCapabilitiesLimits limits - ) { - - /** Feature flags indicating what the model supports */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record ModelsListResultModelsItemCapabilitiesSupports( - /** Whether this model supports vision/image input */ - @JsonProperty("vision") Boolean vision, - /** Whether this model supports reasoning effort configuration */ - @JsonProperty("reasoningEffort") Boolean reasoningEffort - ) { - } - - /** Token limits for prompts, outputs, and context window */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record ModelsListResultModelsItemCapabilitiesLimits( - /** Maximum number of prompt/input tokens */ - @JsonProperty("max_prompt_tokens") Double maxPromptTokens, - /** Maximum number of output/completion tokens */ - @JsonProperty("max_output_tokens") Double maxOutputTokens, - /** Maximum total context window size in tokens */ - @JsonProperty("max_context_window_tokens") Double maxContextWindowTokens, - /** Vision-specific limits */ - @JsonProperty("vision") ModelsListResultModelsItemCapabilitiesLimitsVision vision - ) { - - /** Vision-specific limits */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record ModelsListResultModelsItemCapabilitiesLimitsVision( - /** MIME types the model accepts */ - @JsonProperty("supported_media_types") List supportedMediaTypes, - /** Maximum number of images per prompt */ - @JsonProperty("max_prompt_images") Double maxPromptImages, - /** Maximum image size in bytes */ - @JsonProperty("max_prompt_image_size") Double maxPromptImageSize - ) { - } - } - } - - /** Policy state (if applicable) */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record ModelsListResultModelsItemPolicy( - /** Current policy state for this model */ - @JsonProperty("state") String state, - /** Usage terms or conditions for this model */ - @JsonProperty("terms") String terms - ) { - } - - /** Billing information */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record ModelsListResultModelsItemBilling( - /** Billing cost multiplier relative to the base rate */ - @JsonProperty("multiplier") Double multiplier - ) { - } - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/OptionsUpdateEnvValueMode.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/OptionsUpdateEnvValueMode.java new file mode 100644 index 0000000000..f75daae610 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/OptionsUpdateEnvValueMode.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * How env values are passed to MCP servers (`direct` inlines literal values; `indirect` resolves at launch). + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum OptionsUpdateEnvValueMode { + /** The {@code direct} variant. */ + DIRECT("direct"), + /** The {@code indirect} variant. */ + INDIRECT("indirect"); + + private final String value; + OptionsUpdateEnvValueMode(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static OptionsUpdateEnvValueMode fromValue(String value) { + for (OptionsUpdateEnvValueMode v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown OptionsUpdateEnvValueMode value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/PendingPermissionRequest.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/PendingPermissionRequest.java new file mode 100644 index 0000000000..f4d84c730d --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/PendingPermissionRequest.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `PendingPermissionRequest` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record PendingPermissionRequest( + /** Unique identifier for the pending permission request */ + @JsonProperty("requestId") String requestId, + /** The user-facing permission prompt details (commands, write, read, mcp, url, memory, custom-tool, path, hook) */ + @JsonProperty("request") Object request +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionLocationType.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionLocationType.java new file mode 100644 index 0000000000..c3b368cacb --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionLocationType.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Whether the location is a git repo or directory + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum PermissionLocationType { + /** The {@code repo} variant. */ + REPO("repo"), + /** The {@code dir} variant. */ + DIR("dir"); + + private final String value; + PermissionLocationType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static PermissionLocationType fromValue(String value) { + for (PermissionLocationType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown PermissionLocationType value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionPathsConfig.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionPathsConfig.java new file mode 100644 index 0000000000..1ac49881bb --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionPathsConfig.java @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * If specified, replaces the session's path-permission policy. The runtime constructs the appropriate PathManager based on these inputs (rooted at the session's working directory). Omit to leave the current path policy unchanged. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record PermissionPathsConfig( + /** If true, the runtime allows access to all paths without prompting. Equivalent to constructing an UnrestrictedPathManager. */ + @JsonProperty("unrestricted") Boolean unrestricted, + /** Additional directories to allow tool access to (in addition to the session's working directory). When `unrestricted` is true, these are still pre-populated on the UnrestrictedPathManager so they remain visible via getDirectories() (e.g. for @-mention completion). */ + @JsonProperty("additionalDirectories") List additionalDirectories, + /** Whether to include the system temp directory in the allowed list (defaults to true). Ignored when `unrestricted` is true. */ + @JsonProperty("includeTempDirectory") Boolean includeTempDirectory, + /** Workspace root path (special-cased to be allowed even before the directory exists). Ignored when `unrestricted` is true. */ + @JsonProperty("workspacePath") String workspacePath +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionRule.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionRule.java new file mode 100644 index 0000000000..ad8a57d8f6 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionRule.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `PermissionRule` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record PermissionRule( + /** The rule kind, such as Shell or GitHubMCP */ + @JsonProperty("kind") String kind, + /** Argument value matched against the request, or null when the rule kind has no argument (e.g. 'read', 'write', 'memory'). */ + @JsonProperty("argument") String argument +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionRulesSet.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionRulesSet.java new file mode 100644 index 0000000000..c29f11ba46 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionRulesSet.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * If specified, replaces the session's approved/denied permission rules. Omit to leave the current rules unchanged. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record PermissionRulesSet( + /** Rules that auto-approve matching requests */ + @JsonProperty("approved") List approved, + /** Rules that auto-deny matching requests */ + @JsonProperty("denied") List denied +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionUrlsConfig.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionUrlsConfig.java new file mode 100644 index 0000000000..46ff5501fb --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionUrlsConfig.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * If specified, replaces the session's URL-permission policy. The runtime constructs a fresh DefaultUrlManager based on these inputs. Omit to leave the current URL policy unchanged. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record PermissionUrlsConfig( + /** If true, the runtime allows access to all URLs without prompting. Initial allow-list is ignored when this is true. */ + @JsonProperty("unrestricted") Boolean unrestricted, + /** Initial list of allowed URL/domain patterns. Patterns may include path components. Ignored when `unrestricted` is true. */ + @JsonProperty("initialAllowed") List initialAllowed +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionsConfigureAdditionalContentExclusionPolicy.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionsConfigureAdditionalContentExclusionPolicy.java new file mode 100644 index 0000000000..2b31068e02 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionsConfigureAdditionalContentExclusionPolicy.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Schema for the `PermissionsConfigureAdditionalContentExclusionPolicy` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record PermissionsConfigureAdditionalContentExclusionPolicy( + @JsonProperty("rules") List rules, + @JsonProperty("last_updated_at") Object lastUpdatedAt, + /** Allowed values for the `PermissionsConfigureAdditionalContentExclusionPolicyScope` enumeration. */ + @JsonProperty("scope") PermissionsConfigureAdditionalContentExclusionPolicyScope scope +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionsConfigureAdditionalContentExclusionPolicyRule.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionsConfigureAdditionalContentExclusionPolicyRule.java new file mode 100644 index 0000000000..c41050f1b8 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionsConfigureAdditionalContentExclusionPolicyRule.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Schema for the `PermissionsConfigureAdditionalContentExclusionPolicyRule` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record PermissionsConfigureAdditionalContentExclusionPolicyRule( + @JsonProperty("paths") List paths, + @JsonProperty("ifAnyMatch") List ifAnyMatch, + @JsonProperty("ifNoneMatch") List ifNoneMatch, + /** Schema for the `PermissionsConfigureAdditionalContentExclusionPolicyRuleSource` type. */ + @JsonProperty("source") PermissionsConfigureAdditionalContentExclusionPolicyRuleSource source +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionsConfigureAdditionalContentExclusionPolicyRuleSource.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionsConfigureAdditionalContentExclusionPolicyRuleSource.java new file mode 100644 index 0000000000..372e341da2 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionsConfigureAdditionalContentExclusionPolicyRuleSource.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `PermissionsConfigureAdditionalContentExclusionPolicyRuleSource` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record PermissionsConfigureAdditionalContentExclusionPolicyRuleSource( + @JsonProperty("name") String name, + @JsonProperty("type") String type +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionsConfigureAdditionalContentExclusionPolicyScope.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionsConfigureAdditionalContentExclusionPolicyScope.java new file mode 100644 index 0000000000..1c378ec628 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionsConfigureAdditionalContentExclusionPolicyScope.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Allowed values for the `PermissionsConfigureAdditionalContentExclusionPolicyScope` enumeration. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum PermissionsConfigureAdditionalContentExclusionPolicyScope { + /** The {@code repo} variant. */ + REPO("repo"), + /** The {@code all} variant. */ + ALL("all"); + + private final String value; + PermissionsConfigureAdditionalContentExclusionPolicyScope(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static PermissionsConfigureAdditionalContentExclusionPolicyScope fromValue(String value) { + for (PermissionsConfigureAdditionalContentExclusionPolicyScope v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown PermissionsConfigureAdditionalContentExclusionPolicyScope value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionsModifyRulesScope.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionsModifyRulesScope.java new file mode 100644 index 0000000000..53dc333915 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionsModifyRulesScope.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Whether the change applies to ephemeral session-scoped rules (cleared at session end) or to location-scoped rules persisted via the location-permissions config file. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum PermissionsModifyRulesScope { + /** The {@code session} variant. */ + SESSION("session"), + /** The {@code location} variant. */ + LOCATION("location"); + + private final String value; + PermissionsModifyRulesScope(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static PermissionsModifyRulesScope fromValue(String value) { + for (PermissionsModifyRulesScope v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown PermissionsModifyRulesScope value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionsSetApproveAllSource.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionsSetApproveAllSource.java new file mode 100644 index 0000000000..9e88acc593 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/PermissionsSetApproveAllSource.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum PermissionsSetApproveAllSource { + /** The {@code cli_flag} variant. */ + CLI_FLAG("cli_flag"), + /** The {@code slash_command} variant. */ + SLASH_COMMAND("slash_command"), + /** The {@code autopilot_confirmation} variant. */ + AUTOPILOT_CONFIRMATION("autopilot_confirmation"), + /** The {@code rpc} variant. */ + RPC("rpc"); + + private final String value; + PermissionsSetApproveAllSource(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static PermissionsSetApproveAllSource fromValue(String value) { + for (PermissionsSetApproveAllSource v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown PermissionsSetApproveAllSource value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/PingParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/PingParams.java index 892d5cbb2d..564478b175 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/PingParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/PingParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code ping} RPC method. + * Optional message to echo back to the caller. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/PingResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/PingResult.java index 30ff8c58ac..b0ed087bd1 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/PingResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/PingResult.java @@ -10,10 +10,11 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; import javax.annotation.processing.Generated; /** - * Result for the {@code ping} RPC method. + * Server liveness response, including the echoed message, current server timestamp, and protocol version. * * @since 1.0.0 */ @@ -23,9 +24,9 @@ public record PingResult( /** Echoed message (or default greeting) */ @JsonProperty("message") String message, - /** Server timestamp in milliseconds */ - @JsonProperty("timestamp") Double timestamp, + /** ISO 8601 timestamp when the server handled the ping */ + @JsonProperty("timestamp") OffsetDateTime timestamp, /** Server protocol version number */ - @JsonProperty("protocolVersion") Double protocolVersion + @JsonProperty("protocolVersion") Long protocolVersion ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/Plugin.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/Plugin.java new file mode 100644 index 0000000000..1b09c22cee --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/Plugin.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `Plugin` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record Plugin( + /** Plugin name */ + @JsonProperty("name") String name, + /** Marketplace the plugin came from */ + @JsonProperty("marketplace") String marketplace, + /** Installed version */ + @JsonProperty("version") String version, + /** Whether the plugin is currently enabled */ + @JsonProperty("enabled") Boolean enabled +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/QueuePendingItems.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/QueuePendingItems.java new file mode 100644 index 0000000000..ccffaed7ed --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/QueuePendingItems.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `QueuePendingItems` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record QueuePendingItems( + /** Whether this item is a queued user message or a queued slash command / model change */ + @JsonProperty("kind") QueuePendingItemsKind kind, + /** Human-readable text to display for this queue entry in the UI */ + @JsonProperty("displayText") String displayText +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/QueuePendingItemsKind.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/QueuePendingItemsKind.java new file mode 100644 index 0000000000..90f9e7f62c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/QueuePendingItemsKind.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Whether this item is a queued user message or a queued slash command / model change + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum QueuePendingItemsKind { + /** The {@code message} variant. */ + MESSAGE("message"), + /** The {@code command} variant. */ + COMMAND("command"); + + private final String value; + QueuePendingItemsKind(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static QueuePendingItemsKind fromValue(String value) { + for (QueuePendingItemsKind v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown QueuePendingItemsKind value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ReasoningSummary.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ReasoningSummary.java new file mode 100644 index 0000000000..5e534e214c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ReasoningSummary.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Reasoning summary mode to request for supported model clients + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ReasoningSummary { + /** The {@code none} variant. */ + NONE("none"), + /** The {@code concise} variant. */ + CONCISE("concise"), + /** The {@code detailed} variant. */ + DETAILED("detailed"); + + private final String value; + ReasoningSummary(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ReasoningSummary fromValue(String value) { + for (ReasoningSummary v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ReasoningSummary value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/RemoteSessionMode.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/RemoteSessionMode.java new file mode 100644 index 0000000000..93238eef44 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/RemoteSessionMode.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Per-session remote mode. "off" disables remote, "export" exports session events to GitHub without enabling remote steering, "on" enables both export and remote steering. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum RemoteSessionMode { + /** The {@code off} variant. */ + OFF("off"), + /** The {@code export} variant. */ + EXPORT("export"), + /** The {@code on} variant. */ + ON("on"); + + private final String value; + RemoteSessionMode(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static RemoteSessionMode fromValue(String value) { + for (RemoteSessionMode v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown RemoteSessionMode value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ScheduleEntry.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ScheduleEntry.java new file mode 100644 index 0000000000..8038341a8e --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ScheduleEntry.java @@ -0,0 +1,38 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import javax.annotation.processing.Generated; + +/** + * Schema for the `ScheduleEntry` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ScheduleEntry( + /** Sequential id assigned by the runtime within the session. Stable across resumes (rebuilt from the event log). */ + @JsonProperty("id") Long id, + /** Interval between scheduled ticks, in milliseconds. */ + @JsonProperty("intervalMs") Long intervalMs, + /** Prompt text that gets enqueued on every tick. */ + @JsonProperty("prompt") String prompt, + /** Whether the schedule re-arms after each tick (`/every`) or fires once (`/after`). */ + @JsonProperty("recurring") Boolean recurring, + /** Display-only label for the prompt as shown in the UI (e.g. `/skill-name` for a skill-invocation schedule). The actual enqueued prompt is `prompt`. */ + @JsonProperty("displayPrompt") String displayPrompt, + /** ISO 8601 timestamp when the next tick is scheduled to fire. */ + @JsonProperty("nextRunAt") OffsetDateTime nextRunAt +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SecretsAddFilterValuesParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SecretsAddFilterValuesParams.java new file mode 100644 index 0000000000..e8d1b5542e --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SecretsAddFilterValuesParams.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Secret values to add to the redaction filter. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SecretsAddFilterValuesParams( + /** Raw secret values to register for redaction */ + @JsonProperty("values") List values +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SecretsAddFilterValuesResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SecretsAddFilterValuesResult.java new file mode 100644 index 0000000000..7762377ff1 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SecretsAddFilterValuesResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Confirmation that the secret values were registered. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SecretsAddFilterValuesResult( + /** Whether the values were successfully registered */ + @JsonProperty("ok") Boolean ok +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SendAgentMode.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SendAgentMode.java new file mode 100644 index 0000000000..7dee184c9b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SendAgentMode.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * The UI mode the agent was in when this message was sent. Defaults to the session's current mode. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SendAgentMode { + /** The {@code interactive} variant. */ + INTERACTIVE("interactive"), + /** The {@code plan} variant. */ + PLAN("plan"), + /** The {@code autopilot} variant. */ + AUTOPILOT("autopilot"), + /** The {@code shell} variant. */ + SHELL("shell"); + + private final String value; + SendAgentMode(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SendAgentMode fromValue(String value) { + for (SendAgentMode v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SendAgentMode value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SendMode.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SendMode.java new file mode 100644 index 0000000000..c424caabc3 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SendMode.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * How to deliver the message. `enqueue` (default) appends to the message queue. `immediate` interjects during an in-progress turn. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SendMode { + /** The {@code enqueue} variant. */ + ENQUEUE("enqueue"), + /** The {@code immediate} variant. */ + IMMEDIATE("immediate"); + + private final String value; + SendMode(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SendMode fromValue(String value) { + for (SendMode v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SendMode value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerAccountApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerAccountApi.java index ecbe8a1057..583e110851 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerAccountApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerAccountApi.java @@ -26,7 +26,7 @@ public final class ServerAccountApi { } /** - * Invokes {@code account.getQuota}. + * Optional GitHub token used to look up quota for a specific user instead of the global auth context. * @since 1.0.0 */ public CompletableFuture getQuota() { diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerMcpApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerMcpApi.java index 6c376d0fe9..db70171c97 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerMcpApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerMcpApi.java @@ -30,7 +30,7 @@ public final class ServerMcpApi { } /** - * Invokes {@code mcp.discover}. + * Optional working directory used as context for MCP server discovery. * @since 1.0.0 */ public CompletableFuture discover(McpDiscoverParams params) { diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerMcpConfigApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerMcpConfigApi.java index 0153b2baf4..cec231c61c 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerMcpConfigApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerMcpConfigApi.java @@ -26,7 +26,7 @@ public final class ServerMcpConfigApi { } /** - * Invokes {@code mcp.config.list}. + * User-configured MCP servers, keyed by server name. * @since 1.0.0 */ public CompletableFuture list() { @@ -34,7 +34,7 @@ public CompletableFuture list() { } /** - * Invokes {@code mcp.config.add}. + * MCP server name and configuration to add to user configuration. * @since 1.0.0 */ public CompletableFuture add(McpConfigAddParams params) { @@ -42,7 +42,7 @@ public CompletableFuture add(McpConfigAddParams params) { } /** - * Invokes {@code mcp.config.update}. + * MCP server name and replacement configuration to write to user configuration. * @since 1.0.0 */ public CompletableFuture update(McpConfigUpdateParams params) { @@ -50,11 +50,27 @@ public CompletableFuture update(McpConfigUpdateParams params) { } /** - * Invokes {@code mcp.config.remove}. + * MCP server name to remove from user configuration. * @since 1.0.0 */ public CompletableFuture remove(McpConfigRemoveParams params) { return caller.invoke("mcp.config.remove", params, Void.class); } + /** + * MCP server names to enable for new sessions. + * @since 1.0.0 + */ + public CompletableFuture enable(McpConfigEnableParams params) { + return caller.invoke("mcp.config.enable", params, Void.class); + } + + /** + * MCP server names to disable for new sessions. + * @since 1.0.0 + */ + public CompletableFuture disable(McpConfigDisableParams params) { + return caller.invoke("mcp.config.disable", params, Void.class); + } + } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerModelsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerModelsApi.java index c3f83b45cc..e062c6f0a4 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerModelsApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerModelsApi.java @@ -26,7 +26,7 @@ public final class ServerModelsApi { } /** - * Invokes {@code models.list}. + * Optional GitHub token used to list models for a specific user instead of the global auth context. * @since 1.0.0 */ public CompletableFuture list() { diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerRpc.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerRpc.java index 0f0e5804c6..436fcc6968 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerRpc.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerRpc.java @@ -30,8 +30,12 @@ public final class ServerRpc { public final ServerToolsApi tools; /** API methods for the {@code account} namespace. */ public final ServerAccountApi account; + /** API methods for the {@code secrets} namespace. */ + public final ServerSecretsApi secrets; /** API methods for the {@code mcp} namespace. */ public final ServerMcpApi mcp; + /** API methods for the {@code skills} namespace. */ + public final ServerSkillsApi skills; /** API methods for the {@code sessionFs} namespace. */ public final ServerSessionFsApi sessionFs; /** API methods for the {@code sessions} namespace. */ @@ -47,17 +51,27 @@ public ServerRpc(RpcCaller caller) { this.models = new ServerModelsApi(caller); this.tools = new ServerToolsApi(caller); this.account = new ServerAccountApi(caller); + this.secrets = new ServerSecretsApi(caller); this.mcp = new ServerMcpApi(caller); + this.skills = new ServerSkillsApi(caller); this.sessionFs = new ServerSessionFsApi(caller); this.sessions = new ServerSessionsApi(caller); } /** - * Invokes {@code ping}. + * Optional message to echo back to the caller. * @since 1.0.0 */ public CompletableFuture ping(PingParams params) { return caller.invoke("ping", params, PingResult.class); } + /** + * Optional connection token presented by the SDK client during the handshake. + * @since 1.0.0 + */ + public CompletableFuture connect(ConnectParams params) { + return caller.invoke("connect", params, ConnectResult.class); + } + } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSecretsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSecretsApi.java new file mode 100644 index 0000000000..af8f6c3c5d --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSecretsApi.java @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code secrets} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class ServerSecretsApi { + + private final RpcCaller caller; + + /** @param caller the RPC transport function */ + ServerSecretsApi(RpcCaller caller) { + this.caller = caller; + } + + /** + * Secret values to add to the redaction filter. + * @since 1.0.0 + */ + public CompletableFuture addFilterValues(SecretsAddFilterValuesParams params) { + return caller.invoke("secrets.addFilterValues", params, SecretsAddFilterValuesResult.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSessionFsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSessionFsApi.java index 068ff939f7..25aefcf252 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSessionFsApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSessionFsApi.java @@ -26,7 +26,7 @@ public final class ServerSessionFsApi { } /** - * Invokes {@code sessionFs.setProvider}. + * Initial working directory, session-state path layout, and path conventions used to register the calling SDK client as the session filesystem provider. * @since 1.0.0 */ public CompletableFuture setProvider(SessionFsSetProviderParams params) { diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSessionsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSessionsApi.java index 6d1aa06519..72a13699c2 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSessionsApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSessionsApi.java @@ -26,7 +26,7 @@ public final class ServerSessionsApi { } /** - * Invokes {@code sessions.fork}. + * Source session identifier to fork from, optional event-ID boundary, and optional friendly name for the new session. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 @@ -35,4 +35,184 @@ public CompletableFuture fork(SessionsForkParams params) { return caller.invoke("sessions.fork", params, SessionsForkResult.class); } + /** + * Remote session connection parameters. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture connect() { + return caller.invoke("sessions.connect", java.util.Map.of(), SessionsConnectResult.class); + } + + /** + * Optional metadata-load limit and context filter applied to the returned sessions. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture list() { + return caller.invoke("sessions.list", java.util.Map.of(), SessionsListResult.class); + } + + /** + * GitHub task ID to look up. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture findByTaskId(SessionsFindByTaskIdParams params) { + return caller.invoke("sessions.findByTaskId", params, SessionsFindByTaskIdResult.class); + } + + /** + * UUID prefix to resolve to a unique session ID. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture findByPrefix(SessionsFindByPrefixParams params) { + return caller.invoke("sessions.findByPrefix", params, SessionsFindByPrefixResult.class); + } + + /** + * Optional working-directory context used to score session relevance. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture getLastForContext(SessionsGetLastForContextParams params) { + return caller.invoke("sessions.getLastForContext", params, SessionsGetLastForContextResult.class); + } + + /** + * Session ID whose event-log file path to compute. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture getEventFilePath() { + return caller.invoke("sessions.getEventFilePath", java.util.Map.of(), SessionsGetEventFilePathResult.class); + } + + /** + * Map of sessionId -> on-disk size in bytes for each session's workspace directory. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture getSizes() { + return caller.invoke("sessions.getSizes", java.util.Map.of(), SessionsGetSizesResult.class); + } + + /** + * Session IDs to test for live in-use locks. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture checkInUse(SessionsCheckInUseParams params) { + return caller.invoke("sessions.checkInUse", params, SessionsCheckInUseResult.class); + } + + /** + * Session ID to look up the persisted remote-steerable flag for. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture getPersistedRemoteSteerable() { + return caller.invoke("sessions.getPersistedRemoteSteerable", java.util.Map.of(), SessionsGetPersistedRemoteSteerableResult.class); + } + + /** + * Session ID to close. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture close() { + return caller.invoke("sessions.close", java.util.Map.of(), Void.class); + } + + /** + * Session IDs to close, deactivate, and delete from disk. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture bulkDelete(SessionsBulkDeleteParams params) { + return caller.invoke("sessions.bulkDelete", params, SessionsBulkDeleteResult.class); + } + + /** + * Age threshold and optional flags controlling which old sessions are pruned (or simulated when dryRun is true). + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture pruneOld(SessionsPruneOldParams params) { + return caller.invoke("sessions.pruneOld", params, SessionsPruneOldResult.class); + } + + /** + * Session ID whose pending events should be flushed to disk. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture save() { + return caller.invoke("sessions.save", java.util.Map.of(), Void.class); + } + + /** + * Session ID whose in-use lock should be released. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture releaseLock() { + return caller.invoke("sessions.releaseLock", java.util.Map.of(), Void.class); + } + + /** + * Session metadata records to enrich with summary and context information. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture enrichMetadata(SessionsEnrichMetadataParams params) { + return caller.invoke("sessions.enrichMetadata", params, SessionsEnrichMetadataResult.class); + } + + /** + * Active session ID and an optional flag for deferring repo-level hooks until folder trust. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture reloadPluginHooks(SessionsReloadPluginHooksParams params) { + return caller.invoke("sessions.reloadPluginHooks", params, Void.class); + } + + /** + * Active session ID whose deferred repo-level hooks should be loaded. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture loadDeferredRepoHooks() { + return caller.invoke("sessions.loadDeferredRepoHooks", java.util.Map.of(), SessionsLoadDeferredRepoHooksResult.class); + } + + /** + * Manager-wide additional plugins to register; replaces any previously-configured set. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture setAdditionalPlugins(SessionsSetAdditionalPluginsParams params) { + return caller.invoke("sessions.setAdditionalPlugins", params, Void.class); + } + } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSkill.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSkill.java new file mode 100644 index 0000000000..92f9e0ccca --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSkill.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `ServerSkill` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ServerSkill( + /** Unique identifier for the skill */ + @JsonProperty("name") String name, + /** Description of what the skill does */ + @JsonProperty("description") String description, + /** Source location type (e.g., project, personal-copilot, plugin, builtin) */ + @JsonProperty("source") SkillSource source, + /** Whether the skill can be invoked by the user as a slash command */ + @JsonProperty("userInvocable") Boolean userInvocable, + /** Whether the skill is currently enabled (based on global config) */ + @JsonProperty("enabled") Boolean enabled, + /** Absolute path to the skill file */ + @JsonProperty("path") String path, + /** The project path this skill belongs to (only for project/inherited skills) */ + @JsonProperty("projectPath") String projectPath +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSkillsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSkillsApi.java new file mode 100644 index 0000000000..8884edc979 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSkillsApi.java @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code skills} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class ServerSkillsApi { + + private final RpcCaller caller; + + /** API methods for the {@code skills.config} sub-namespace. */ + public final ServerSkillsConfigApi config; + + /** @param caller the RPC transport function */ + ServerSkillsApi(RpcCaller caller) { + this.caller = caller; + this.config = new ServerSkillsConfigApi(caller); + } + + /** + * Optional project paths and additional skill directories to include in discovery. + * @since 1.0.0 + */ + public CompletableFuture discover(SkillsDiscoverParams params) { + return caller.invoke("skills.discover", params, SkillsDiscoverResult.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSkillsConfigApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSkillsConfigApi.java new file mode 100644 index 0000000000..a0236fd333 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSkillsConfigApi.java @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code skills.config} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class ServerSkillsConfigApi { + + private final RpcCaller caller; + + /** @param caller the RPC transport function */ + ServerSkillsConfigApi(RpcCaller caller) { + this.caller = caller; + } + + /** + * Skill names to mark as disabled in global configuration, replacing any previous list. + * @since 1.0.0 + */ + public CompletableFuture setDisabledSkills(SkillsConfigSetDisabledSkillsParams params) { + return caller.invoke("skills.config.setDisabledSkills", params, Void.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerToolsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerToolsApi.java index 2eb2a90f54..81bbaece6d 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerToolsApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerToolsApi.java @@ -26,7 +26,7 @@ public final class ServerToolsApi { } /** - * Invokes {@code tools.list}. + * Optional model identifier whose tool overrides should be applied to the listing. * @since 1.0.0 */ public CompletableFuture list(ToolsListParams params) { diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAbortParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAbortParams.java new file mode 100644 index 0000000000..8f7c47f7c3 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAbortParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Parameters for aborting the current turn + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionAbortParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Finite reason code describing why the current turn was aborted */ + @JsonProperty("reason") AbortReason reason +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAbortResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAbortResult.java new file mode 100644 index 0000000000..4a8d42c719 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAbortResult.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Result of aborting the current turn + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionAbortResult( + /** Whether the abort completed successfully */ + @JsonProperty("success") Boolean success, + /** Error message if the abort failed */ + @JsonProperty("error") String error +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentApi.java index 47192e6310..ab91fe3ae7 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentApi.java @@ -30,7 +30,7 @@ public final class SessionAgentApi { } /** - * Invokes {@code session.agent.list}. + * Identifies the target session. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 @@ -40,7 +40,7 @@ public CompletableFuture list() { } /** - * Invokes {@code session.agent.getCurrent}. + * Identifies the target session. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 @@ -50,7 +50,7 @@ public CompletableFuture getCurrent() { } /** - * Invokes {@code session.agent.select}. + * Name of the custom agent to select for subsequent turns. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. @@ -65,7 +65,7 @@ public CompletableFuture select(SessionAgentSelectPara } /** - * Invokes {@code session.agent.deselect}. + * Identifies the target session. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 @@ -75,7 +75,7 @@ public CompletableFuture deselect() { } /** - * Invokes {@code session.agent.reload}. + * Identifies the target session. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentDeselectParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentDeselectParams.java index cd101194c7..d412c83cfd 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentDeselectParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentDeselectParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.agent.deselect} RPC method. + * Identifies the target session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentGetCurrentParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentGetCurrentParams.java index c05e5fa362..24bf532ff5 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentGetCurrentParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentGetCurrentParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.agent.getCurrent} RPC method. + * Identifies the target session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentGetCurrentResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentGetCurrentResult.java index b26fa1bbb5..fec2bc94f2 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentGetCurrentResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentGetCurrentResult.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.agent.getCurrent} RPC method. + * The currently selected custom agent, or null when using the default agent. * * @since 1.0.0 */ @@ -22,18 +22,6 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record SessionAgentGetCurrentResult( /** Currently selected custom agent, or null if using the default agent */ - @JsonProperty("agent") SessionAgentGetCurrentResultAgent agent + @JsonProperty("agent") AgentInfo agent ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionAgentGetCurrentResultAgent( - /** Unique identifier of the custom agent */ - @JsonProperty("name") String name, - /** Human-readable display name */ - @JsonProperty("displayName") String displayName, - /** Description of the agent's purpose */ - @JsonProperty("description") String description - ) { - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentListParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentListParams.java index e14ae40c0c..6badf614c5 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentListParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentListParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.agent.list} RPC method. + * Identifies the target session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentListResult.java index 98bff9a15a..9b618b248a 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentListResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentListResult.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.agent.list} RPC method. + * Custom agents available to the session. * * @since 1.0.0 */ @@ -23,18 +23,6 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record SessionAgentListResult( /** Available custom agents */ - @JsonProperty("agents") List agents + @JsonProperty("agents") List agents ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionAgentListResultAgentsItem( - /** Unique identifier of the custom agent */ - @JsonProperty("name") String name, - /** Human-readable display name */ - @JsonProperty("displayName") String displayName, - /** Description of the agent's purpose */ - @JsonProperty("description") String description - ) { - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentReloadParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentReloadParams.java index ea1b4050b0..5b30c866a0 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentReloadParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentReloadParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.agent.reload} RPC method. + * Identifies the target session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentReloadResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentReloadResult.java index 2b1d7395ac..d058293eac 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentReloadResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentReloadResult.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.agent.reload} RPC method. + * Custom agents available to the session after reloading definitions from disk. * * @since 1.0.0 */ @@ -23,18 +23,6 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record SessionAgentReloadResult( /** Reloaded custom agents */ - @JsonProperty("agents") List agents + @JsonProperty("agents") List agents ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionAgentReloadResultAgentsItem( - /** Unique identifier of the custom agent */ - @JsonProperty("name") String name, - /** Human-readable display name */ - @JsonProperty("displayName") String displayName, - /** Description of the agent's purpose */ - @JsonProperty("description") String description - ) { - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentSelectParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentSelectParams.java index 61777dde33..38532ace01 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentSelectParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentSelectParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.agent.select} RPC method. + * Name of the custom agent to select for subsequent turns. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentSelectResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentSelectResult.java index 2eff0778ee..ea19f56488 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentSelectResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentSelectResult.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.agent.select} RPC method. + * The newly selected custom agent. * * @since 1.0.0 */ @@ -22,19 +22,6 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record SessionAgentSelectResult( /** The newly selected custom agent */ - @JsonProperty("agent") SessionAgentSelectResultAgent agent + @JsonProperty("agent") AgentInfo agent ) { - - /** The newly selected custom agent */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionAgentSelectResultAgent( - /** Unique identifier of the custom agent */ - @JsonProperty("name") String name, - /** Human-readable display name */ - @JsonProperty("displayName") String displayName, - /** Description of the agent's purpose */ - @JsonProperty("description") String description - ) { - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAuthApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAuthApi.java new file mode 100644 index 0000000000..5b87bf3b3e --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAuthApi.java @@ -0,0 +1,57 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code auth} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionAuthApi { + + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionAuthApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture getStatus() { + return caller.invoke("session.auth.getStatus", java.util.Map.of("sessionId", this.sessionId), SessionAuthGetStatusResult.class); + } + + /** + * New auth credentials to install on the session. Omit to leave credentials unchanged. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture setCredentials(SessionAuthSetCredentialsParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.auth.setCredentials", _p, SessionAuthSetCredentialsResult.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAuthGetStatusParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAuthGetStatusParams.java new file mode 100644 index 0000000000..4a99886682 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAuthGetStatusParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionAuthGetStatusParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAuthGetStatusResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAuthGetStatusResult.java new file mode 100644 index 0000000000..6e58fe6c7d --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAuthGetStatusResult.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Authentication status and account metadata for the session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionAuthGetStatusResult( + /** Whether the session has resolved authentication */ + @JsonProperty("isAuthenticated") Boolean isAuthenticated, + /** Authentication type */ + @JsonProperty("authType") AuthInfoType authType, + /** Authentication host URL */ + @JsonProperty("host") String host, + /** Authenticated login/username, if available */ + @JsonProperty("login") String login, + /** Human-readable authentication status description */ + @JsonProperty("statusMessage") String statusMessage, + /** Copilot plan tier (e.g., individual_pro, business) */ + @JsonProperty("copilotPlan") String copilotPlan +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAuthSetCredentialsParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAuthSetCredentialsParams.java new file mode 100644 index 0000000000..5e5e6b5028 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAuthSetCredentialsParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * New auth credentials to install on the session. Omit to leave credentials unchanged. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionAuthSetCredentialsParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** The new auth credentials to install on the session. When omitted or `undefined`, the call is a no-op and the session's existing credentials are preserved. The runtime stores the value verbatim and uses it for outbound model/API requests; it does NOT re-validate or re-fetch the associated Copilot user response. Several variants carry secret material; treat this method's params as containing secrets at rest and in transit. */ + @JsonProperty("credentials") Object credentials +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAuthSetCredentialsResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAuthSetCredentialsResult.java new file mode 100644 index 0000000000..5aef213a4f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAuthSetCredentialsResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the credential update succeeded. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionAuthSetCredentialsResult( + /** Whether the operation succeeded */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsApi.java index 351a2d14cd..7a142ecf99 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsApi.java @@ -30,10 +30,37 @@ public final class SessionCommandsApi { } /** - * Invokes {@code session.commands.handlePendingCommand}. + * Optional filters controlling which command sources to include in the listing. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture list() { + return caller.invoke("session.commands.list", java.util.Map.of("sessionId", this.sessionId), SessionCommandsListResult.class); + } + + /** + * Slash command name and optional raw input string to invoke. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture invoke(SessionCommandsInvokeParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.commands.invoke", _p, Void.class); + } + + /** + * Pending command request ID and an optional error if the client handler failed. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 */ public CompletableFuture handlePendingCommand(SessionCommandsHandlePendingCommandParams params) { @@ -42,4 +69,49 @@ public CompletableFuture handlePendin return caller.invoke("session.commands.handlePendingCommand", _p, SessionCommandsHandlePendingCommandResult.class); } + /** + * Slash command name and argument string to execute synchronously. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture execute(SessionCommandsExecuteParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.commands.execute", _p, SessionCommandsExecuteResult.class); + } + + /** + * Slash-prefixed command string to enqueue for FIFO processing. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture enqueue(SessionCommandsEnqueueParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.commands.enqueue", _p, SessionCommandsEnqueueResult.class); + } + + /** + * Queued-command request ID and the result indicating whether the host executed it (and whether to stop processing further queued commands). + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture respondToQueuedCommand(SessionCommandsRespondToQueuedCommandParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.commands.respondToQueuedCommand", _p, SessionCommandsRespondToQueuedCommandResult.class); + } + } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsEnqueueParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsEnqueueParams.java new file mode 100644 index 0000000000..6ca80d2511 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsEnqueueParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Slash-prefixed command string to enqueue for FIFO processing. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCommandsEnqueueParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Slash-prefixed command string to enqueue, e.g. '/compact' or '/model gpt-4'. Queued FIFO with any in-flight items; if the session is idle, processing kicks off immediately. */ + @JsonProperty("command") String command +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsEnqueueResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsEnqueueResult.java new file mode 100644 index 0000000000..e968e1df86 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsEnqueueResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the command was accepted into the local execution queue. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCommandsEnqueueResult( + /** True when the command was accepted into the local execution queue. False when the call targets a session that does not support local command queueing (e.g. remote sessions). */ + @JsonProperty("queued") Boolean queued +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsExecuteParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsExecuteParams.java new file mode 100644 index 0000000000..1f1e73acbe --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsExecuteParams.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Slash command name and argument string to execute synchronously. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCommandsExecuteParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Name of the slash command to invoke (without the leading '/'). */ + @JsonProperty("commandName") String commandName, + /** Argument string to pass to the command (empty string if none). */ + @JsonProperty("args") String args +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsExecuteResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsExecuteResult.java new file mode 100644 index 0000000000..a03b08c661 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsExecuteResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Error message produced while executing the command, if any. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCommandsExecuteResult( + /** Error message produced while executing the command, if any. Omitted when the handler succeeded. */ + @JsonProperty("error") String error +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsHandlePendingCommandParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsHandlePendingCommandParams.java index e14d29486c..e036870e1b 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsHandlePendingCommandParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsHandlePendingCommandParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.commands.handlePendingCommand} RPC method. + * Pending command request ID and an optional error if the client handler failed. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsHandlePendingCommandResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsHandlePendingCommandResult.java index 8c79beaaee..101714028c 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsHandlePendingCommandResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsHandlePendingCommandResult.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.commands.handlePendingCommand} RPC method. + * Indicates whether the pending client-handled command was completed successfully. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsInvokeParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsInvokeParams.java new file mode 100644 index 0000000000..ec35a5bb30 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsInvokeParams.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Slash command name and optional raw input string to invoke. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCommandsInvokeParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Command name. Leading slashes are stripped and the name is matched case-insensitively. */ + @JsonProperty("name") String name, + /** Raw input after the command name */ + @JsonProperty("input") String input +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsListParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsListParams.java new file mode 100644 index 0000000000..a1fa2728b1 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsListParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Optional filters controlling which command sources to include in the listing. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCommandsListParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsListResult.java new file mode 100644 index 0000000000..aae276f6cb --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsListResult.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Slash commands available in the session, after applying any include/exclude filters. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCommandsListResult( + /** Commands available in this session */ + @JsonProperty("commands") List commands +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsRespondToQueuedCommandParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsRespondToQueuedCommandParams.java new file mode 100644 index 0000000000..8eb5d2dbc0 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsRespondToQueuedCommandParams.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Queued-command request ID and the result indicating whether the host executed it (and whether to stop processing further queued commands). + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCommandsRespondToQueuedCommandParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Request ID from the `command.queued` event the host is responding to. */ + @JsonProperty("requestId") String requestId, + /** Result of the queued command execution. */ + @JsonProperty("result") Object result +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsRespondToQueuedCommandResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsRespondToQueuedCommandResult.java new file mode 100644 index 0000000000..3cf5a6de3e --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsRespondToQueuedCommandResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the queued-command response was matched to a pending request. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCommandsRespondToQueuedCommandResult( + /** Whether a pending queued command with the given request ID was found and resolved. False when the request was already resolved, cancelled, or unknown. */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionContext.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionContext.java new file mode 100644 index 0000000000..1a8c148bd4 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionContext.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `SessionContext` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionContext( + /** Most recent working directory for this session */ + @JsonProperty("cwd") String cwd, + /** Git repository root, if the cwd was inside a git repo */ + @JsonProperty("gitRoot") String gitRoot, + /** Repository slug in `owner/name` form, when known */ + @JsonProperty("repository") String repository, + /** Repository host type */ + @JsonProperty("hostType") SessionContextHostType hostType, + /** Active git branch */ + @JsonProperty("branch") String branch +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionContextHostType.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionContextHostType.java new file mode 100644 index 0000000000..db0945e314 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionContextHostType.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Repository host type + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SessionContextHostType { + /** The {@code github} variant. */ + GITHUB("github"), + /** The {@code ado} variant. */ + ADO("ado"); + + private final String value; + SessionContextHostType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SessionContextHostType fromValue(String value) { + for (SessionContextHostType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SessionContextHostType value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogApi.java new file mode 100644 index 0000000000..58351e99a6 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogApi.java @@ -0,0 +1,87 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code eventLog} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionEventLogApi { + + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionEventLogApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Cursor, batch size, and optional long-poll/filter parameters for reading session events. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture read(SessionEventLogReadParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.eventLog.read", _p, SessionEventLogReadResult.class); + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture tail() { + return caller.invoke("session.eventLog.tail", java.util.Map.of("sessionId", this.sessionId), SessionEventLogTailResult.class); + } + + /** + * Event type to register consumer interest for, used by runtime gating logic. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture registerInterest(SessionEventLogRegisterInterestParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.eventLog.registerInterest", _p, SessionEventLogRegisterInterestResult.class); + } + + /** + * Opaque handle previously returned by `registerInterest` to release. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture releaseInterest(SessionEventLogReleaseInterestParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.eventLog.releaseInterest", _p, SessionEventLogReleaseInterestResult.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogReadParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogReadParams.java new file mode 100644 index 0000000000..cad49d4525 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogReadParams.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Cursor, batch size, and optional long-poll/filter parameters for reading session events. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionEventLogReadParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Opaque cursor returned by a previous read. Omit on the first call to start from the beginning of the session's persisted history. */ + @JsonProperty("cursor") String cursor, + /** Maximum number of events to return in this batch (1–1000, default 200). */ + @JsonProperty("max") Long max, + /** Milliseconds to wait for new events when the cursor is at the tail of history. 0 (default) returns immediately even if no events are available. Capped at 30000ms. Ephemeral events that arrive during the wait are delivered in this batch but are NOT replayable on a subsequent read (use a non-zero waitMs in your next call to capture future ephemerals as they happen). */ + @JsonProperty("waitMs") Long waitMs, + /** Either '*' to receive all event types, or a non-empty list of event types to receive */ + @JsonProperty("types") Object types, + /** Agent-scope filter: 'primary' returns only main-agent events plus events whose type starts with 'subagent.' (matching the typed-subscription default behavior); 'all' returns events from all agents (matching wildcard-subscription behavior). Default is 'all' to preserve wildcard semantics for catch-up callers. */ + @JsonProperty("agentScope") EventsAgentScope agentScope +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogReadResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogReadResult.java new file mode 100644 index 0000000000..725a767926 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogReadResult.java @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Batch of session events returned by a read, with cursor and continuation metadata. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionEventLogReadResult( + /** Events are delivered in two batches per read: persisted events first (in append order), then ephemeral events (in seq order). When `waitMs > 0` and the catch-up batches were empty, post-wait events follow the same two-batch ordering. Persisted and ephemeral events do not interleave within a single read. */ + @JsonProperty("events") List events, + /** Opaque cursor for the next read. Pass back unchanged in the next read.cursor to continue from where this read left off. Always present, even when no events were returned. */ + @JsonProperty("cursor") String cursor, + /** True when the read returned `max` events and more events are available immediately. When false, the next read with a non-zero `waitMs` will block until a new event arrives or the wait expires. */ + @JsonProperty("hasMore") Boolean hasMore, + /** Cursor status: 'ok' means the cursor was applied successfully; 'expired' means the cursor referred to an event that no longer exists in history (e.g. truncated or compacted away) and the read started from the beginning of the remaining history. */ + @JsonProperty("cursorStatus") EventsCursorStatus cursorStatus +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogRegisterInterestParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogRegisterInterestParams.java new file mode 100644 index 0000000000..3bddc69041 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogRegisterInterestParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Event type to register consumer interest for, used by runtime gating logic. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionEventLogRegisterInterestParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** The event type the consumer wants the runtime to treat as 'observed' for behavior-switching gating. Some runtime code paths inspect whether any consumer is interested in a specific event type and choose a different implementation accordingly (e.g. `mcp.oauth_required`: when interest is registered the runtime delegates the full interactive OAuth flow to the consumer; when no interest is registered the runtime installs a browserless fallback that silently reuses cached tokens). SDK clients that long-poll events do NOT automatically appear as listeners to these gating checks β€” they must explicitly call `registerInterest` for each event type they want the runtime to count as having a consumer. Multiple registrations for the same event type from the same or different consumers are tracked independently and must each be released. See: `mcp.oauth_required`, `sampling.requested`, `auto_mode_switch.requested`, `user_input.requested`, `elicitation.requested`, `command.queued`, `exit_plan_mode.requested`. */ + @JsonProperty("eventType") String eventType +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogRegisterInterestResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogRegisterInterestResult.java new file mode 100644 index 0000000000..e0a6bb5a5f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogRegisterInterestResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Opaque handle representing an event-type interest registration. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionEventLogRegisterInterestResult( + /** Opaque handle for this registration. Pass to releaseInterest to release. Each call to registerInterest produces a fresh handle, even when the same eventType is registered multiple times. */ + @JsonProperty("handle") String handle +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogReleaseInterestParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogReleaseInterestParams.java new file mode 100644 index 0000000000..c6bd4efb1e --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogReleaseInterestParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Opaque handle previously returned by `registerInterest` to release. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionEventLogReleaseInterestParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Handle returned by a previous `registerInterest` call. Idempotent: releasing an unknown or already-released handle is a no-op (returns success). When the last outstanding handle for an event type is released, the runtime reverts to its 'no consumer' code path for that event type. */ + @JsonProperty("handle") String handle +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogReleaseInterestResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogReleaseInterestResult.java new file mode 100644 index 0000000000..0ba6b149a2 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogReleaseInterestResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the operation succeeded. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionEventLogReleaseInterestResult( + /** Whether the operation succeeded */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogTailParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogTailParams.java new file mode 100644 index 0000000000..270af92dcb --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogTailParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionEventLogTailParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogTailResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogTailResult.java new file mode 100644 index 0000000000..a966cd5913 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionEventLogTailResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Snapshot of the current tail cursor without returning any events. Use this when a consumer wants to subscribe to live events going forward without first paginating through the entire persisted history (which would happen if `read` were called without a cursor on a long-lived session). + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionEventLogTailResult( + /** Opaque cursor pointing at the current tail of the session's persisted-events history. Pass back to `read` to receive only events that arrive AFTER this snapshot. When the session has no events, this returns the same sentinel as an unset cursor (i.e. equivalent to omitting the cursor on a first read). */ + @JsonProperty("cursor") String cursor +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsApi.java index 38f8dedf2a..cf7e6a5059 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsApi.java @@ -30,7 +30,7 @@ public final class SessionExtensionsApi { } /** - * Invokes {@code session.extensions.list}. + * Identifies the target session. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 @@ -40,7 +40,7 @@ public CompletableFuture list() { } /** - * Invokes {@code session.extensions.enable}. + * Source-qualified extension identifier to enable for the session. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. @@ -55,7 +55,7 @@ public CompletableFuture enable(SessionExtensionsEnableParams params) { } /** - * Invokes {@code session.extensions.disable}. + * Source-qualified extension identifier to disable for the session. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. @@ -70,7 +70,7 @@ public CompletableFuture disable(SessionExtensionsDisableParams params) { } /** - * Invokes {@code session.extensions.reload}. + * Identifies the target session. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsDisableParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsDisableParams.java index 35d68997be..896ee43c88 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsDisableParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsDisableParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.extensions.disable} RPC method. + * Source-qualified extension identifier to disable for the session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsEnableParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsEnableParams.java index 1161a7a739..45db74f495 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsEnableParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsEnableParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.extensions.enable} RPC method. + * Source-qualified extension identifier to enable for the session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsListParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsListParams.java index 340153ca11..b1c320f689 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsListParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsListParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.extensions.list} RPC method. + * Identifies the target session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsListResult.java index 0f6e91d820..ae3aa777f8 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsListResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsListResult.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.extensions.list} RPC method. + * Extensions discovered for the session, with their current status. * * @since 1.0.0 */ @@ -23,66 +23,6 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record SessionExtensionsListResult( /** Discovered extensions and their current status */ - @JsonProperty("extensions") List extensions + @JsonProperty("extensions") List extensions ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionExtensionsListResultExtensionsItem( - /** Source-qualified ID (e.g., 'project:my-ext', 'user:auth-helper') */ - @JsonProperty("id") String id, - /** Extension name (directory name) */ - @JsonProperty("name") String name, - /** Discovery source: project (.github/extensions/) or user (~/.copilot/extensions/) */ - @JsonProperty("source") SessionExtensionsListResultExtensionsItemSource source, - /** Current status: running, disabled, failed, or starting */ - @JsonProperty("status") SessionExtensionsListResultExtensionsItemStatus status, - /** Process ID if the extension is running */ - @JsonProperty("pid") Long pid - ) { - - /** Discovery source: project (.github/extensions/) or user (~/.copilot/extensions/) */ - public enum SessionExtensionsListResultExtensionsItemSource { - /** The {@code project} variant. */ - PROJECT("project"), - /** The {@code user} variant. */ - USER("user"); - - private final String value; - SessionExtensionsListResultExtensionsItemSource(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionExtensionsListResultExtensionsItemSource fromValue(String value) { - for (SessionExtensionsListResultExtensionsItemSource v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionExtensionsListResultExtensionsItemSource value: " + value); - } - } - - /** Current status: running, disabled, failed, or starting */ - public enum SessionExtensionsListResultExtensionsItemStatus { - /** The {@code running} variant. */ - RUNNING("running"), - /** The {@code disabled} variant. */ - DISABLED("disabled"), - /** The {@code failed} variant. */ - FAILED("failed"), - /** The {@code starting} variant. */ - STARTING("starting"); - - private final String value; - SessionExtensionsListResultExtensionsItemStatus(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionExtensionsListResultExtensionsItemStatus fromValue(String value) { - for (SessionExtensionsListResultExtensionsItemStatus v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionExtensionsListResultExtensionsItemStatus value: " + value); - } - } - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsReloadParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsReloadParams.java index 36d1578416..e192ededf7 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsReloadParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsReloadParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.extensions.reload} RPC method. + * Identifies the target session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFleetApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFleetApi.java index d7aa719a71..3c59b0c4ab 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFleetApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFleetApi.java @@ -30,7 +30,7 @@ public final class SessionFleetApi { } /** - * Invokes {@code session.fleet.start}. + * Optional user prompt to combine with the fleet orchestration instructions. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFleetStartParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFleetStartParams.java index 871239460e..5e687cec50 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFleetStartParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFleetStartParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.fleet.start} RPC method. + * Optional user prompt to combine with the fleet orchestration instructions. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFleetStartResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFleetStartResult.java index a52813aa06..e328b4ec21 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFleetStartResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFleetStartResult.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.fleet.start} RPC method. + * Indicates whether fleet mode was successfully activated. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsAppendFileParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsAppendFileParams.java index f50b670eea..84a1807ce1 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsAppendFileParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsAppendFileParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code sessionFs.appendFile} RPC method. + * File path, content to append, and optional mode for the client-provided session filesystem. * * @since 1.0.0 */ @@ -28,6 +28,6 @@ public record SessionFsAppendFileParams( /** Content to append */ @JsonProperty("content") String content, /** Optional POSIX-style mode for newly created files */ - @JsonProperty("mode") Double mode + @JsonProperty("mode") Long mode ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsError.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsError.java new file mode 100644 index 0000000000..a78aa53748 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsError.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Describes a filesystem error. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionFsError( + /** Error classification */ + @JsonProperty("code") SessionFsErrorCode code, + /** Free-form detail about the error, for logging/diagnostics */ + @JsonProperty("message") String message +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsErrorCode.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsErrorCode.java new file mode 100644 index 0000000000..099ff1236b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsErrorCode.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Error classification + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SessionFsErrorCode { + /** The {@code ENOENT} variant. */ + ENOENT("ENOENT"), + /** The {@code UNKNOWN} variant. */ + UNKNOWN("UNKNOWN"); + + private final String value; + SessionFsErrorCode(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SessionFsErrorCode fromValue(String value) { + for (SessionFsErrorCode v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SessionFsErrorCode value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsExistsParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsExistsParams.java index c59031c57a..f5217f532a 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsExistsParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsExistsParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code sessionFs.exists} RPC method. + * Path to test for existence in the client-provided session filesystem. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsExistsResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsExistsResult.java index 8822074652..6209fd6356 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsExistsResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsExistsResult.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code sessionFs.exists} RPC method. + * Indicates whether the requested path exists in the client-provided session filesystem. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsMkdirParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsMkdirParams.java index 53fc35f256..80e0e95a22 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsMkdirParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsMkdirParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code sessionFs.mkdir} RPC method. + * Directory path to create in the client-provided session filesystem, with options for recursive creation and POSIX mode. * * @since 1.0.0 */ @@ -28,6 +28,6 @@ public record SessionFsMkdirParams( /** Create parent directories as needed */ @JsonProperty("recursive") Boolean recursive, /** Optional POSIX-style mode for newly created directories */ - @JsonProperty("mode") Double mode + @JsonProperty("mode") Long mode ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReadFileParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReadFileParams.java index f1cad41edd..851c1ac88c 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReadFileParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReadFileParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code sessionFs.readFile} RPC method. + * Path of the file to read from the client-provided session filesystem. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReadFileResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReadFileResult.java index c036735381..c3abbde10e 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReadFileResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReadFileResult.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code sessionFs.readFile} RPC method. + * File content as a UTF-8 string, or a filesystem error if the read failed. * * @since 1.0.0 */ @@ -22,6 +22,8 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record SessionFsReadFileResult( /** File content as UTF-8 string */ - @JsonProperty("content") String content + @JsonProperty("content") String content, + /** Describes a filesystem error. */ + @JsonProperty("error") SessionFsError error ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirParams.java index e3f09c3702..1b18f9df57 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code sessionFs.readdir} RPC method. + * Directory path whose entries should be listed from the client-provided session filesystem. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirResult.java index 3079b98134..053017d1ef 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirResult.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code sessionFs.readdir} RPC method. + * Names of entries in the requested directory, or a filesystem error if the read failed. * * @since 1.0.0 */ @@ -23,6 +23,8 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record SessionFsReaddirResult( /** Entry names in the directory */ - @JsonProperty("entries") List entries + @JsonProperty("entries") List entries, + /** Describes a filesystem error. */ + @JsonProperty("error") SessionFsError error ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirWithTypesEntry.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirWithTypesEntry.java new file mode 100644 index 0000000000..7cafa538e9 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirWithTypesEntry.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `SessionFsReaddirWithTypesEntry` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionFsReaddirWithTypesEntry( + /** Entry name */ + @JsonProperty("name") String name, + /** Entry type */ + @JsonProperty("type") SessionFsReaddirWithTypesEntryType type +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirWithTypesEntryType.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirWithTypesEntryType.java new file mode 100644 index 0000000000..71640ec347 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirWithTypesEntryType.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Entry type + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SessionFsReaddirWithTypesEntryType { + /** The {@code file} variant. */ + FILE("file"), + /** The {@code directory} variant. */ + DIRECTORY("directory"); + + private final String value; + SessionFsReaddirWithTypesEntryType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SessionFsReaddirWithTypesEntryType fromValue(String value) { + for (SessionFsReaddirWithTypesEntryType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SessionFsReaddirWithTypesEntryType value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirWithTypesParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirWithTypesParams.java index 533dbb4169..b092d20753 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirWithTypesParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirWithTypesParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code sessionFs.readdirWithTypes} RPC method. + * Directory path whose entries (with type information) should be listed from the client-provided session filesystem. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirWithTypesResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirWithTypesResult.java index 0e8dc35878..13f1056224 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirWithTypesResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirWithTypesResult.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code sessionFs.readdirWithTypes} RPC method. + * Entries in the requested directory paired with file/directory type information, or a filesystem error if the read failed. * * @since 1.0.0 */ @@ -23,36 +23,8 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record SessionFsReaddirWithTypesResult( /** Directory entries with type information */ - @JsonProperty("entries") List entries + @JsonProperty("entries") List entries, + /** Describes a filesystem error. */ + @JsonProperty("error") SessionFsError error ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionFsReaddirWithTypesResultEntriesItem( - /** Entry name */ - @JsonProperty("name") String name, - /** Entry type */ - @JsonProperty("type") SessionFsReaddirWithTypesResultEntriesItemType type - ) { - - /** Entry type */ - public enum SessionFsReaddirWithTypesResultEntriesItemType { - /** The {@code file} variant. */ - FILE("file"), - /** The {@code directory} variant. */ - DIRECTORY("directory"); - - private final String value; - SessionFsReaddirWithTypesResultEntriesItemType(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionFsReaddirWithTypesResultEntriesItemType fromValue(String value) { - for (SessionFsReaddirWithTypesResultEntriesItemType v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionFsReaddirWithTypesResultEntriesItemType value: " + value); - } - } - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsRenameParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsRenameParams.java index 6a18e80df5..f1d758cba2 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsRenameParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsRenameParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code sessionFs.rename} RPC method. + * Source and destination paths for renaming or moving an entry in the client-provided session filesystem. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsRmParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsRmParams.java index 50661a58e4..b73a9d6318 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsRmParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsRmParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code sessionFs.rm} RPC method. + * Path to remove from the client-provided session filesystem, with options for recursive removal and force. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSetProviderCapabilities.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSetProviderCapabilities.java new file mode 100644 index 0000000000..5701821259 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSetProviderCapabilities.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Optional capabilities declared by the provider + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionFsSetProviderCapabilities( + /** Whether the provider supports SQLite query/exists operations */ + @JsonProperty("sqlite") Boolean sqlite +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSetProviderConventions.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSetProviderConventions.java new file mode 100644 index 0000000000..ac669a1891 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSetProviderConventions.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Path conventions used by this filesystem + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SessionFsSetProviderConventions { + /** The {@code windows} variant. */ + WINDOWS("windows"), + /** The {@code posix} variant. */ + POSIX("posix"); + + private final String value; + SessionFsSetProviderConventions(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SessionFsSetProviderConventions fromValue(String value) { + for (SessionFsSetProviderConventions v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SessionFsSetProviderConventions value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSetProviderParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSetProviderParams.java index bbab3b9344..e03dcfcc82 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSetProviderParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSetProviderParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code sessionFs.setProvider} RPC method. + * Initial working directory, session-state path layout, and path conventions used to register the calling SDK client as the session filesystem provider. * * @since 1.0.0 */ @@ -26,26 +26,8 @@ public record SessionFsSetProviderParams( /** Path within each session's SessionFs where the runtime stores files for that session */ @JsonProperty("sessionStatePath") String sessionStatePath, /** Path conventions used by this filesystem */ - @JsonProperty("conventions") SessionFsSetProviderParamsConventions conventions + @JsonProperty("conventions") SessionFsSetProviderConventions conventions, + /** Optional capabilities declared by the provider */ + @JsonProperty("capabilities") SessionFsSetProviderCapabilities capabilities ) { - - /** Path conventions used by this filesystem */ - public enum SessionFsSetProviderParamsConventions { - /** The {@code windows} variant. */ - WINDOWS("windows"), - /** The {@code posix} variant. */ - POSIX("posix"); - - private final String value; - SessionFsSetProviderParamsConventions(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionFsSetProviderParamsConventions fromValue(String value) { - for (SessionFsSetProviderParamsConventions v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionFsSetProviderParamsConventions value: " + value); - } - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSetProviderResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSetProviderResult.java index dcda9e587a..621ed7d05e 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSetProviderResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSetProviderResult.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code sessionFs.setProvider} RPC method. + * Indicates whether the calling client was registered as the session filesystem provider. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSqliteExistsParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSqliteExistsParams.java new file mode 100644 index 0000000000..47f2bf045c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSqliteExistsParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionFsSqliteExistsParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSqliteExistsResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSqliteExistsResult.java new file mode 100644 index 0000000000..0cccf0cece --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSqliteExistsResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the per-session SQLite database already exists. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionFsSqliteExistsResult( + /** Whether the session database already exists */ + @JsonProperty("exists") Boolean exists +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSqliteQueryParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSqliteQueryParams.java new file mode 100644 index 0000000000..1f07d8cacf --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSqliteQueryParams.java @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import javax.annotation.processing.Generated; + +/** + * SQL query, query type, and optional bind parameters for executing a SQLite query against the per-session database. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionFsSqliteQueryParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** SQL query to execute */ + @JsonProperty("query") String query, + /** How to execute the query: 'exec' for DDL/multi-statement (no results), 'query' for SELECT (returns rows), 'run' for INSERT/UPDATE/DELETE (returns rowsAffected) */ + @JsonProperty("queryType") SessionFsSqliteQueryType queryType, + /** Optional named bind parameters */ + @JsonProperty("params") Map params +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSqliteQueryResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSqliteQueryResult.java new file mode 100644 index 0000000000..edc1e9c832 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSqliteQueryResult.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; +import javax.annotation.processing.Generated; + +/** + * Query results including rows, columns, and rows affected, or a filesystem error if execution failed. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionFsSqliteQueryResult( + /** For SELECT: array of row objects. For others: empty array. */ + @JsonProperty("rows") List> rows, + /** Column names from the result set */ + @JsonProperty("columns") List columns, + /** Number of rows affected (for INSERT/UPDATE/DELETE) */ + @JsonProperty("rowsAffected") Long rowsAffected, + /** SQLite last_insert_rowid() value for INSERT. */ + @JsonProperty("lastInsertRowid") Long lastInsertRowid, + /** Describes a filesystem error. */ + @JsonProperty("error") SessionFsError error +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSqliteQueryType.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSqliteQueryType.java new file mode 100644 index 0000000000..ef0143da28 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsSqliteQueryType.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * How to execute the query: 'exec' for DDL/multi-statement (no results), 'query' for SELECT (returns rows), 'run' for INSERT/UPDATE/DELETE (returns rowsAffected) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SessionFsSqliteQueryType { + /** The {@code exec} variant. */ + EXEC("exec"), + /** The {@code query} variant. */ + QUERY("query"), + /** The {@code run} variant. */ + RUN("run"); + + private final String value; + SessionFsSqliteQueryType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SessionFsSqliteQueryType fromValue(String value) { + for (SessionFsSqliteQueryType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SessionFsSqliteQueryType value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsStatParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsStatParams.java index 5d60281c8b..410b168fd0 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsStatParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsStatParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code sessionFs.stat} RPC method. + * Path whose metadata should be returned from the client-provided session filesystem. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsStatResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsStatResult.java index 39b40a9137..2e3b811d9c 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsStatResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsStatResult.java @@ -10,10 +10,11 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; import javax.annotation.processing.Generated; /** - * Result for the {@code sessionFs.stat} RPC method. + * Filesystem metadata for the requested path, or a filesystem error if the stat failed. * * @since 1.0.0 */ @@ -26,10 +27,12 @@ public record SessionFsStatResult( /** Whether the path is a directory */ @JsonProperty("isDirectory") Boolean isDirectory, /** File size in bytes */ - @JsonProperty("size") Double size, + @JsonProperty("size") Long size, /** ISO 8601 timestamp of last modification */ - @JsonProperty("mtime") String mtime, + @JsonProperty("mtime") OffsetDateTime mtime, /** ISO 8601 timestamp of creation */ - @JsonProperty("birthtime") String birthtime + @JsonProperty("birthtime") OffsetDateTime birthtime, + /** Describes a filesystem error. */ + @JsonProperty("error") SessionFsError error ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsWriteFileParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsWriteFileParams.java index 02e1dea77b..ed08b2f7df 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsWriteFileParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsWriteFileParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code sessionFs.writeFile} RPC method. + * File path, content to write, and optional mode for the client-provided session filesystem. * * @since 1.0.0 */ @@ -28,6 +28,6 @@ public record SessionFsWriteFileParams( /** Content to write */ @JsonProperty("content") String content, /** Optional POSIX-style mode for newly created files */ - @JsonProperty("mode") Double mode + @JsonProperty("mode") Long mode ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryAbortManualCompactionParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryAbortManualCompactionParams.java new file mode 100644 index 0000000000..c08926c395 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryAbortManualCompactionParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionHistoryAbortManualCompactionParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryAbortManualCompactionResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryAbortManualCompactionResult.java new file mode 100644 index 0000000000..efefbd1a05 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryAbortManualCompactionResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether an in-progress manual compaction was aborted. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionHistoryAbortManualCompactionResult( + /** Whether an in-progress manual compaction was aborted. False when no manual compaction was running, when its abort controller was already aborted, or when the session is remote. */ + @JsonProperty("aborted") Boolean aborted +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryApi.java index e1f179e53b..143250b0ce 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryApi.java @@ -30,7 +30,7 @@ public final class SessionHistoryApi { } /** - * Invokes {@code session.history.compact}. + * Optional compaction parameters. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 @@ -40,7 +40,7 @@ public CompletableFuture compact() { } /** - * Invokes {@code session.history.truncate}. + * Identifier of the event to truncate to; this event and all later events are removed. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. @@ -54,4 +54,34 @@ public CompletableFuture truncate(SessionHistoryTr return caller.invoke("session.history.truncate", _p, SessionHistoryTruncateResult.class); } + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture cancelBackgroundCompaction() { + return caller.invoke("session.history.cancelBackgroundCompaction", java.util.Map.of("sessionId", this.sessionId), SessionHistoryCancelBackgroundCompactionResult.class); + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture abortManualCompaction() { + return caller.invoke("session.history.abortManualCompaction", java.util.Map.of("sessionId", this.sessionId), SessionHistoryAbortManualCompactionResult.class); + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture summarizeForHandoff() { + return caller.invoke("session.history.summarizeForHandoff", java.util.Map.of("sessionId", this.sessionId), SessionHistorySummarizeForHandoffResult.class); + } + } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryCancelBackgroundCompactionParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryCancelBackgroundCompactionParams.java new file mode 100644 index 0000000000..faba738ed1 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryCancelBackgroundCompactionParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionHistoryCancelBackgroundCompactionParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryCancelBackgroundCompactionResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryCancelBackgroundCompactionResult.java new file mode 100644 index 0000000000..22d9b926e5 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryCancelBackgroundCompactionResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether an in-progress background compaction was cancelled. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionHistoryCancelBackgroundCompactionResult( + /** Whether an in-progress background compaction was cancelled. False when no compaction was running, when the session is remote, or when the underlying processor was unavailable. */ + @JsonProperty("cancelled") Boolean cancelled +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryCompactParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryCompactParams.java index 4b352cc623..30a3fd3933 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryCompactParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryCompactParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.history.compact} RPC method. + * Optional compaction parameters. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryCompactResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryCompactResult.java index b20e2c4493..e7546b44cb 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryCompactResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryCompactResult.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.history.compact} RPC method. + * Compaction outcome with the number of tokens and messages removed, summary text, and the resulting context window breakdown. * * @since 1.0.0 */ @@ -24,29 +24,12 @@ public record SessionHistoryCompactResult( /** Whether compaction completed successfully */ @JsonProperty("success") Boolean success, /** Number of tokens freed by compaction */ - @JsonProperty("tokensRemoved") Double tokensRemoved, + @JsonProperty("tokensRemoved") Long tokensRemoved, /** Number of messages removed during compaction */ - @JsonProperty("messagesRemoved") Double messagesRemoved, + @JsonProperty("messagesRemoved") Long messagesRemoved, + /** Summary text produced by compaction. Omitted when compaction did not produce a summary (e.g. failure path). */ + @JsonProperty("summaryContent") String summaryContent, /** Post-compaction context window usage breakdown */ - @JsonProperty("contextWindow") SessionHistoryCompactResultContextWindow contextWindow + @JsonProperty("contextWindow") HistoryCompactContextWindow contextWindow ) { - - /** Post-compaction context window usage breakdown */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionHistoryCompactResultContextWindow( - /** Maximum token count for the model's context window */ - @JsonProperty("tokenLimit") Double tokenLimit, - /** Current total tokens in the context window (system + conversation + tool definitions) */ - @JsonProperty("currentTokens") Double currentTokens, - /** Current number of messages in the conversation */ - @JsonProperty("messagesLength") Double messagesLength, - /** Token count from system message(s) */ - @JsonProperty("systemTokens") Double systemTokens, - /** Token count from non-system messages (user, assistant, tool) */ - @JsonProperty("conversationTokens") Double conversationTokens, - /** Token count from tool definitions */ - @JsonProperty("toolDefinitionsTokens") Double toolDefinitionsTokens - ) { - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistorySummarizeForHandoffParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistorySummarizeForHandoffParams.java new file mode 100644 index 0000000000..946b9232ff --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistorySummarizeForHandoffParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionHistorySummarizeForHandoffParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistorySummarizeForHandoffResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistorySummarizeForHandoffResult.java new file mode 100644 index 0000000000..d49b225d23 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistorySummarizeForHandoffResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Markdown summary of the conversation context (empty when not available). + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionHistorySummarizeForHandoffResult( + /** Markdown summary of the conversation context produced by an LLM. Empty string when there are no messages or when the session does not support local summarization. */ + @JsonProperty("summary") String summary +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryTruncateParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryTruncateParams.java index 09ddf68df1..a56ed6994b 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryTruncateParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryTruncateParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.history.truncate} RPC method. + * Identifier of the event to truncate to; this event and all later events are removed. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryTruncateResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryTruncateResult.java index 65f71d4c84..7905c66b9b 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryTruncateResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryTruncateResult.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.history.truncate} RPC method. + * Number of events that were removed by the truncation. * * @since 1.0.0 */ @@ -22,6 +22,6 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record SessionHistoryTruncateResult( /** Number of events that were removed */ - @JsonProperty("eventsRemoved") Double eventsRemoved + @JsonProperty("eventsRemoved") Long eventsRemoved ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionInstalledPlugin.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionInstalledPlugin.java new file mode 100644 index 0000000000..8ca95b8b30 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionInstalledPlugin.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `SessionInstalledPlugin` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionInstalledPlugin( + /** Plugin name */ + @JsonProperty("name") String name, + /** Marketplace the plugin came from (empty string for direct repo installs) */ + @JsonProperty("marketplace") String marketplace, + /** Installed version, if known */ + @JsonProperty("version") String version, + /** Installation timestamp (ISO-8601) */ + @JsonProperty("installed_at") String installedAt, + /** Whether the plugin is currently enabled */ + @JsonProperty("enabled") Boolean enabled, + /** Path where the plugin is cached locally */ + @JsonProperty("cache_path") String cachePath, + /** Source descriptor for direct repo installs (when marketplace is empty) */ + @JsonProperty("source") Object source +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionInstructionsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionInstructionsApi.java new file mode 100644 index 0000000000..5aec59dfd1 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionInstructionsApi.java @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code instructions} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionInstructionsApi { + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionInstructionsApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture getSources() { + return caller.invoke("session.instructions.getSources", java.util.Map.of("sessionId", this.sessionId), SessionInstructionsGetSourcesResult.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionInstructionsGetSourcesParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionInstructionsGetSourcesParams.java new file mode 100644 index 0000000000..cc1e2fb3b2 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionInstructionsGetSourcesParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionInstructionsGetSourcesParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionInstructionsGetSourcesResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionInstructionsGetSourcesResult.java new file mode 100644 index 0000000000..10badb1767 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionInstructionsGetSourcesResult.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Instruction sources loaded for the session, in merge order. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionInstructionsGetSourcesResult( + /** Instruction sources for the session */ + @JsonProperty("sources") List sources +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionLogLevel.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionLogLevel.java new file mode 100644 index 0000000000..7ec7361a74 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionLogLevel.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Log severity level. Determines how the message is displayed in the timeline. Defaults to "info". + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SessionLogLevel { + /** The {@code info} variant. */ + INFO("info"), + /** The {@code warning} variant. */ + WARNING("warning"), + /** The {@code error} variant. */ + ERROR("error"); + + private final String value; + SessionLogLevel(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SessionLogLevel fromValue(String value) { + for (SessionLogLevel v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SessionLogLevel value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionLogParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionLogParams.java index c87fb78eb6..66e0d4c855 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionLogParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionLogParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.log} RPC method. + * Message text, optional severity level, persistence flag, optional follow-up URL, and optional tip. * * @since 1.0.0 */ @@ -26,32 +26,14 @@ public record SessionLogParams( /** Human-readable message */ @JsonProperty("message") String message, /** Log severity level. Determines how the message is displayed in the timeline. Defaults to "info". */ - @JsonProperty("level") SessionLogParamsLevel level, + @JsonProperty("level") SessionLogLevel level, + /** Domain category for this log entry (e.g., "mcp", "subscription", "policy", "model"). Maps to `infoType`/`warningType`/`errorType` on the emitted event. Defaults to "notification". */ + @JsonProperty("type") String type, /** When true, the message is transient and not persisted to the session event log on disk */ @JsonProperty("ephemeral") Boolean ephemeral, /** Optional URL the user can open in their browser for more details */ - @JsonProperty("url") String url + @JsonProperty("url") String url, + /** Optional actionable tip displayed alongside the message. Only honored on `level: "info"`. */ + @JsonProperty("tip") String tip ) { - - /** Log severity level. Determines how the message is displayed in the timeline. Defaults to "info". */ - public enum SessionLogParamsLevel { - /** The {@code info} variant. */ - INFO("info"), - /** The {@code warning} variant. */ - WARNING("warning"), - /** The {@code error} variant. */ - ERROR("error"); - - private final String value; - SessionLogParamsLevel(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionLogParamsLevel fromValue(String value) { - for (SessionLogParamsLevel v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionLogParamsLevel value: " + value); - } - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionLogResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionLogResult.java index 7ba330dac9..23d9e8d6ae 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionLogResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionLogResult.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.log} RPC method. + * Identifier of the session event that was emitted for the log message. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionLspApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionLspApi.java new file mode 100644 index 0000000000..79aa000555 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionLspApi.java @@ -0,0 +1,47 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code lsp} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionLspApi { + + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionLspApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Parameters for (re)loading the merged LSP configuration set. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture initialize(SessionLspInitializeParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.lsp.initialize", _p, Void.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionLspInitializeParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionLspInitializeParams.java new file mode 100644 index 0000000000..37c064aa7c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionLspInitializeParams.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Parameters for (re)loading the merged LSP configuration set. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionLspInitializeParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Working directory used to load project-level LSP configs. Defaults to the session working directory when omitted. */ + @JsonProperty("workingDirectory") String workingDirectory, + /** Git root used as the boundary when traversing for project-level LSP configs (supports monorepos). */ + @JsonProperty("gitRoot") String gitRoot, + /** Force re-initialization even when LSP configs were already loaded for the working directory. */ + @JsonProperty("force") Boolean force +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpApi.java index d6fe3a7eb6..be2d22d4b2 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpApi.java @@ -23,14 +23,18 @@ public final class SessionMcpApi { private final RpcCaller caller; private final String sessionId; + /** API methods for the {@code mcp.oauth} sub-namespace. */ + public final SessionMcpOauthApi oauth; + /** @param caller the RPC transport function */ SessionMcpApi(RpcCaller caller, String sessionId) { this.caller = caller; this.sessionId = sessionId; + this.oauth = new SessionMcpOauthApi(caller, sessionId); } /** - * Invokes {@code session.mcp.list}. + * Identifies the target session. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 @@ -40,7 +44,7 @@ public CompletableFuture list() { } /** - * Invokes {@code session.mcp.enable}. + * Name of the MCP server to enable for the session. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. @@ -55,7 +59,7 @@ public CompletableFuture enable(SessionMcpEnableParams params) { } /** - * Invokes {@code session.mcp.disable}. + * Name of the MCP server to disable for the session. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. @@ -70,7 +74,7 @@ public CompletableFuture disable(SessionMcpDisableParams params) { } /** - * Invokes {@code session.mcp.reload}. + * Identifies the target session. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 @@ -79,4 +83,59 @@ public CompletableFuture reload() { return caller.invoke("session.mcp.reload", java.util.Map.of("sessionId", this.sessionId), Void.class); } + /** + * Identifiers and raw MCP CreateMessageRequest params used to run a sampling inference. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture executeSampling(SessionMcpExecuteSamplingParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.mcp.executeSampling", _p, SessionMcpExecuteSamplingResult.class); + } + + /** + * The requestId previously passed to executeSampling that should be cancelled. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture cancelSamplingExecution(SessionMcpCancelSamplingExecutionParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.mcp.cancelSamplingExecution", _p, SessionMcpCancelSamplingExecutionResult.class); + } + + /** + * Mode controlling how MCP server env values are resolved (`direct` or `indirect`). + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture setEnvValueMode(SessionMcpSetEnvValueModeParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.mcp.setEnvValueMode", _p, SessionMcpSetEnvValueModeResult.class); + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture removeGitHub() { + return caller.invoke("session.mcp.removeGitHub", java.util.Map.of("sessionId", this.sessionId), SessionMcpRemoveGitHubResult.class); + } + } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpCancelSamplingExecutionParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpCancelSamplingExecutionParams.java new file mode 100644 index 0000000000..191eeda984 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpCancelSamplingExecutionParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * The requestId previously passed to executeSampling that should be cancelled. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpCancelSamplingExecutionParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** The requestId previously passed to executeSampling that should be cancelled */ + @JsonProperty("requestId") String requestId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpCancelSamplingExecutionResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpCancelSamplingExecutionResult.java new file mode 100644 index 0000000000..35147aed20 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpCancelSamplingExecutionResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether an in-flight sampling execution with the given requestId was found and cancelled. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpCancelSamplingExecutionResult( + /** True if an in-flight execution with the given requestId was found and signalled to cancel. False when no such execution is in flight (already completed, never started, or cancelled by another caller). */ + @JsonProperty("cancelled") Boolean cancelled +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpDisableParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpDisableParams.java index ab0892a9ce..a9d2b00600 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpDisableParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpDisableParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.mcp.disable} RPC method. + * Name of the MCP server to disable for the session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpEnableParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpEnableParams.java index 0e6b1cf748..f7d19088af 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpEnableParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpEnableParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.mcp.enable} RPC method. + * Name of the MCP server to enable for the session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpExecuteSamplingParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpExecuteSamplingParams.java new file mode 100644 index 0000000000..19a9adffbb --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpExecuteSamplingParams.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifiers and raw MCP CreateMessageRequest params used to run a sampling inference. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpExecuteSamplingParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Caller-provided unique identifier for this sampling execution. Use this same ID with cancelSamplingExecution to cancel the in-flight call. Must be unique within the session for the lifetime of the call. */ + @JsonProperty("requestId") String requestId, + /** Name of the MCP server that initiated the sampling request */ + @JsonProperty("serverName") String serverName, + /** The original MCP JSON-RPC request ID (string or number). Used by the runtime to correlate the inference with the originating MCP request for telemetry; this is distinct from `requestId` (which is the schema-level cancellation handle). */ + @JsonProperty("mcpRequestId") Object mcpRequestId, + /** Raw MCP CreateMessageRequest params, as received in the `sampling.requested` event. Treated as opaque at the schema layer; the runtime converts the embedded MCP messages into the OpenAI chat-completion shape internally. */ + @JsonProperty("request") McpExecuteSamplingRequest request +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpExecuteSamplingResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpExecuteSamplingResult.java new file mode 100644 index 0000000000..d22143c531 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpExecuteSamplingResult.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Outcome of an MCP sampling execution: success result, failure error, or cancellation. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpExecuteSamplingResult( + /** Outcome of the sampling inference. 'success' produced a response; 'failure' encountered an error (including agent-side rejection by content filter or criteria); 'cancelled' the caller cancelled this execution via cancelSamplingExecution. */ + @JsonProperty("action") McpSamplingExecutionAction action, + /** MCP CreateMessageResult payload (with optional 'tools' extension), present when action='success'. Treated as opaque at the schema layer; consumers should construct/consume it per the MCP CreateMessageResult shape. */ + @JsonProperty("result") McpExecuteSamplingResult result, + /** Error description, present when action='failure'. */ + @JsonProperty("error") String error +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpListParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpListParams.java index c3a8a2b8dd..fb04ed4a17 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpListParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpListParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.mcp.list} RPC method. + * Identifies the target session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpListResult.java index 25f7471622..d61809d422 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpListResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpListResult.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.mcp.list} RPC method. + * MCP servers configured for the session, with their connection status. * * @since 1.0.0 */ @@ -23,48 +23,6 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record SessionMcpListResult( /** Configured MCP servers */ - @JsonProperty("servers") List servers + @JsonProperty("servers") List servers ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionMcpListResultServersItem( - /** Server name (config key) */ - @JsonProperty("name") String name, - /** Connection status: connected, failed, needs-auth, pending, disabled, or not_configured */ - @JsonProperty("status") SessionMcpListResultServersItemStatus status, - /** Configuration source: user, workspace, plugin, or builtin */ - @JsonProperty("source") String source, - /** Error message if the server failed to connect */ - @JsonProperty("error") String error - ) { - - /** Connection status: connected, failed, needs-auth, pending, disabled, or not_configured */ - public enum SessionMcpListResultServersItemStatus { - /** The {@code connected} variant. */ - CONNECTED("connected"), - /** The {@code failed} variant. */ - FAILED("failed"), - /** The {@code needs-auth} variant. */ - NEEDS_AUTH("needs-auth"), - /** The {@code pending} variant. */ - PENDING("pending"), - /** The {@code disabled} variant. */ - DISABLED("disabled"), - /** The {@code not_configured} variant. */ - NOT_CONFIGURED("not_configured"); - - private final String value; - SessionMcpListResultServersItemStatus(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionMcpListResultServersItemStatus fromValue(String value) { - for (SessionMcpListResultServersItemStatus v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionMcpListResultServersItemStatus value: " + value); - } - } - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpOauthApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpOauthApi.java new file mode 100644 index 0000000000..c603af3d7e --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpOauthApi.java @@ -0,0 +1,47 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code mcp.oauth} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionMcpOauthApi { + + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionMcpOauthApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, and the callback success-page copy. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture login(SessionMcpOauthLoginParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.mcp.oauth.login", _p, SessionMcpOauthLoginResult.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpOauthLoginParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpOauthLoginParams.java new file mode 100644 index 0000000000..004cd3d62b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpOauthLoginParams.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, and the callback success-page copy. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpOauthLoginParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Name of the remote MCP server to authenticate */ + @JsonProperty("serverName") String serverName, + /** When true, clears any cached OAuth token for the server and runs a full new authorization. Use when the user explicitly wants to switch accounts or believes their session is stuck. */ + @JsonProperty("forceReauth") Boolean forceReauth, + /** Optional override for the OAuth client display name shown on the consent screen. Applies to newly registered dynamic clients only β€” existing registrations keep the name they were created with. When omitted, the runtime applies a neutral fallback; callers driving interactive auth should pass their own surface-specific label so the consent screen matches the product the user sees. */ + @JsonProperty("clientName") String clientName, + /** Optional override for the body text shown on the OAuth loopback callback success page. When omitted, the runtime applies a neutral fallback; callers driving interactive auth should pass surface-specific copy telling the user where to return. */ + @JsonProperty("callbackSuccessMessage") String callbackSuccessMessage +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpOauthLoginResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpOauthLoginResult.java new file mode 100644 index 0000000000..9c557f6f5b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpOauthLoginResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpOauthLoginResult( + /** URL the caller should open in a browser to complete OAuth. Omitted when cached tokens were still valid and no browser interaction was needed β€” the server is already reconnected in that case. When present, the runtime starts the callback listener before returning and continues the flow in the background; completion is signaled via session.mcp_server_status_changed. */ + @JsonProperty("authorizationUrl") String authorizationUrl +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpReloadParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpReloadParams.java index b3e3ccf28a..705e42b72b 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpReloadParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpReloadParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.mcp.reload} RPC method. + * Identifies the target session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpRemoveGitHubParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpRemoveGitHubParams.java new file mode 100644 index 0000000000..5c7915d9f6 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpRemoveGitHubParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpRemoveGitHubParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpRemoveGitHubResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpRemoveGitHubResult.java new file mode 100644 index 0000000000..1f13b31c4d --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpRemoveGitHubResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove). + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpRemoveGitHubResult( + /** True when the auto-managed `github` MCP server was removed; false when no removal happened (e.g. user has explicitly configured a `github` server, or the server was not registered). */ + @JsonProperty("removed") Boolean removed +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpSetEnvValueModeParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpSetEnvValueModeParams.java new file mode 100644 index 0000000000..01efee3336 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpSetEnvValueModeParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Mode controlling how MCP server env values are resolved (`direct` or `indirect`). + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpSetEnvValueModeParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** How environment-variable values supplied to MCP servers are resolved. "direct" passes literal string values; "indirect" treats values as references (e.g. names of environment variables on the host) that the runtime resolves before launch. Defaults to the runtime's startup mode; clients that intentionally launch MCP servers with literal values (e.g. CLI prompt mode and ACP) set this to "direct". */ + @JsonProperty("mode") McpSetEnvValueModeDetails mode +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpSetEnvValueModeResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpSetEnvValueModeResult.java new file mode 100644 index 0000000000..9e69732d29 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpSetEnvValueModeResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Env-value mode recorded on the session after the update. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpSetEnvValueModeResult( + /** Mode recorded on the session after the update */ + @JsonProperty("mode") McpSetEnvValueModeDetails mode +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadata.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadata.java new file mode 100644 index 0000000000..6069f8ab4f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadata.java @@ -0,0 +1,41 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `SessionMetadata` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMetadata( + /** Stable session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Session creation time as an ISO 8601 timestamp */ + @JsonProperty("startTime") String startTime, + /** Last-modified time of the session's persisted state, as ISO 8601 */ + @JsonProperty("modifiedTime") String modifiedTime, + /** Short summary of the session, when one has been derived */ + @JsonProperty("summary") String summary, + /** Optional human-friendly name set via /rename */ + @JsonProperty("name") String name, + /** True for remote (GitHub) sessions; false for local */ + @JsonProperty("isRemote") Boolean isRemote, + /** Schema for the `SessionContext` type. */ + @JsonProperty("context") SessionContext context, + /** GitHub task ID, when this local session is bound to one. Only present for local sessions exported to remote control. */ + @JsonProperty("mcTaskId") String mcTaskId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataApi.java new file mode 100644 index 0000000000..b0a82347a6 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataApi.java @@ -0,0 +1,112 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code metadata} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionMetadataApi { + + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionMetadataApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture snapshot() { + return caller.invoke("session.metadata.snapshot", java.util.Map.of("sessionId", this.sessionId), SessionMetadataSnapshotResult.class); + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture isProcessing() { + return caller.invoke("session.metadata.isProcessing", java.util.Map.of("sessionId", this.sessionId), SessionMetadataIsProcessingResult.class); + } + + /** + * Model identifier and token limits used to compute the context-info breakdown. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture contextInfo(SessionMetadataContextInfoParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.metadata.contextInfo", _p, SessionMetadataContextInfoResult.class); + } + + /** + * Updated working-directory/git context to record on the session. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture recordContextChange(SessionMetadataRecordContextChangeParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.metadata.recordContextChange", _p, Void.class); + } + + /** + * Absolute path to set as the session's new working directory. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture setWorkingDirectory(SessionMetadataSetWorkingDirectoryParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.metadata.setWorkingDirectory", _p, SessionMetadataSetWorkingDirectoryResult.class); + } + + /** + * Model identifier to use when re-tokenizing the session's existing messages. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture recomputeContextTokens(SessionMetadataRecomputeContextTokensParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.metadata.recomputeContextTokens", _p, SessionMetadataRecomputeContextTokensResult.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataContextInfoParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataContextInfoParams.java new file mode 100644 index 0000000000..94176d544a --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataContextInfoParams.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Model identifier and token limits used to compute the context-info breakdown. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMetadataContextInfoParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Maximum prompt tokens allowed by the target model. Pass 0 to use the runtime default. */ + @JsonProperty("promptTokenLimit") Long promptTokenLimit, + /** Maximum output tokens allowed by the target model. Pass 0 if unknown. */ + @JsonProperty("outputTokenLimit") Long outputTokenLimit, + /** Model identifier used for tokenization. Omit to use the session default. Used both for token counting and to compute display values. */ + @JsonProperty("selectedModel") String selectedModel +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataContextInfoResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataContextInfoResult.java new file mode 100644 index 0000000000..fe8e15f781 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataContextInfoResult.java @@ -0,0 +1,52 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Token breakdown for the session's current context window, or null if uninitialized. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMetadataContextInfoResult( + /** Token breakdown for the current context window, or null if the session has not yet been initialized (no system prompt or tool metadata cached). */ + @JsonProperty("contextInfo") SessionMetadataContextInfoResultContextInfo contextInfo +) { + + /** Token-usage breakdown for the session's current context window */ + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record SessionMetadataContextInfoResultContextInfo( + /** The model used for token counting */ + @JsonProperty("modelName") String modelName, + /** Tokens consumed by the system prompt */ + @JsonProperty("systemTokens") Long systemTokens, + /** Tokens consumed by user/assistant/tool messages */ + @JsonProperty("conversationTokens") Long conversationTokens, + /** Tokens consumed by tool definitions sent to the model (excludes deferred tools) */ + @JsonProperty("toolDefinitionsTokens") Long toolDefinitionsTokens, + /** Sum of system, conversation and tool-definition tokens */ + @JsonProperty("totalTokens") Long totalTokens, + /** Maximum prompt tokens allowed by the model (or DEFAULT_TOKEN_LIMIT if unspecified) */ + @JsonProperty("promptTokenLimit") Long promptTokenLimit, + /** Token count at which background compaction starts (configurable percentage of promptTokenLimit) */ + @JsonProperty("compactionThreshold") Long compactionThreshold, + /** Total context limit for /context display. promptTokenLimit + min(32k or 64k, outputTokenLimit) depending on model. */ + @JsonProperty("limit") Long limit, + /** Output reserve plus tokens after the buffer-exhaustion blocking threshold (default 95%) */ + @JsonProperty("bufferTokens") Long bufferTokens + ) { + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataIsProcessingParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataIsProcessingParams.java new file mode 100644 index 0000000000..5e86f186ae --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataIsProcessingParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMetadataIsProcessingParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataIsProcessingResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataIsProcessingResult.java new file mode 100644 index 0000000000..fb5d4e59b1 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataIsProcessingResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the local session is currently processing a turn or background continuation. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMetadataIsProcessingResult( + /** Whether the session is currently processing user/agent messages. False for non-local sessions (which don't run a local agentic loop). Reflects an in-flight turn or background continuation. */ + @JsonProperty("processing") Boolean processing +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataRecomputeContextTokensParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataRecomputeContextTokensParams.java new file mode 100644 index 0000000000..27824912c9 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataRecomputeContextTokensParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Model identifier to use when re-tokenizing the session's existing messages. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMetadataRecomputeContextTokensParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Model identifier used for tokenization. The runtime token-counts both chat-context and system-context messages against this model. */ + @JsonProperty("modelId") String modelId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataRecomputeContextTokensResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataRecomputeContextTokensResult.java new file mode 100644 index 0000000000..c8d398a4d1 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataRecomputeContextTokensResult.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Re-tokenize the session's existing messages against `modelId` and return the token totals. Useful for hosts that want an initial estimate of context usage on session resume, before the next agent turn fires `session.context_info_changed` events. Returns zeros for an empty session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMetadataRecomputeContextTokensResult( + /** Sum of tokens across chat-context and system-context messages currently held by the session. */ + @JsonProperty("totalTokens") Long totalTokens, + /** Tokens contributed by user/assistant/tool messages (excludes system/developer prompts). */ + @JsonProperty("messagesTokenCount") Long messagesTokenCount, + /** Tokens contributed by system/developer prompt snapshots. */ + @JsonProperty("systemTokenCount") Long systemTokenCount +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataRecordContextChangeParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataRecordContextChangeParams.java new file mode 100644 index 0000000000..24e1c79bae --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataRecordContextChangeParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Updated working-directory/git context to record on the session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMetadataRecordContextChangeParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Updated working directory and git context. Emitted as the new payload of `session.context_changed`. */ + @JsonProperty("context") SessionWorkingDirectoryContext context +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataRecordContextChangeResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataRecordContextChangeResult.java new file mode 100644 index 0000000000..08d780868f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataRecordContextChangeResult.java @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode). + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMetadataRecordContextChangeResult() { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataSetWorkingDirectoryParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataSetWorkingDirectoryParams.java new file mode 100644 index 0000000000..436286f65b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataSetWorkingDirectoryParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Absolute path to set as the session's new working directory. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMetadataSetWorkingDirectoryParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Absolute path to set as the session's working directory. The runtime updates the session's recorded cwd so subsequent operations (shell tools, file lookups, telemetry) anchor to it. */ + @JsonProperty("workingDirectory") String workingDirectory +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataSetWorkingDirectoryResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataSetWorkingDirectoryResult.java new file mode 100644 index 0000000000..b1c0f5fb91 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataSetWorkingDirectoryResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for `process.chdir` and any related side-effects (file index, etc.); this method only updates the session's own recorded path. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMetadataSetWorkingDirectoryResult( + /** Working directory after the update */ + @JsonProperty("workingDirectory") String workingDirectory +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataSnapshotParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataSnapshotParams.java new file mode 100644 index 0000000000..ffbad219e7 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataSnapshotParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMetadataSnapshotParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataSnapshotResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataSnapshotResult.java new file mode 100644 index 0000000000..49002659e1 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMetadataSnapshotResult.java @@ -0,0 +1,77 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import javax.annotation.processing.Generated; + +/** + * Point-in-time snapshot of slow-changing session identifier and state fields + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMetadataSnapshotResult( + /** The unique identifier of the session */ + @JsonProperty("sessionId") String sessionId, + /** ISO 8601 timestamp of when the session started */ + @JsonProperty("startTime") OffsetDateTime startTime, + /** ISO 8601 timestamp of when the session's persisted state was last modified on disk. For new sessions, equals startTime. For resumed sessions, reflects the previous modification time at construction. */ + @JsonProperty("modifiedTime") OffsetDateTime modifiedTime, + /** Whether this is a remote session (i.e., one whose runtime executes elsewhere and is steered through this process) */ + @JsonProperty("isRemote") Boolean isRemote, + /** True when the session was detected to be in use by another process at construction time. Local consumers may surface a confirmation prompt before fully attaching. Always false for new sessions. */ + @JsonProperty("alreadyInUse") Boolean alreadyInUse, + /** Absolute path to the session's workspace directory on disk, or null if the session has no associated workspace */ + @JsonProperty("workspacePath") String workspacePath, + /** User-provided name supplied at session construction (via `--name`), if any. Immutable after construction. */ + @JsonProperty("initialName") String initialName, + /** Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. */ + @JsonProperty("remoteMetadata") MetadataSnapshotRemoteMetadata remoteMetadata, + /** Short human-readable summary of the session, if known. Omitted when no summary has been generated. */ + @JsonProperty("summary") String summary, + /** Absolute path to the session's current working directory */ + @JsonProperty("workingDirectory") String workingDirectory, + /** The current agent mode for this session (e.g., 'interactive', 'plan', 'autopilot') */ + @JsonProperty("currentMode") MetadataSnapshotCurrentMode currentMode, + /** Currently selected model identifier, if any */ + @JsonProperty("selectedModel") String selectedModel, + /** Public-facing workspace metadata for this session, or null if the session has no associated workspace. Excludes runtime-internal fields (GitHub IDs, summary count, internal flags). */ + @JsonProperty("workspace") SessionMetadataSnapshotResultWorkspace workspace +) { + + /** Public-facing projection of workspace metadata for SDK / TUI consumers */ + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record SessionMetadataSnapshotResultWorkspace( + /** Workspace identifier (1:1 with sessionId) */ + @JsonProperty("id") String id, + /** Current working directory at session start */ + @JsonProperty("cwd") String cwd, + /** Resolved git root for cwd, if any */ + @JsonProperty("git_root") String gitRoot, + /** Repository identifier in 'owner/repo' or 'org/project/repo' format, if any */ + @JsonProperty("repository") String repository, + /** Repository host type, if known */ + @JsonProperty("host_type") WorkspaceSummaryHostType hostType, + /** Branch checked out at session start, if any */ + @JsonProperty("branch") String branch, + /** Display name for the session, if set */ + @JsonProperty("name") String name, + /** ISO 8601 timestamp when the workspace was created */ + @JsonProperty("created_at") OffsetDateTime createdAt, + /** ISO 8601 timestamp when the workspace was last updated */ + @JsonProperty("updated_at") OffsetDateTime updatedAt + ) { + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMode.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMode.java new file mode 100644 index 0000000000..d335fd7cd4 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMode.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * The session mode the agent is operating in + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SessionMode { + /** The {@code interactive} variant. */ + INTERACTIVE("interactive"), + /** The {@code plan} variant. */ + PLAN("plan"), + /** The {@code autopilot} variant. */ + AUTOPILOT("autopilot"); + + private final String value; + SessionMode(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SessionMode fromValue(String value) { + for (SessionMode v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SessionMode value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModeApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModeApi.java index 7fd8eff736..b28cd5d37b 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModeApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModeApi.java @@ -30,24 +30,28 @@ public final class SessionModeApi { } /** - * Invokes {@code session.mode.get}. + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 */ - public CompletableFuture get() { - return caller.invoke("session.mode.get", java.util.Map.of("sessionId", this.sessionId), SessionModeGetResult.class); + public CompletableFuture get() { + return caller.invoke("session.mode.get", java.util.Map.of("sessionId", this.sessionId), Void.class); } /** - * Invokes {@code session.mode.set}. + * Agent interaction mode to apply to the session. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 */ - public CompletableFuture set(SessionModeSetParams params) { + public CompletableFuture set(SessionModeSetParams params) { com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); _p.put("sessionId", this.sessionId); - return caller.invoke("session.mode.set", _p, SessionModeSetResult.class); + return caller.invoke("session.mode.set", _p, Void.class); } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModeGetParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModeGetParams.java index e62ab01d65..c8f660f92c 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModeGetParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModeGetParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.mode.get} RPC method. + * Identifies the target session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModeSetParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModeSetParams.java index dfbae5cac5..22618fe35d 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModeSetParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModeSetParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.mode.set} RPC method. + * Agent interaction mode to apply to the session. * * @since 1.0.0 */ @@ -23,29 +23,7 @@ public record SessionModeSetParams( /** Target session identifier */ @JsonProperty("sessionId") String sessionId, - /** The mode to switch to. Valid values: "interactive", "plan", "autopilot". */ - @JsonProperty("mode") SessionModeSetParamsMode mode + /** The session mode the agent is operating in */ + @JsonProperty("mode") SessionMode mode ) { - - /** The mode to switch to. Valid values: "interactive", "plan", "autopilot". */ - public enum SessionModeSetParamsMode { - /** The {@code interactive} variant. */ - INTERACTIVE("interactive"), - /** The {@code plan} variant. */ - PLAN("plan"), - /** The {@code autopilot} variant. */ - AUTOPILOT("autopilot"); - - private final String value; - SessionModeSetParamsMode(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionModeSetParamsMode fromValue(String value) { - for (SessionModeSetParamsMode v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionModeSetParamsMode value: " + value); - } - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelApi.java index 6c8099d0c3..b2c112b662 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelApi.java @@ -30,7 +30,9 @@ public final class SessionModelApi { } /** - * Invokes {@code session.model.getCurrent}. + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 */ public CompletableFuture getCurrent() { @@ -38,10 +40,12 @@ public CompletableFuture getCurrent() { } /** - * Invokes {@code session.model.switchTo}. + * Target model identifier and optional reasoning effort, summary, and capability overrides. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 */ public CompletableFuture switchTo(SessionModelSwitchToParams params) { @@ -50,4 +54,19 @@ public CompletableFuture switchTo(SessionModelSwitch return caller.invoke("session.model.switchTo", _p, SessionModelSwitchToResult.class); } + /** + * Reasoning effort level to apply to the currently selected model. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture setReasoningEffort(SessionModelSetReasoningEffortParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.model.setReasoningEffort", _p, SessionModelSetReasoningEffortResult.class); + } + } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelGetCurrentParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelGetCurrentParams.java index e49e4f2dfe..1687e9fff5 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelGetCurrentParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelGetCurrentParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.model.getCurrent} RPC method. + * Identifies the target session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelGetCurrentResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelGetCurrentResult.java index 7467fd4e8a..5afd229112 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelGetCurrentResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelGetCurrentResult.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.model.getCurrent} RPC method. + * The currently selected model and reasoning effort for the session. * * @since 1.0.0 */ @@ -22,6 +22,8 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record SessionModelGetCurrentResult( /** Currently active model identifier */ - @JsonProperty("modelId") String modelId + @JsonProperty("modelId") String modelId, + /** Reasoning effort level currently applied to the active model, when one is set. Reads `Session.getReasoningEffort()` synchronously after `getSelectedModel()` resolves so the two values are reported as a snapshot. */ + @JsonProperty("reasoningEffort") String reasoningEffort ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelSetReasoningEffortParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelSetReasoningEffortParams.java new file mode 100644 index 0000000000..da6bb18709 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelSetReasoningEffortParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Reasoning effort level to apply to the currently selected model. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionModelSetReasoningEffortParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Reasoning effort level to apply to the currently selected model. The host is responsible for validating the value against the model's supported levels before calling. */ + @JsonProperty("reasoningEffort") String reasoningEffort +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelSetReasoningEffortResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelSetReasoningEffortResult.java new file mode 100644 index 0000000000..0ec6e239e6 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelSetReasoningEffortResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Update the session's reasoning effort without changing the selected model. Use `switchTo` instead when you also need to change the model. The runtime stores the effort on the session and applies it to subsequent turns. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionModelSetReasoningEffortResult( + /** Reasoning effort level recorded on the session after the update */ + @JsonProperty("reasoningEffort") String reasoningEffort +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelSwitchToParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelSwitchToParams.java index 994b3f53b4..e06d3e68ab 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelSwitchToParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelSwitchToParams.java @@ -10,11 +10,10 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.model.switchTo} RPC method. + * Target model identifier and optional reasoning effort, summary, and capability overrides. * * @since 1.0.0 */ @@ -26,53 +25,11 @@ public record SessionModelSwitchToParams( @JsonProperty("sessionId") String sessionId, /** Model identifier to switch to */ @JsonProperty("modelId") String modelId, - /** Reasoning effort level to use for the model */ + /** Reasoning effort level to use for the model. "none" disables reasoning. */ @JsonProperty("reasoningEffort") String reasoningEffort, + /** Reasoning summary mode to request for supported model clients */ + @JsonProperty("reasoningSummary") ReasoningSummary reasoningSummary, /** Override individual model capabilities resolved by the runtime */ - @JsonProperty("modelCapabilities") SessionModelSwitchToParamsModelCapabilities modelCapabilities + @JsonProperty("modelCapabilities") ModelCapabilitiesOverride modelCapabilities ) { - - /** Override individual model capabilities resolved by the runtime */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionModelSwitchToParamsModelCapabilities( - /** Feature flags indicating what the model supports */ - @JsonProperty("supports") SessionModelSwitchToParamsModelCapabilitiesSupports supports, - /** Token limits for prompts, outputs, and context window */ - @JsonProperty("limits") SessionModelSwitchToParamsModelCapabilitiesLimits limits - ) { - - /** Feature flags indicating what the model supports */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionModelSwitchToParamsModelCapabilitiesSupports( - @JsonProperty("vision") Boolean vision, - @JsonProperty("reasoningEffort") Boolean reasoningEffort - ) { - } - - /** Token limits for prompts, outputs, and context window */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionModelSwitchToParamsModelCapabilitiesLimits( - @JsonProperty("max_prompt_tokens") Double maxPromptTokens, - @JsonProperty("max_output_tokens") Double maxOutputTokens, - /** Maximum total context window size in tokens */ - @JsonProperty("max_context_window_tokens") Double maxContextWindowTokens, - @JsonProperty("vision") SessionModelSwitchToParamsModelCapabilitiesLimitsVision vision - ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionModelSwitchToParamsModelCapabilitiesLimitsVision( - /** MIME types the model accepts */ - @JsonProperty("supported_media_types") List supportedMediaTypes, - /** Maximum number of images per prompt */ - @JsonProperty("max_prompt_images") Double maxPromptImages, - /** Maximum image size in bytes */ - @JsonProperty("max_prompt_image_size") Double maxPromptImageSize - ) { - } - } - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelSwitchToResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelSwitchToResult.java index 5e93b51aed..6c4e7a39cd 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelSwitchToResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelSwitchToResult.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.model.switchTo} RPC method. + * The model identifier active on the session after the switch. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameApi.java new file mode 100644 index 0000000000..73b6c6bc2e --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameApi.java @@ -0,0 +1,72 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code name} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionNameApi { + + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionNameApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture get() { + return caller.invoke("session.name.get", java.util.Map.of("sessionId", this.sessionId), SessionNameGetResult.class); + } + + /** + * New friendly name to apply to the session. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture set(SessionNameSetParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.name.set", _p, Void.class); + } + + /** + * Auto-generated session summary to apply as the session's name when no user-set name exists. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture setAuto(SessionNameSetAutoParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.name.setAuto", _p, SessionNameSetAutoResult.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameGetParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameGetParams.java new file mode 100644 index 0000000000..941a19a89b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameGetParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionNameGetParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameGetResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameGetResult.java new file mode 100644 index 0000000000..349aa81a25 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameGetResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * The session's friendly name, or null when not yet set. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionNameGetResult( + /** The session name (user-set or auto-generated), or null if not yet set */ + @JsonProperty("name") String name +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameSetAutoParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameSetAutoParams.java new file mode 100644 index 0000000000..4b6db1bde8 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameSetAutoParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Auto-generated session summary to apply as the session's name when no user-set name exists. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionNameSetAutoParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Auto-generated session summary. Empty/whitespace-only values are ignored; values are trimmed before persisting. */ + @JsonProperty("summary") String summary +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameSetAutoResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameSetAutoResult.java new file mode 100644 index 0000000000..134694a8c9 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameSetAutoResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the auto-generated summary was applied as the session's name. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionNameSetAutoResult( + /** Whether the auto-generated summary was persisted. False if the session already has a user-set name, the summary normalized to empty, or the session does not have a workspace. */ + @JsonProperty("applied") Boolean applied +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameSetParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameSetParams.java new file mode 100644 index 0000000000..6ad1fcd37e --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameSetParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * New friendly name to apply to the session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionNameSetParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** New session name (1–100 characters, trimmed of leading/trailing whitespace) */ + @JsonProperty("name") String name +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionOptionsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionOptionsApi.java new file mode 100644 index 0000000000..8624c57e31 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionOptionsApi.java @@ -0,0 +1,47 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code options} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionOptionsApi { + + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionOptionsApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Patch of mutable session options to apply to the running session. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture update(SessionOptionsUpdateParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.options.update", _p, SessionOptionsUpdateResult.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionOptionsUpdateParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionOptionsUpdateParams.java new file mode 100644 index 0000000000..fa768dd7bd --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionOptionsUpdateParams.java @@ -0,0 +1,101 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; +import javax.annotation.processing.Generated; + +/** + * Patch of mutable session options to apply to the running session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionOptionsUpdateParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** The model ID to use for assistant turns. */ + @JsonProperty("model") String model, + /** Reasoning effort for the selected model (model-defined enum). */ + @JsonProperty("reasoningEffort") String reasoningEffort, + /** Identifier of the client driving the session. */ + @JsonProperty("clientName") String clientName, + /** Identifier sent to LSP-style integrations. */ + @JsonProperty("lspClientName") String lspClientName, + /** Stable integration identifier used for analytics and rate-limit attribution. */ + @JsonProperty("integrationId") String integrationId, + /** Map of feature-flag IDs to their boolean enabled state. */ + @JsonProperty("featureFlags") Map featureFlags, + /** Whether experimental capabilities are enabled. */ + @JsonProperty("isExperimentalMode") Boolean isExperimentalMode, + /** Custom model-provider configuration (BYOK). Opaque shape; see `ProviderConfig` in the runtime. */ + @JsonProperty("provider") Object provider, + /** Absolute working-directory path for shell tools. */ + @JsonProperty("workingDirectory") String workingDirectory, + /** Allowlist of tool names available to this session. */ + @JsonProperty("availableTools") List availableTools, + /** Denylist of tool names for this session. */ + @JsonProperty("excludedTools") List excludedTools, + /** Whether shell-script safety heuristics are enabled. */ + @JsonProperty("enableScriptSafety") Boolean enableScriptSafety, + /** Shell init profile (`None` or `NonInteractive`). */ + @JsonProperty("shellInitProfile") String shellInitProfile, + /** Per-shell process flags (e.g., `pwsh` arguments). */ + @JsonProperty("shellProcessFlags") List shellProcessFlags, + /** Sandbox configuration shape; opaque to SDK consumers. See `SandboxConfig` in the runtime. */ + @JsonProperty("sandboxConfig") Object sandboxConfig, + /** Whether interactive shell sessions are logged. */ + @JsonProperty("logInteractiveShells") Boolean logInteractiveShells, + /** How env values are passed to MCP servers (`direct` inlines literal values; `indirect` resolves at launch). */ + @JsonProperty("envValueMode") OptionsUpdateEnvValueMode envValueMode, + /** Additional directories to search for skills. */ + @JsonProperty("skillDirectories") List skillDirectories, + /** Skill IDs that should be excluded from this session. */ + @JsonProperty("disabledSkills") List disabledSkills, + /** Whether to discover custom instructions on demand after successful file views (AGENTS.md / CLAUDE.md / .github/copilot-instructions.md surfacing). Combined with `skipCustomInstructions` and the runtime-side `ON_DEMAND_INSTRUCTIONS` feature flag. */ + @JsonProperty("enableOnDemandInstructionDiscovery") Boolean enableOnDemandInstructionDiscovery, + /** Full set of installed plugins for the session. Replaces the existing list; the runtime invalidates the skills cache only when the list materially changes. */ + @JsonProperty("installedPlugins") List installedPlugins, + /** Whether to default custom agents to local-only execution. */ + @JsonProperty("customAgentsLocalOnly") Boolean customAgentsLocalOnly, + /** Whether to skip loading custom instruction sources. */ + @JsonProperty("skipCustomInstructions") Boolean skipCustomInstructions, + /** Instruction source IDs to exclude from the system prompt. */ + @JsonProperty("disabledInstructionSources") List disabledInstructionSources, + /** Whether to include the `Co-authored-by` trailer in commit messages. */ + @JsonProperty("coauthorEnabled") Boolean coauthorEnabled, + /** Optional path for trajectory output. */ + @JsonProperty("trajectoryFile") String trajectoryFile, + /** Whether to stream model responses. */ + @JsonProperty("enableStreaming") Boolean enableStreaming, + /** Override URL for the Copilot API endpoint. */ + @JsonProperty("copilotUrl") String copilotUrl, + /** Whether to disable the `ask_user` tool (encourages autonomous behavior). */ + @JsonProperty("askUserDisabled") Boolean askUserDisabled, + /** Whether to allow auto-mode continuation across turns. */ + @JsonProperty("continueOnAutoMode") Boolean continueOnAutoMode, + /** Whether the session is running in an interactive UI. */ + @JsonProperty("runningInInteractiveMode") Boolean runningInInteractiveMode, + /** Whether to surface reasoning-summary events from the model. */ + @JsonProperty("enableReasoningSummaries") Boolean enableReasoningSummaries, + /** Runtime context discriminator (e.g., `cli`, `actions`). */ + @JsonProperty("agentContext") String agentContext, + /** Override directory for the session-events log. When unset, the runtime's default events log directory is used. */ + @JsonProperty("eventsLogDirectory") String eventsLogDirectory, + /** Additional content-exclusion policies to merge into the session's policy set. Opaque shape; see `ContentExclusionApiResponse` in the runtime. */ + @JsonProperty("additionalContentExclusionPolicies") List additionalContentExclusionPolicies, + /** Whether to expose the `manage_schedule` tool to the agent. The runtime always owns the per-session schedule registry; this flag only controls tool exposure (typically gated to staff users). */ + @JsonProperty("manageScheduleEnabled") Boolean manageScheduleEnabled +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionOptionsUpdateResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionOptionsUpdateResult.java new file mode 100644 index 0000000000..a20c64ab86 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionOptionsUpdateResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the session options patch was applied successfully. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionOptionsUpdateResult( + /** Whether the operation succeeded */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsApi.java index 38c2dd4fc3..082268d896 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsApi.java @@ -23,17 +23,47 @@ public final class SessionPermissionsApi { private final RpcCaller caller; private final String sessionId; + /** API methods for the {@code permissions.paths} sub-namespace. */ + public final SessionPermissionsPathsApi paths; + /** API methods for the {@code permissions.locations} sub-namespace. */ + public final SessionPermissionsLocationsApi locations; + /** API methods for the {@code permissions.folderTrust} sub-namespace. */ + public final SessionPermissionsFolderTrustApi folderTrust; + /** API methods for the {@code permissions.urls} sub-namespace. */ + public final SessionPermissionsUrlsApi urls; + /** @param caller the RPC transport function */ SessionPermissionsApi(RpcCaller caller, String sessionId) { this.caller = caller; this.sessionId = sessionId; + this.paths = new SessionPermissionsPathsApi(caller, sessionId); + this.locations = new SessionPermissionsLocationsApi(caller, sessionId); + this.folderTrust = new SessionPermissionsFolderTrustApi(caller, sessionId); + this.urls = new SessionPermissionsUrlsApi(caller, sessionId); + } + + /** + * Patch of permission policy fields to apply (omit a field to leave it unchanged). + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture configure(SessionPermissionsConfigureParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.permissions.configure", _p, SessionPermissionsConfigureResult.class); } /** - * Invokes {@code session.permissions.handlePendingPermissionRequest}. + * Pending permission request ID and the decision to apply (approve/reject and scope). *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 */ public CompletableFuture handlePendingPermissionRequest(SessionPermissionsHandlePendingPermissionRequestParams params) { @@ -42,4 +72,84 @@ public CompletableFuture return caller.invoke("session.permissions.handlePendingPermissionRequest", _p, SessionPermissionsHandlePendingPermissionRequestResult.class); } + /** + * No parameters; returns currently-pending permission requests for the session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture pendingRequests() { + return caller.invoke("session.permissions.pendingRequests", java.util.Map.of("sessionId", this.sessionId), SessionPermissionsPendingRequestsResult.class); + } + + /** + * Allow-all toggle for tool permission requests, with an optional telemetry source. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture setApproveAll(SessionPermissionsSetApproveAllParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.permissions.setApproveAll", _p, SessionPermissionsSetApproveAllResult.class); + } + + /** + * Scope and add/remove instructions for modifying session- or location-scoped permission rules. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture modifyRules(SessionPermissionsModifyRulesParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.permissions.modifyRules", _p, SessionPermissionsModifyRulesResult.class); + } + + /** + * Toggles whether permission prompts should be bridged into session events for this client. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture setRequired(SessionPermissionsSetRequiredParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.permissions.setRequired", _p, SessionPermissionsSetRequiredResult.class); + } + + /** + * No parameters; clears all session-scoped tool permission approvals. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture resetSessionApprovals() { + return caller.invoke("session.permissions.resetSessionApprovals", java.util.Map.of("sessionId", this.sessionId), SessionPermissionsResetSessionApprovalsResult.class); + } + + /** + * Notification payload describing the permission prompt that the client just rendered. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture notifyPromptShown(SessionPermissionsNotifyPromptShownParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.permissions.notifyPromptShown", _p, SessionPermissionsNotifyPromptShownResult.class); + } + } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsConfigureParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsConfigureParams.java new file mode 100644 index 0000000000..494495fc52 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsConfigureParams.java @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Patch of permission policy fields to apply (omit a field to leave it unchanged). + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsConfigureParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** If specified, sets whether tool permission requests are auto-approved without prompting. Omit to leave the current value unchanged. */ + @JsonProperty("approveAllToolPermissionRequests") Boolean approveAllToolPermissionRequests, + /** If specified, sets whether path/URL read permission requests are auto-approved. Omit to leave the current value unchanged. */ + @JsonProperty("approveAllReadPermissionRequests") Boolean approveAllReadPermissionRequests, + /** If specified, replaces the session's approved/denied permission rules. Omit to leave the current rules unchanged. */ + @JsonProperty("rules") PermissionRulesSet rules, + /** If specified, replaces the session's path-permission policy. The runtime constructs the appropriate PathManager based on these inputs (rooted at the session's working directory). Omit to leave the current path policy unchanged. */ + @JsonProperty("paths") PermissionPathsConfig paths, + /** If specified, replaces the session's URL-permission policy. The runtime constructs a fresh DefaultUrlManager based on these inputs. Omit to leave the current URL policy unchanged. */ + @JsonProperty("urls") PermissionUrlsConfig urls, + /** If specified, replaces the host-supplied GitHub Content Exclusion policies on the session (combined with natively-discovered policies when evaluating tool/file access). Omit to leave the current policies unchanged. */ + @JsonProperty("additionalContentExclusionPolicies") List additionalContentExclusionPolicies +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsConfigureResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsConfigureResult.java new file mode 100644 index 0000000000..7f9ce41502 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsConfigureResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the operation succeeded. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsConfigureResult( + /** Whether the operation succeeded */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsFolderTrustAddTrustedParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsFolderTrustAddTrustedParams.java new file mode 100644 index 0000000000..184087f22f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsFolderTrustAddTrustedParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Folder path to add to trusted folders. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsFolderTrustAddTrustedParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Folder path to mark as trusted */ + @JsonProperty("path") String path +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsFolderTrustAddTrustedResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsFolderTrustAddTrustedResult.java new file mode 100644 index 0000000000..dbe09efc5d --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsFolderTrustAddTrustedResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the operation succeeded. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsFolderTrustAddTrustedResult( + /** Whether the operation succeeded */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsFolderTrustApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsFolderTrustApi.java new file mode 100644 index 0000000000..5337a40f13 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsFolderTrustApi.java @@ -0,0 +1,62 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code permissions.folderTrust} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionPermissionsFolderTrustApi { + + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionPermissionsFolderTrustApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Folder path to check for trust. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture isTrusted(SessionPermissionsFolderTrustIsTrustedParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.permissions.folderTrust.isTrusted", _p, SessionPermissionsFolderTrustIsTrustedResult.class); + } + + /** + * Folder path to add to trusted folders. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture addTrusted(SessionPermissionsFolderTrustAddTrustedParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.permissions.folderTrust.addTrusted", _p, SessionPermissionsFolderTrustAddTrustedResult.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsFolderTrustIsTrustedParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsFolderTrustIsTrustedParams.java new file mode 100644 index 0000000000..bacbe56496 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsFolderTrustIsTrustedParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Folder path to check for trust. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsFolderTrustIsTrustedParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Folder path to check */ + @JsonProperty("path") String path +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsFolderTrustIsTrustedResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsFolderTrustIsTrustedResult.java new file mode 100644 index 0000000000..3f2e26a0d0 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsFolderTrustIsTrustedResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Folder trust check result. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsFolderTrustIsTrustedResult( + /** Whether the folder is trusted */ + @JsonProperty("trusted") Boolean trusted +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsHandlePendingPermissionRequestParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsHandlePendingPermissionRequestParams.java index 016d2001c1..f8f10a8d1b 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsHandlePendingPermissionRequestParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsHandlePendingPermissionRequestParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.permissions.handlePendingPermissionRequest} RPC method. + * Pending permission request ID and the decision to apply (approve/reject and scope). * * @since 1.0.0 */ @@ -25,6 +25,7 @@ public record SessionPermissionsHandlePendingPermissionRequestParams( @JsonProperty("sessionId") String sessionId, /** Request ID of the pending permission request */ @JsonProperty("requestId") String requestId, + /** The client's response to the pending permission prompt */ @JsonProperty("result") Object result ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsHandlePendingPermissionRequestResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsHandlePendingPermissionRequestResult.java index cbbdd075bf..a517e642f0 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsHandlePendingPermissionRequestResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsHandlePendingPermissionRequestResult.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.permissions.handlePendingPermissionRequest} RPC method. + * Indicates whether the permission decision was applied; false when the request was already resolved. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsAddToolApprovalParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsAddToolApprovalParams.java new file mode 100644 index 0000000000..42429498d2 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsAddToolApprovalParams.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Location-scoped tool approval to persist. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsLocationsAddToolApprovalParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Location key (git root or cwd) to persist the approval to */ + @JsonProperty("locationKey") String locationKey, + /** Tool approval to persist and apply */ + @JsonProperty("approval") Object approval +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsAddToolApprovalResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsAddToolApprovalResult.java new file mode 100644 index 0000000000..fae259c23b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsAddToolApprovalResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the operation succeeded. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsLocationsAddToolApprovalResult( + /** Whether the operation succeeded */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsApi.java new file mode 100644 index 0000000000..388bd49dfc --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsApi.java @@ -0,0 +1,77 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code permissions.locations} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionPermissionsLocationsApi { + + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionPermissionsLocationsApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Working directory to resolve into a location-permissions key. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture resolve(SessionPermissionsLocationsResolveParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.permissions.locations.resolve", _p, SessionPermissionsLocationsResolveResult.class); + } + + /** + * Working directory to load persisted location permissions for. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture apply(SessionPermissionsLocationsApplyParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.permissions.locations.apply", _p, SessionPermissionsLocationsApplyResult.class); + } + + /** + * Location-scoped tool approval to persist. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture addToolApproval(SessionPermissionsLocationsAddToolApprovalParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.permissions.locations.addToolApproval", _p, SessionPermissionsLocationsAddToolApprovalResult.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsApplyParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsApplyParams.java new file mode 100644 index 0000000000..7af5ef28fb --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsApplyParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Working directory to load persisted location permissions for. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsLocationsApplyParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Working directory whose persisted location permissions should be applied */ + @JsonProperty("workingDirectory") String workingDirectory +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsApplyResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsApplyResult.java new file mode 100644 index 0000000000..b2514d8afe --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsApplyResult.java @@ -0,0 +1,38 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Summary of persisted location permissions applied to the session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsLocationsApplyResult( + /** Location key used in the location-permissions store */ + @JsonProperty("locationKey") String locationKey, + /** Whether the location is a git repo or directory */ + @JsonProperty("locationType") PermissionLocationType locationType, + /** Whether a different location was applied since the previous apply call */ + @JsonProperty("changed") Boolean changed, + /** Number of location-scoped rules added to the live permission service */ + @JsonProperty("appliedRuleCount") Long appliedRuleCount, + /** Number of persisted allowed directories added to the live path manager */ + @JsonProperty("appliedDirectoryCount") Long appliedDirectoryCount, + /** Location-scoped rules applied to the live permission service */ + @JsonProperty("appliedRules") List appliedRules +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsResolveParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsResolveParams.java new file mode 100644 index 0000000000..d6ba06fba3 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsResolveParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Working directory to resolve into a location-permissions key. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsLocationsResolveParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Working directory whose permission location should be resolved */ + @JsonProperty("workingDirectory") String workingDirectory +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsResolveResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsResolveResult.java new file mode 100644 index 0000000000..3254bb2c6d --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsLocationsResolveResult.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Resolved location-permissions key and type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsLocationsResolveResult( + /** Location key used in the location-permissions store */ + @JsonProperty("locationKey") String locationKey, + /** Whether the location is a git repo or directory */ + @JsonProperty("locationType") PermissionLocationType locationType +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsModifyRulesParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsModifyRulesParams.java new file mode 100644 index 0000000000..ca91f611e9 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsModifyRulesParams.java @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Scope and add/remove instructions for modifying session- or location-scoped permission rules. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsModifyRulesParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Whether the change applies to ephemeral session-scoped rules (cleared at session end) or to location-scoped rules persisted via the location-permissions config file. */ + @JsonProperty("scope") PermissionsModifyRulesScope scope, + /** Rules to add to the scope. Applied before `remove`/`removeAll`. */ + @JsonProperty("add") List add, + /** Specific rules to remove from the scope. Ignored when `removeAll` is true. */ + @JsonProperty("remove") List remove, + /** When true, removes every rule currently in the scope (after any `add` is applied). Useful for clearing the location scope wholesale. */ + @JsonProperty("removeAll") Boolean removeAll +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsModifyRulesResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsModifyRulesResult.java new file mode 100644 index 0000000000..b4ed7786f9 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsModifyRulesResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the operation succeeded. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsModifyRulesResult( + /** Whether the operation succeeded */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsNotifyPromptShownParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsNotifyPromptShownParams.java new file mode 100644 index 0000000000..50129680ff --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsNotifyPromptShownParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Notification payload describing the permission prompt that the client just rendered. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsNotifyPromptShownParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Human-readable description of the prompt the user is being asked to approve. Used by the runtime to fire the registered `permission_prompt` notification hook (e.g. terminal bell, desktop notification). */ + @JsonProperty("message") String message +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsNotifyPromptShownResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsNotifyPromptShownResult.java new file mode 100644 index 0000000000..6f2a368f40 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsNotifyPromptShownResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the operation succeeded. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsNotifyPromptShownResult( + /** Whether the operation succeeded */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsAddParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsAddParams.java new file mode 100644 index 0000000000..5730b6b5e5 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsAddParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Directory path to add to the session's allowed directories. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsPathsAddParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Directory to add to the allow-list. The runtime resolves and validates the path before adding. */ + @JsonProperty("path") String path +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsAddResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsAddResult.java new file mode 100644 index 0000000000..efb8fd5c4f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsAddResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the operation succeeded. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsPathsAddResult( + /** Whether the operation succeeded */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsApi.java new file mode 100644 index 0000000000..38ad70c675 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsApi.java @@ -0,0 +1,102 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code permissions.paths} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionPermissionsPathsApi { + + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionPermissionsPathsApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * No parameters; returns the session's allow-listed directories. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture list() { + return caller.invoke("session.permissions.paths.list", java.util.Map.of("sessionId", this.sessionId), SessionPermissionsPathsListResult.class); + } + + /** + * Directory path to add to the session's allowed directories. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture add(SessionPermissionsPathsAddParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.permissions.paths.add", _p, SessionPermissionsPathsAddResult.class); + } + + /** + * Directory path to set as the session's new primary working directory. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture updatePrimary(SessionPermissionsPathsUpdatePrimaryParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.permissions.paths.updatePrimary", _p, SessionPermissionsPathsUpdatePrimaryResult.class); + } + + /** + * Path to evaluate against the session's allowed directories. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture isPathWithinAllowedDirectories(SessionPermissionsPathsIsPathWithinAllowedDirectoriesParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.permissions.paths.isPathWithinAllowedDirectories", _p, SessionPermissionsPathsIsPathWithinAllowedDirectoriesResult.class); + } + + /** + * Path to evaluate against the session's workspace (primary) directory. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture isPathWithinWorkspace(SessionPermissionsPathsIsPathWithinWorkspaceParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.permissions.paths.isPathWithinWorkspace", _p, SessionPermissionsPathsIsPathWithinWorkspaceResult.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsIsPathWithinAllowedDirectoriesParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsIsPathWithinAllowedDirectoriesParams.java new file mode 100644 index 0000000000..71bd09a613 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsIsPathWithinAllowedDirectoriesParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Path to evaluate against the session's allowed directories. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsPathsIsPathWithinAllowedDirectoriesParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Path to check against the session's allowed directories */ + @JsonProperty("path") String path +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsIsPathWithinAllowedDirectoriesResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsIsPathWithinAllowedDirectoriesResult.java new file mode 100644 index 0000000000..6aadee0685 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsIsPathWithinAllowedDirectoriesResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the supplied path is within the session's allowed directories. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsPathsIsPathWithinAllowedDirectoriesResult( + /** Whether the path is within the session's allowed directories */ + @JsonProperty("allowed") Boolean allowed +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsIsPathWithinWorkspaceParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsIsPathWithinWorkspaceParams.java new file mode 100644 index 0000000000..699bf4cc81 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsIsPathWithinWorkspaceParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Path to evaluate against the session's workspace (primary) directory. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsPathsIsPathWithinWorkspaceParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Path to check against the session workspace directory */ + @JsonProperty("path") String path +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsIsPathWithinWorkspaceResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsIsPathWithinWorkspaceResult.java new file mode 100644 index 0000000000..3d64be687d --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsIsPathWithinWorkspaceResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the supplied path is within the session's workspace directory. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsPathsIsPathWithinWorkspaceResult( + /** Whether the path is within the session workspace directory */ + @JsonProperty("allowed") Boolean allowed +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsListParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsListParams.java new file mode 100644 index 0000000000..23fad022d3 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsListParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * No parameters; returns the session's allow-listed directories. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsPathsListParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsListResult.java new file mode 100644 index 0000000000..ab56c4a299 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsListResult.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Snapshot of the session's allow-listed directories and primary working directory. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsPathsListResult( + /** All directories currently allowed for tool access on this session. */ + @JsonProperty("directories") List directories, + /** The primary working directory for this session. */ + @JsonProperty("primary") String primary +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsUpdatePrimaryParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsUpdatePrimaryParams.java new file mode 100644 index 0000000000..626ef57528 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsUpdatePrimaryParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Directory path to set as the session's new primary working directory. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsPathsUpdatePrimaryParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Directory to set as the new primary working directory for the session's permission policy. */ + @JsonProperty("path") String path +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsUpdatePrimaryResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsUpdatePrimaryResult.java new file mode 100644 index 0000000000..34b8c403ee --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPathsUpdatePrimaryResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the operation succeeded. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsPathsUpdatePrimaryResult( + /** Whether the operation succeeded */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPendingRequestsParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPendingRequestsParams.java new file mode 100644 index 0000000000..c7ec7f9462 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPendingRequestsParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * No parameters; returns currently-pending permission requests for the session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsPendingRequestsParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPendingRequestsResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPendingRequestsResult.java new file mode 100644 index 0000000000..b2b3c4ec1a --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsPendingRequestsResult.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * List of pending permission requests reconstructed from event history. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsPendingRequestsResult( + /** Pending permission prompts reconstructed from the session's event history. Equivalent to the set of `permission.requested` events that have not yet been followed by a matching `permission.completed` event. Used by clients (e.g. the CLI) to hydrate UI for prompts that were emitted before the client attached to the session. */ + @JsonProperty("items") List items +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsResetSessionApprovalsParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsResetSessionApprovalsParams.java new file mode 100644 index 0000000000..1f125f14da --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsResetSessionApprovalsParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * No parameters; clears all session-scoped tool permission approvals. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsResetSessionApprovalsParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsResetSessionApprovalsResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsResetSessionApprovalsResult.java new file mode 100644 index 0000000000..81f71aea3b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsResetSessionApprovalsResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the operation succeeded. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsResetSessionApprovalsResult( + /** Whether the operation succeeded */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsSetApproveAllParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsSetApproveAllParams.java new file mode 100644 index 0000000000..c61bdcca0d --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsSetApproveAllParams.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Allow-all toggle for tool permission requests, with an optional telemetry source. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsSetApproveAllParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Whether to auto-approve all tool permission requests */ + @JsonProperty("enabled") Boolean enabled, + /** Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. */ + @JsonProperty("source") PermissionsSetApproveAllSource source +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsSetApproveAllResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsSetApproveAllResult.java new file mode 100644 index 0000000000..50301af4a5 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsSetApproveAllResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the operation succeeded. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsSetApproveAllResult( + /** Whether the operation succeeded */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsSetRequiredParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsSetRequiredParams.java new file mode 100644 index 0000000000..e862dd76fe --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsSetRequiredParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Toggles whether permission prompts should be bridged into session events for this client. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsSetRequiredParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Whether the client wants `permission.requested` events bridged from the session-owned permission service. CLI clients that render prompt UI set this to `true` for as long as their listener is mounted; headless callers leave it unset (the default is `false`). */ + @JsonProperty("required") Boolean required +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsSetRequiredResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsSetRequiredResult.java new file mode 100644 index 0000000000..56f90afbc4 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsSetRequiredResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the operation succeeded. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsSetRequiredResult( + /** Whether the operation succeeded */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsUrlsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsUrlsApi.java new file mode 100644 index 0000000000..1f46c66dcc --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsUrlsApi.java @@ -0,0 +1,47 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code permissions.urls} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionPermissionsUrlsApi { + + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionPermissionsUrlsApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Whether the URL-permission policy should run in unrestricted mode. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture setUnrestrictedMode(SessionPermissionsUrlsSetUnrestrictedModeParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.permissions.urls.setUnrestrictedMode", _p, SessionPermissionsUrlsSetUnrestrictedModeResult.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsUrlsSetUnrestrictedModeParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsUrlsSetUnrestrictedModeParams.java new file mode 100644 index 0000000000..ed3c0bc6b3 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsUrlsSetUnrestrictedModeParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Whether the URL-permission policy should run in unrestricted mode. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsUrlsSetUnrestrictedModeParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Whether to allow access to all URLs without prompting. Toggles the runtime's URL-permission policy in place. */ + @JsonProperty("enabled") Boolean enabled +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsUrlsSetUnrestrictedModeResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsUrlsSetUnrestrictedModeResult.java new file mode 100644 index 0000000000..41199db33c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsUrlsSetUnrestrictedModeResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the operation succeeded. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsUrlsSetUnrestrictedModeResult( + /** Whether the operation succeeded */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanApi.java index 8792bce7e0..1656211380 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanApi.java @@ -30,7 +30,9 @@ public final class SessionPlanApi { } /** - * Invokes {@code session.plan.read}. + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 */ public CompletableFuture read() { @@ -38,10 +40,12 @@ public CompletableFuture read() { } /** - * Invokes {@code session.plan.update}. + * Replacement contents to write to the session plan file. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 */ public CompletableFuture update(SessionPlanUpdateParams params) { @@ -51,7 +55,9 @@ public CompletableFuture update(SessionPlanUpdateParams params) { } /** - * Invokes {@code session.plan.delete}. + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 */ public CompletableFuture delete() { diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanDeleteParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanDeleteParams.java index ba09c2d660..5e7732fb83 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanDeleteParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanDeleteParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.plan.delete} RPC method. + * Identifies the target session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanReadParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanReadParams.java index 23484403de..2891852ea7 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanReadParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanReadParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.plan.read} RPC method. + * Identifies the target session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanReadResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanReadResult.java index ddfe1cf5c3..3b5c1634ad 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanReadResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanReadResult.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.plan.read} RPC method. + * Existence, contents, and resolved path of the session plan file. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanUpdateParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanUpdateParams.java index 9bd69e3848..fea63cf01f 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanUpdateParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPlanUpdateParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.plan.update} RPC method. + * Replacement contents to write to the session plan file. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPluginsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPluginsApi.java index 897fecd162..176310e118 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPluginsApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPluginsApi.java @@ -28,7 +28,7 @@ public final class SessionPluginsApi { } /** - * Invokes {@code session.plugins.list}. + * Identifies the target session. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPluginsListParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPluginsListParams.java index b3407dd520..f5923c0d22 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPluginsListParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPluginsListParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.plugins.list} RPC method. + * Identifies the target session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPluginsListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPluginsListResult.java index d6008318d8..c5acac58de 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPluginsListResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPluginsListResult.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.plugins.list} RPC method. + * Plugins installed for the session, with their enabled state and version metadata. * * @since 1.0.0 */ @@ -23,20 +23,6 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record SessionPluginsListResult( /** Installed plugins */ - @JsonProperty("plugins") List plugins + @JsonProperty("plugins") List plugins ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionPluginsListResultPluginsItem( - /** Plugin name */ - @JsonProperty("name") String name, - /** Marketplace the plugin came from */ - @JsonProperty("marketplace") String marketplace, - /** Installed version */ - @JsonProperty("version") String version, - /** Whether the plugin is currently enabled */ - @JsonProperty("enabled") Boolean enabled - ) { - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionQueueApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionQueueApi.java new file mode 100644 index 0000000000..19533541df --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionQueueApi.java @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code queue} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionQueueApi { + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionQueueApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture pendingItems() { + return caller.invoke("session.queue.pendingItems", java.util.Map.of("sessionId", this.sessionId), SessionQueuePendingItemsResult.class); + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture removeMostRecent() { + return caller.invoke("session.queue.removeMostRecent", java.util.Map.of("sessionId", this.sessionId), SessionQueueRemoveMostRecentResult.class); + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture clear() { + return caller.invoke("session.queue.clear", java.util.Map.of("sessionId", this.sessionId), Void.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionQueueClearParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionQueueClearParams.java new file mode 100644 index 0000000000..1ab26019e3 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionQueueClearParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionQueueClearParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionQueuePendingItemsParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionQueuePendingItemsParams.java new file mode 100644 index 0000000000..6bc51f8075 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionQueuePendingItemsParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionQueuePendingItemsParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionQueuePendingItemsResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionQueuePendingItemsResult.java new file mode 100644 index 0000000000..9f839fdc1a --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionQueuePendingItemsResult.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Snapshot of the session's pending queued items and immediate-steering messages. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionQueuePendingItemsResult( + /** Pending queued items in submission order. Includes user messages, queued slash commands, and queued model changes; omits internal system items. */ + @JsonProperty("items") List items, + /** Display text for messages currently in the immediate steering queue (interjections sent during a running turn). */ + @JsonProperty("steeringMessages") List steeringMessages +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionQueueRemoveMostRecentParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionQueueRemoveMostRecentParams.java new file mode 100644 index 0000000000..1ca36be68c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionQueueRemoveMostRecentParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionQueueRemoveMostRecentParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionQueueRemoveMostRecentResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionQueueRemoveMostRecentResult.java new file mode 100644 index 0000000000..a92c93d5fe --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionQueueRemoveMostRecentResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether a user-facing pending item was removed. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionQueueRemoveMostRecentResult( + /** True if a user-facing pending item was removed (LIFO across both queues); false when no removable items remained. */ + @JsonProperty("removed") Boolean removed +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteApi.java new file mode 100644 index 0000000000..f5f0ec3cc9 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteApi.java @@ -0,0 +1,72 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code remote} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionRemoteApi { + + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionRemoteApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Optional remote session mode ("off", "export", or "on"); defaults to enabling both export and remote steering. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture enable(SessionRemoteEnableParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.remote.enable", _p, SessionRemoteEnableResult.class); + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture disable() { + return caller.invoke("session.remote.disable", java.util.Map.of("sessionId", this.sessionId), Void.class); + } + + /** + * New remote-steerability state to persist as a `session.remote_steerable_changed` event. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture notifySteerableChanged(SessionRemoteNotifySteerableChangedParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.remote.notifySteerableChanged", _p, Void.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteDisableParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteDisableParams.java new file mode 100644 index 0000000000..c2ebe21e87 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteDisableParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionRemoteDisableParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteEnableParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteEnableParams.java new file mode 100644 index 0000000000..b487353cbc --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteEnableParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Optional remote session mode ("off", "export", or "on"); defaults to enabling both export and remote steering. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionRemoteEnableParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Per-session remote mode. "off" disables remote, "export" exports session events to GitHub without enabling remote steering, "on" enables both export and remote steering. */ + @JsonProperty("mode") RemoteSessionMode mode +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteEnableResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteEnableResult.java new file mode 100644 index 0000000000..b098ebbef2 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteEnableResult.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * GitHub URL for the session and a flag indicating whether remote steering is enabled. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionRemoteEnableResult( + /** GitHub frontend URL for this session */ + @JsonProperty("url") String url, + /** Whether remote steering is enabled */ + @JsonProperty("remoteSteerable") Boolean remoteSteerable +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteNotifySteerableChangedParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteNotifySteerableChangedParams.java new file mode 100644 index 0000000000..8851fad7ab --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteNotifySteerableChangedParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * New remote-steerability state to persist as a `session.remote_steerable_changed` event. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionRemoteNotifySteerableChangedParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Whether the session now supports remote steering via GitHub. The runtime persists this as a `session.remote_steerable_changed` event so resume/replay sees the up-to-date capability. */ + @JsonProperty("remoteSteerable") Boolean remoteSteerable +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteNotifySteerableChangedResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteNotifySteerableChangedResult.java new file mode 100644 index 0000000000..857f373624 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteNotifySteerableChangedResult.java @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Persist a steerability change as a `session.remote_steerable_changed` event. Used by the host (CLI / SDK consumer) when it has just finished enabling or disabling steering on a remote exporter that the runtime does not directly own. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionRemoteNotifySteerableChangedResult() { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRpc.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRpc.java index 9faf4612d5..a2639eb0a6 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRpc.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRpc.java @@ -28,40 +28,64 @@ public final class SessionRpc { private final RpcCaller caller; private final String sessionId; + /** API methods for the {@code auth} namespace. */ + public final SessionAuthApi auth; /** API methods for the {@code model} namespace. */ public final SessionModelApi model; /** API methods for the {@code mode} namespace. */ public final SessionModeApi mode; + /** API methods for the {@code name} namespace. */ + public final SessionNameApi name; /** API methods for the {@code plan} namespace. */ public final SessionPlanApi plan; - /** API methods for the {@code workspace} namespace. */ - public final SessionWorkspaceApi workspace; + /** API methods for the {@code workspaces} namespace. */ + public final SessionWorkspacesApi workspaces; + /** API methods for the {@code instructions} namespace. */ + public final SessionInstructionsApi instructions; /** API methods for the {@code fleet} namespace. */ public final SessionFleetApi fleet; /** API methods for the {@code agent} namespace. */ public final SessionAgentApi agent; + /** API methods for the {@code tasks} namespace. */ + public final SessionTasksApi tasks; /** API methods for the {@code skills} namespace. */ public final SessionSkillsApi skills; /** API methods for the {@code mcp} namespace. */ public final SessionMcpApi mcp; /** API methods for the {@code plugins} namespace. */ public final SessionPluginsApi plugins; + /** API methods for the {@code options} namespace. */ + public final SessionOptionsApi options; + /** API methods for the {@code lsp} namespace. */ + public final SessionLspApi lsp; /** API methods for the {@code extensions} namespace. */ public final SessionExtensionsApi extensions; /** API methods for the {@code tools} namespace. */ public final SessionToolsApi tools; /** API methods for the {@code commands} namespace. */ public final SessionCommandsApi commands; + /** API methods for the {@code telemetry} namespace. */ + public final SessionTelemetryApi telemetry; /** API methods for the {@code ui} namespace. */ public final SessionUiApi ui; /** API methods for the {@code permissions} namespace. */ public final SessionPermissionsApi permissions; + /** API methods for the {@code metadata} namespace. */ + public final SessionMetadataApi metadata; /** API methods for the {@code shell} namespace. */ public final SessionShellApi shell; /** API methods for the {@code history} namespace. */ public final SessionHistoryApi history; + /** API methods for the {@code queue} namespace. */ + public final SessionQueueApi queue; + /** API methods for the {@code eventLog} namespace. */ + public final SessionEventLogApi eventLog; /** API methods for the {@code usage} namespace. */ public final SessionUsageApi usage; + /** API methods for the {@code remote} namespace. */ + public final SessionRemoteApi remote; + /** API methods for the {@code schedule} namespace. */ + public final SessionScheduleApi schedule; /** * Creates a new session RPC client. @@ -72,30 +96,99 @@ public final class SessionRpc { public SessionRpc(RpcCaller caller, String sessionId) { this.caller = caller; this.sessionId = sessionId; + this.auth = new SessionAuthApi(caller, sessionId); this.model = new SessionModelApi(caller, sessionId); this.mode = new SessionModeApi(caller, sessionId); + this.name = new SessionNameApi(caller, sessionId); this.plan = new SessionPlanApi(caller, sessionId); - this.workspace = new SessionWorkspaceApi(caller, sessionId); + this.workspaces = new SessionWorkspacesApi(caller, sessionId); + this.instructions = new SessionInstructionsApi(caller, sessionId); this.fleet = new SessionFleetApi(caller, sessionId); this.agent = new SessionAgentApi(caller, sessionId); + this.tasks = new SessionTasksApi(caller, sessionId); this.skills = new SessionSkillsApi(caller, sessionId); this.mcp = new SessionMcpApi(caller, sessionId); this.plugins = new SessionPluginsApi(caller, sessionId); + this.options = new SessionOptionsApi(caller, sessionId); + this.lsp = new SessionLspApi(caller, sessionId); this.extensions = new SessionExtensionsApi(caller, sessionId); this.tools = new SessionToolsApi(caller, sessionId); this.commands = new SessionCommandsApi(caller, sessionId); + this.telemetry = new SessionTelemetryApi(caller, sessionId); this.ui = new SessionUiApi(caller, sessionId); this.permissions = new SessionPermissionsApi(caller, sessionId); + this.metadata = new SessionMetadataApi(caller, sessionId); this.shell = new SessionShellApi(caller, sessionId); this.history = new SessionHistoryApi(caller, sessionId); + this.queue = new SessionQueueApi(caller, sessionId); + this.eventLog = new SessionEventLogApi(caller, sessionId); this.usage = new SessionUsageApi(caller, sessionId); + this.remote = new SessionRemoteApi(caller, sessionId); + this.schedule = new SessionScheduleApi(caller, sessionId); } /** - * Invokes {@code session.log}. + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture suspend() { + return caller.invoke("session.suspend", java.util.Map.of("sessionId", this.sessionId), Void.class); + } + + /** + * Parameters for sending a user message to the session + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture send(SessionSendParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.send", _p, SessionSendResult.class); + } + + /** + * Parameters for aborting the current turn + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture abort(SessionAbortParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.abort", _p, SessionAbortResult.class); + } + + /** + * Parameters for shutting down the session + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture shutdown(SessionShutdownParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.shutdown", _p, Void.class); + } + + /** + * Message text, optional severity level, persistence flag, optional follow-up URL, and optional tip. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 */ public CompletableFuture log(SessionLogParams params) { diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionScheduleApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionScheduleApi.java new file mode 100644 index 0000000000..a0714233b3 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionScheduleApi.java @@ -0,0 +1,57 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code schedule} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionScheduleApi { + + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionScheduleApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture list() { + return caller.invoke("session.schedule.list", java.util.Map.of("sessionId", this.sessionId), SessionScheduleListResult.class); + } + + /** + * Identifier of the scheduled prompt to remove. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture stop(SessionScheduleStopParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.schedule.stop", _p, SessionScheduleStopResult.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionScheduleListParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionScheduleListParams.java new file mode 100644 index 0000000000..0b32d10d8f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionScheduleListParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionScheduleListParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionScheduleListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionScheduleListResult.java new file mode 100644 index 0000000000..80202f88d7 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionScheduleListResult.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Snapshot of the currently active recurring prompts for this session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionScheduleListResult( + /** Active scheduled prompts, ordered by id. */ + @JsonProperty("entries") List entries +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionScheduleStopParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionScheduleStopParams.java new file mode 100644 index 0000000000..f82cca373b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionScheduleStopParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifier of the scheduled prompt to remove. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionScheduleStopParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Id of the scheduled prompt to remove. */ + @JsonProperty("id") Long id +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionScheduleStopResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionScheduleStopResult.java new file mode 100644 index 0000000000..8037068035 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionScheduleStopResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Remove a scheduled prompt by id. The result entry is omitted if the id was unknown. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionScheduleStopResult( + /** The removed entry, or omitted if no entry matched. */ + @JsonProperty("entry") ScheduleEntry entry +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSendParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSendParams.java new file mode 100644 index 0000000000..caebce5268 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSendParams.java @@ -0,0 +1,55 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; +import javax.annotation.processing.Generated; + +/** + * Parameters for sending a user message to the session + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionSendParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** The user message text */ + @JsonProperty("prompt") String prompt, + /** If provided, this is shown in the timeline instead of `prompt` */ + @JsonProperty("displayPrompt") String displayPrompt, + /** Optional attachments (files, directories, selections, blobs, GitHub references) to include with the message */ + @JsonProperty("attachments") List attachments, + /** How to deliver the message. `enqueue` (default) appends to the message queue. `immediate` interjects during an in-progress turn. */ + @JsonProperty("mode") SendMode mode, + /** If true, adds the message to the front of the queue instead of the end */ + @JsonProperty("prepend") Boolean prepend, + /** If false, this message will not trigger a Premium Request Unit charge. User messages default to billable. */ + @JsonProperty("billable") Boolean billable, + /** If set, the request will fail if the named tool is not available when this message is among the user messages at the start of the current exchange */ + @JsonProperty("requiredTool") String requiredTool, + /** Optional provenance tag copied to the resulting user.message event. Supported values are `system`, `command-*`, and `schedule-*`. */ + @JsonProperty("source") Object source, + /** The UI mode the agent was in when this message was sent. Defaults to the session's current mode. */ + @JsonProperty("agentMode") SendAgentMode agentMode, + /** Custom HTTP headers to include in outbound model requests for this turn. Merged with session-level provider headers; per-turn headers augment and overwrite session-level headers with the same key. */ + @JsonProperty("requestHeaders") Map requestHeaders, + /** W3C Trace Context traceparent header for distributed tracing of this agent turn */ + @JsonProperty("traceparent") String traceparent, + /** W3C Trace Context tracestate header for distributed tracing */ + @JsonProperty("tracestate") String tracestate, + /** If true, await completion of the agentic loop for this message before returning. Defaults to false (fire-and-forget). When true, the result still contains the same `messageId`; the caller can rely on the agent having processed the message before the call resolves. */ + @JsonProperty("wait") Boolean wait_ +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSendResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSendResult.java new file mode 100644 index 0000000000..d93c58ce1e --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSendResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Result of sending a user message + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionSendResult( + /** Unique identifier assigned to the message */ + @JsonProperty("messageId") String messageId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellApi.java index b86074342c..6ed7c8b6bb 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellApi.java @@ -30,10 +30,12 @@ public final class SessionShellApi { } /** - * Invokes {@code session.shell.exec}. + * Shell command to run, with optional working directory and timeout in milliseconds. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 */ public CompletableFuture exec(SessionShellExecParams params) { @@ -43,10 +45,12 @@ public CompletableFuture exec(SessionShellExecParams par } /** - * Invokes {@code session.shell.kill}. + * Identifier of a process previously returned by "shell.exec" and the signal to send. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 */ public CompletableFuture kill(SessionShellKillParams params) { diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellExecParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellExecParams.java index 9e9d93e99f..82a5815d90 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellExecParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellExecParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.shell.exec} RPC method. + * Shell command to run, with optional working directory and timeout in milliseconds. * * @since 1.0.0 */ @@ -28,6 +28,6 @@ public record SessionShellExecParams( /** Working directory (defaults to session working directory) */ @JsonProperty("cwd") String cwd, /** Timeout in milliseconds (default: 30000) */ - @JsonProperty("timeout") Double timeout + @JsonProperty("timeout") Long timeout ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellExecResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellExecResult.java index 34288630b4..d7790ce700 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellExecResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellExecResult.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.shell.exec} RPC method. + * Identifier of the spawned process, used to correlate streamed output and exit notifications. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellKillParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellKillParams.java index 19569dd0e7..c89e219822 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellKillParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellKillParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.shell.kill} RPC method. + * Identifier of a process previously returned by "shell.exec" and the signal to send. * * @since 1.0.0 */ @@ -26,28 +26,6 @@ public record SessionShellKillParams( /** Process identifier returned by shell.exec */ @JsonProperty("processId") String processId, /** Signal to send (default: SIGTERM) */ - @JsonProperty("signal") SessionShellKillParamsSignal signal + @JsonProperty("signal") ShellKillSignal signal ) { - - /** Signal to send (default: SIGTERM) */ - public enum SessionShellKillParamsSignal { - /** The {@code SIGTERM} variant. */ - SIGTERM("SIGTERM"), - /** The {@code SIGKILL} variant. */ - SIGKILL("SIGKILL"), - /** The {@code SIGINT} variant. */ - SIGINT("SIGINT"); - - private final String value; - SessionShellKillParamsSignal(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionShellKillParamsSignal fromValue(String value) { - for (SessionShellKillParamsSignal v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionShellKillParamsSignal value: " + value); - } - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellKillResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellKillResult.java index e786d93c40..163c990bb8 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellKillResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellKillResult.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.shell.kill} RPC method. + * Indicates whether the signal was delivered; false if the process was unknown or already exited. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShutdownParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShutdownParams.java new file mode 100644 index 0000000000..e7bf266e8f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShutdownParams.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Parameters for shutting down the session + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionShutdownParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Why the session is being shut down. Defaults to "routine" when omitted. */ + @JsonProperty("type") ShutdownType type, + /** Optional human-readable reason. Typically the message of the error that triggered shutdown when type is 'error'. */ + @JsonProperty("reason") String reason +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsApi.java index b32419a3e6..82cea6a8fe 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsApi.java @@ -30,7 +30,7 @@ public final class SessionSkillsApi { } /** - * Invokes {@code session.skills.list}. + * Identifies the target session. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 @@ -40,7 +40,17 @@ public CompletableFuture list() { } /** - * Invokes {@code session.skills.enable}. + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture getInvoked() { + return caller.invoke("session.skills.getInvoked", java.util.Map.of("sessionId", this.sessionId), SessionSkillsGetInvokedResult.class); + } + + /** + * Name of the skill to enable for the session. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. @@ -55,7 +65,7 @@ public CompletableFuture enable(SessionSkillsEnableParams params) { } /** - * Invokes {@code session.skills.disable}. + * Name of the skill to disable for the session. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. @@ -70,13 +80,23 @@ public CompletableFuture disable(SessionSkillsDisableParams params) { } /** - * Invokes {@code session.skills.reload}. + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture reload() { + return caller.invoke("session.skills.reload", java.util.Map.of("sessionId", this.sessionId), SessionSkillsReloadResult.class); + } + + /** + * Identifies the target session. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 */ - public CompletableFuture reload() { - return caller.invoke("session.skills.reload", java.util.Map.of("sessionId", this.sessionId), Void.class); + public CompletableFuture ensureLoaded() { + return caller.invoke("session.skills.ensureLoaded", java.util.Map.of("sessionId", this.sessionId), Void.class); } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsDisableParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsDisableParams.java index 163df3a0a0..82f20ececc 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsDisableParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsDisableParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.skills.disable} RPC method. + * Name of the skill to disable for the session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsEnableParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsEnableParams.java index 72b1944cd5..0d42ce06ed 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsEnableParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsEnableParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.skills.enable} RPC method. + * Name of the skill to enable for the session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsEnsureLoadedParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsEnsureLoadedParams.java new file mode 100644 index 0000000000..8b7ab0e628 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsEnsureLoadedParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionSkillsEnsureLoadedParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsGetInvokedParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsGetInvokedParams.java new file mode 100644 index 0000000000..8ae29d5e7f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsGetInvokedParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionSkillsGetInvokedParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsGetInvokedResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsGetInvokedResult.java new file mode 100644 index 0000000000..f20c657c07 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsGetInvokedResult.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Skills invoked during this session, ordered by invocation time (most recent last). + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionSkillsGetInvokedResult( + /** Skills invoked during this session, ordered by invocation time (most recent last) */ + @JsonProperty("skills") List skills +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsListParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsListParams.java index 5575ef4789..6f8986bfd1 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsListParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsListParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.skills.list} RPC method. + * Identifies the target session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsListResult.java index dc6ba023e8..98bafbaff8 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsListResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsListResult.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.skills.list} RPC method. + * Skills available to the session, with their enabled state. * * @since 1.0.0 */ @@ -23,24 +23,6 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record SessionSkillsListResult( /** Available skills */ - @JsonProperty("skills") List skills + @JsonProperty("skills") List skills ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionSkillsListResultSkillsItem( - /** Unique identifier for the skill */ - @JsonProperty("name") String name, - /** Description of what the skill does */ - @JsonProperty("description") String description, - /** Source location type (e.g., project, personal, plugin) */ - @JsonProperty("source") String source, - /** Whether the skill can be invoked by the user as a slash command */ - @JsonProperty("userInvocable") Boolean userInvocable, - /** Whether the skill is currently enabled */ - @JsonProperty("enabled") Boolean enabled, - /** Absolute path to the skill file */ - @JsonProperty("path") String path - ) { - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsReloadParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsReloadParams.java index 664fd836a0..5c2cdbeb36 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsReloadParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsReloadParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.skills.reload} RPC method. + * Identifies the target session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsReloadResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsReloadResult.java index 1bfca46e1a..10d4fa7de9 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsReloadResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsReloadResult.java @@ -10,15 +10,21 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; import javax.annotation.processing.Generated; /** - * Result for the {@code session.skills.reload} RPC method. + * Diagnostics from reloading skill definitions, with warnings and errors as separate lists. * * @since 1.0.0 */ @javax.annotation.processing.Generated("copilot-sdk-codegen") @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public record SessionSkillsReloadResult() { +public record SessionSkillsReloadResult( + /** Warnings emitted while loading skills (e.g. skills that loaded but had issues) */ + @JsonProperty("warnings") List warnings, + /** Errors emitted while loading skills (e.g. skills that failed to load entirely) */ + @JsonProperty("errors") List errors +) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSuspendParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSuspendParams.java new file mode 100644 index 0000000000..103cefc687 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSuspendParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionSuspendParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksApi.java new file mode 100644 index 0000000000..5fa5ca90f5 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksApi.java @@ -0,0 +1,172 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code tasks} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionTasksApi { + + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionTasksApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Agent type, prompt, name, and optional description and model override for the new task. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture startAgent(SessionTasksStartAgentParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.tasks.startAgent", _p, SessionTasksStartAgentResult.class); + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture list() { + return caller.invoke("session.tasks.list", java.util.Map.of("sessionId", this.sessionId), SessionTasksListResult.class); + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture refresh() { + return caller.invoke("session.tasks.refresh", java.util.Map.of("sessionId", this.sessionId), Void.class); + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture waitForPending() { + return caller.invoke("session.tasks.waitForPending", java.util.Map.of("sessionId", this.sessionId), Void.class); + } + + /** + * Identifier of the background task to fetch progress for. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture getProgress(SessionTasksGetProgressParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.tasks.getProgress", _p, SessionTasksGetProgressResult.class); + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture getCurrentPromotable() { + return caller.invoke("session.tasks.getCurrentPromotable", java.util.Map.of("sessionId", this.sessionId), SessionTasksGetCurrentPromotableResult.class); + } + + /** + * Identifier of the task to promote to background mode. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture promoteToBackground(SessionTasksPromoteToBackgroundParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.tasks.promoteToBackground", _p, SessionTasksPromoteToBackgroundResult.class); + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture promoteCurrentToBackground() { + return caller.invoke("session.tasks.promoteCurrentToBackground", java.util.Map.of("sessionId", this.sessionId), SessionTasksPromoteCurrentToBackgroundResult.class); + } + + /** + * Identifier of the background task to cancel. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture cancel(SessionTasksCancelParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.tasks.cancel", _p, SessionTasksCancelResult.class); + } + + /** + * Identifier of the completed or cancelled task to remove from tracking. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture remove(SessionTasksRemoveParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.tasks.remove", _p, SessionTasksRemoveResult.class); + } + + /** + * Identifier of the target agent task, message content, and optional sender agent ID. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture sendMessage(SessionTasksSendMessageParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.tasks.sendMessage", _p, SessionTasksSendMessageResult.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksCancelParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksCancelParams.java new file mode 100644 index 0000000000..e00f9fcf86 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksCancelParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifier of the background task to cancel. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksCancelParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Task identifier */ + @JsonProperty("id") String id +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksCancelResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksCancelResult.java new file mode 100644 index 0000000000..1ecae81525 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksCancelResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the background task was successfully cancelled. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksCancelResult( + /** Whether the task was successfully cancelled */ + @JsonProperty("cancelled") Boolean cancelled +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksGetCurrentPromotableParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksGetCurrentPromotableParams.java new file mode 100644 index 0000000000..e183c7bc4d --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksGetCurrentPromotableParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksGetCurrentPromotableParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksGetCurrentPromotableResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksGetCurrentPromotableResult.java new file mode 100644 index 0000000000..65eee3220c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksGetCurrentPromotableResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * The first sync-waiting task that can currently be promoted to background mode. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksGetCurrentPromotableResult( + /** The first sync-waiting task (agent first, then shell) that can currently be promoted to background mode. Omitted if no such task exists. The returned task is guaranteed to have executionMode='sync' and canPromoteToBackground=true at the time of the call. */ + @JsonProperty("task") Object task +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksGetProgressParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksGetProgressParams.java new file mode 100644 index 0000000000..bcdf9a8d8c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksGetProgressParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifier of the background task to fetch progress for. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksGetProgressParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Task identifier (agent ID or shell ID) */ + @JsonProperty("id") String id +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksGetProgressResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksGetProgressResult.java new file mode 100644 index 0000000000..d2a4c7eb54 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksGetProgressResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Progress information for the task, or null when no task with that ID is tracked. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksGetProgressResult( + /** Progress information for the task, discriminated by type. Returns null when no task with this ID is currently tracked. */ + @JsonProperty("progress") Object progress +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksListParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksListParams.java new file mode 100644 index 0000000000..8716e95492 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksListParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksListParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksListResult.java new file mode 100644 index 0000000000..307cdd6b9d --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksListResult.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Background tasks currently tracked by the session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksListResult( + /** Currently tracked tasks */ + @JsonProperty("tasks") List tasks +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksPromoteCurrentToBackgroundParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksPromoteCurrentToBackgroundParams.java new file mode 100644 index 0000000000..31c7fa94ab --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksPromoteCurrentToBackgroundParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksPromoteCurrentToBackgroundParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksPromoteCurrentToBackgroundResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksPromoteCurrentToBackgroundResult.java new file mode 100644 index 0000000000..590082505b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksPromoteCurrentToBackgroundResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * The promoted task as it now exists in background mode, omitted if no promotable task was waiting. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksPromoteCurrentToBackgroundResult( + /** The promoted task as it now exists in background mode, omitted if no promotable task was waiting. Atomic operation: avoids the race window of getCurrentPromotable + promoteToBackground. */ + @JsonProperty("task") Object task +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksPromoteToBackgroundParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksPromoteToBackgroundParams.java new file mode 100644 index 0000000000..6dc27fd7c5 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksPromoteToBackgroundParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifier of the task to promote to background mode. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksPromoteToBackgroundParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Task identifier */ + @JsonProperty("id") String id +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksPromoteToBackgroundResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksPromoteToBackgroundResult.java new file mode 100644 index 0000000000..9580bc6089 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksPromoteToBackgroundResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the task was successfully promoted to background mode. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksPromoteToBackgroundResult( + /** Whether the task was successfully promoted to background mode */ + @JsonProperty("promoted") Boolean promoted +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksRefreshParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksRefreshParams.java new file mode 100644 index 0000000000..3560835af5 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksRefreshParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksRefreshParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksRefreshResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksRefreshResult.java new file mode 100644 index 0000000000..c386369763 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksRefreshResult.java @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Refresh metadata for any detached background shells the runtime knows about. Use after a long pause to pick up exit/output state for shells running outside the agent loop. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksRefreshResult() { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksRemoveParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksRemoveParams.java new file mode 100644 index 0000000000..69fdfbd414 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksRemoveParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifier of the completed or cancelled task to remove from tracking. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksRemoveParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Task identifier */ + @JsonProperty("id") String id +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksRemoveResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksRemoveResult.java new file mode 100644 index 0000000000..44ff4eb755 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksRemoveResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the task was removed. False when the task does not exist or is still running/idle. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksRemoveResult( + /** Whether the task was removed. Returns false if the task does not exist or is still running/idle (cancel it first). */ + @JsonProperty("removed") Boolean removed +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksSendMessageParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksSendMessageParams.java new file mode 100644 index 0000000000..5b496b080d --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksSendMessageParams.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifier of the target agent task, message content, and optional sender agent ID. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksSendMessageParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Agent task identifier */ + @JsonProperty("id") String id, + /** Message content to send to the agent */ + @JsonProperty("message") String message, + /** Agent ID of the sender, if sent on behalf of another agent */ + @JsonProperty("fromAgentId") String fromAgentId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksSendMessageResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksSendMessageResult.java new file mode 100644 index 0000000000..0f72e5a697 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksSendMessageResult.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the message was delivered, with an error message when delivery failed. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksSendMessageResult( + /** Whether the message was successfully delivered or steered */ + @JsonProperty("sent") Boolean sent, + /** Error message if delivery failed */ + @JsonProperty("error") String error +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksStartAgentParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksStartAgentParams.java new file mode 100644 index 0000000000..3ad64c52e4 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksStartAgentParams.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Agent type, prompt, name, and optional description and model override for the new task. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksStartAgentParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Type of agent to start (e.g., 'explore', 'task', 'general-purpose') */ + @JsonProperty("agentType") String agentType, + /** Task prompt for the agent */ + @JsonProperty("prompt") String prompt, + /** Short name for the agent, used to generate a human-readable ID */ + @JsonProperty("name") String name, + /** Short description of the task */ + @JsonProperty("description") String description, + /** Optional model override */ + @JsonProperty("model") String model +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksStartAgentResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksStartAgentResult.java new file mode 100644 index 0000000000..96bab97fa4 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksStartAgentResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifier assigned to the newly started background agent task. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksStartAgentResult( + /** Generated agent ID for the background task */ + @JsonProperty("agentId") String agentId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksWaitForPendingParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksWaitForPendingParams.java new file mode 100644 index 0000000000..6dc9358223 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksWaitForPendingParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksWaitForPendingParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksWaitForPendingResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksWaitForPendingResult.java new file mode 100644 index 0000000000..5cbce9cd5a --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTasksWaitForPendingResult.java @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Wait until all in-flight background tasks (agents + shells) and any follow-up turns scheduled by their completions have settled. Returns when the runtime is fully drained or after an internal timeout (default 10 minutes; configurable via COPILOT_TASK_WAIT_TIMEOUT_SECONDS). + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTasksWaitForPendingResult() { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTelemetryApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTelemetryApi.java new file mode 100644 index 0000000000..5cad4e771c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTelemetryApi.java @@ -0,0 +1,47 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code telemetry} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionTelemetryApi { + + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionTelemetryApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Feature override key/value pairs to attach to subsequent telemetry events from this session. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture setFeatureOverrides(SessionTelemetrySetFeatureOverridesParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.telemetry.setFeatureOverrides", _p, Void.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTelemetrySetFeatureOverridesParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTelemetrySetFeatureOverridesParams.java new file mode 100644 index 0000000000..aa0d4e3c3b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionTelemetrySetFeatureOverridesParams.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import javax.annotation.processing.Generated; + +/** + * Feature override key/value pairs to attach to subsequent telemetry events from this session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionTelemetrySetFeatureOverridesParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Override key/value pairs to attach to subsequent telemetry events from this session. Replaces any previously-set overrides. */ + @JsonProperty("features") Map features +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsApi.java index 91d0587c72..ded5886273 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsApi.java @@ -30,10 +30,12 @@ public final class SessionToolsApi { } /** - * Invokes {@code session.tools.handlePendingToolCall}. + * Pending external tool call request ID, with the tool result or an error describing why it failed. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 */ public CompletableFuture handlePendingToolCall(SessionToolsHandlePendingToolCallParams params) { @@ -42,4 +44,14 @@ public CompletableFuture handlePendingT return caller.invoke("session.tools.handlePendingToolCall", _p, SessionToolsHandlePendingToolCallResult.class); } + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture initializeAndValidate() { + return caller.invoke("session.tools.initializeAndValidate", java.util.Map.of("sessionId", this.sessionId), Void.class); + } + } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsHandlePendingToolCallParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsHandlePendingToolCallParams.java index 796001d8f1..3bdde09047 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsHandlePendingToolCallParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsHandlePendingToolCallParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.tools.handlePendingToolCall} RPC method. + * Pending external tool call request ID, with the tool result or an error describing why it failed. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsHandlePendingToolCallResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsHandlePendingToolCallResult.java index 3f7a2acc1e..3eae1158d7 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsHandlePendingToolCallResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsHandlePendingToolCallResult.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.tools.handlePendingToolCall} RPC method. + * Indicates whether the external tool call result was handled successfully. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsInitializeAndValidateParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsInitializeAndValidateParams.java new file mode 100644 index 0000000000..d3ec2aeea6 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsInitializeAndValidateParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionToolsInitializeAndValidateParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsInitializeAndValidateResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsInitializeAndValidateResult.java new file mode 100644 index 0000000000..d25c0e5a86 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsInitializeAndValidateResult.java @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Resolve, build, and validate the runtime tool list for this session. Subagent sessions and consumer flows that need an initialized tool set before `send` invoke this. Default base-class implementation is a no-op for sessions that don't support tool validation. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionToolsInitializeAndValidateResult() { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiApi.java index a987bd627e..3ae8295889 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiApi.java @@ -30,10 +30,12 @@ public final class SessionUiApi { } /** - * Invokes {@code session.ui.elicitation}. + * Prompt message and JSON schema describing the form fields to elicit from the user. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 */ public CompletableFuture elicitation(SessionUiElicitationParams params) { @@ -43,10 +45,12 @@ public CompletableFuture elicitation(SessionUiElicit } /** - * Invokes {@code session.ui.handlePendingElicitation}. + * Pending elicitation request ID and the user's response (accept/decline/cancel + form values). *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 */ public CompletableFuture handlePendingElicitation(SessionUiHandlePendingElicitationParams params) { @@ -55,4 +59,89 @@ public CompletableFuture handlePendingE return caller.invoke("session.ui.handlePendingElicitation", _p, SessionUiHandlePendingElicitationResult.class); } + /** + * Request ID of a pending `user_input.requested` event and the user's response. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture handlePendingUserInput(SessionUiHandlePendingUserInputParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.ui.handlePendingUserInput", _p, SessionUiHandlePendingUserInputResult.class); + } + + /** + * Request ID of a pending `sampling.requested` event and an optional sampling result payload (omit to reject). + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture handlePendingSampling(SessionUiHandlePendingSamplingParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.ui.handlePendingSampling", _p, SessionUiHandlePendingSamplingResult.class); + } + + /** + * Request ID of a pending `auto_mode_switch.requested` event and the user's response. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture handlePendingAutoModeSwitch(SessionUiHandlePendingAutoModeSwitchParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.ui.handlePendingAutoModeSwitch", _p, SessionUiHandlePendingAutoModeSwitchResult.class); + } + + /** + * Request ID of a pending `exit_plan_mode.requested` event and the user's response. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture handlePendingExitPlanMode(SessionUiHandlePendingExitPlanModeParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.ui.handlePendingExitPlanMode", _p, SessionUiHandlePendingExitPlanModeResult.class); + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture registerDirectAutoModeSwitchHandler() { + return caller.invoke("session.ui.registerDirectAutoModeSwitchHandler", java.util.Map.of("sessionId", this.sessionId), SessionUiRegisterDirectAutoModeSwitchHandlerResult.class); + } + + /** + * Opaque handle previously returned by `registerDirectAutoModeSwitchHandler` to release. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture unregisterDirectAutoModeSwitchHandler(SessionUiUnregisterDirectAutoModeSwitchHandlerParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.ui.unregisterDirectAutoModeSwitchHandler", _p, SessionUiUnregisterDirectAutoModeSwitchHandlerResult.class); + } + } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiElicitationParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiElicitationParams.java index d1df4daea0..e92aa36bd6 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiElicitationParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiElicitationParams.java @@ -10,12 +10,10 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import java.util.Map; import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.ui.elicitation} RPC method. + * Prompt message and JSON schema describing the form fields to elicit from the user. * * @since 1.0.0 */ @@ -28,19 +26,6 @@ public record SessionUiElicitationParams( /** Message describing what information is needed from the user */ @JsonProperty("message") String message, /** JSON Schema describing the form fields to present to the user */ - @JsonProperty("requestedSchema") SessionUiElicitationParamsRequestedSchema requestedSchema + @JsonProperty("requestedSchema") UIElicitationSchema requestedSchema ) { - - /** JSON Schema describing the form fields to present to the user */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionUiElicitationParamsRequestedSchema( - /** Schema type indicator (always 'object') */ - @JsonProperty("type") String type, - /** Form field definitions, keyed by field name */ - @JsonProperty("properties") Map properties, - /** List of required field names */ - @JsonProperty("required") List required - ) { - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiElicitationResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiElicitationResult.java index 92ea417781..4be941e08b 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiElicitationResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiElicitationResult.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.ui.elicitation} RPC method. + * The elicitation response (accept with form values, decline, or cancel) * * @since 1.0.0 */ @@ -23,30 +23,8 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record SessionUiElicitationResult( /** The user's response: accept (submitted), decline (rejected), or cancel (dismissed) */ - @JsonProperty("action") SessionUiElicitationResultAction action, + @JsonProperty("action") UIElicitationResponseAction action, /** The form values submitted by the user (present when action is 'accept') */ @JsonProperty("content") Map content ) { - - /** The user's response: accept (submitted), decline (rejected), or cancel (dismissed) */ - public enum SessionUiElicitationResultAction { - /** The {@code accept} variant. */ - ACCEPT("accept"), - /** The {@code decline} variant. */ - DECLINE("decline"), - /** The {@code cancel} variant. */ - CANCEL("cancel"); - - private final String value; - SessionUiElicitationResultAction(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionUiElicitationResultAction fromValue(String value) { - for (SessionUiElicitationResultAction v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionUiElicitationResultAction value: " + value); - } - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingAutoModeSwitchParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingAutoModeSwitchParams.java new file mode 100644 index 0000000000..ab37b178c0 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingAutoModeSwitchParams.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Request ID of a pending `auto_mode_switch.requested` event and the user's response. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionUiHandlePendingAutoModeSwitchParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** The unique request ID from the auto_mode_switch.requested event */ + @JsonProperty("requestId") String requestId, + /** User's choice for auto-mode switching: yes (allow this turn), yes_always (allow + persist as setting), or no (decline). */ + @JsonProperty("response") UIAutoModeSwitchResponse response +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingAutoModeSwitchResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingAutoModeSwitchResult.java new file mode 100644 index 0000000000..0df5ca5715 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingAutoModeSwitchResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the pending UI request was resolved by this call. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionUiHandlePendingAutoModeSwitchResult( + /** True if the request was still pending and was resolved by this call. False if the request ID was unknown, already resolved by another client (e.g. GitHub), expired, or otherwise no longer pending. */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingElicitationParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingElicitationParams.java index e890fffbda..b648fb7a93 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingElicitationParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingElicitationParams.java @@ -10,11 +10,10 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Map; import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.ui.handlePendingElicitation} RPC method. + * Pending elicitation request ID and the user's response (accept/decline/cancel + form values). * * @since 1.0.0 */ @@ -27,39 +26,6 @@ public record SessionUiHandlePendingElicitationParams( /** The unique request ID from the elicitation.requested event */ @JsonProperty("requestId") String requestId, /** The elicitation response (accept with form values, decline, or cancel) */ - @JsonProperty("result") SessionUiHandlePendingElicitationParamsResult result + @JsonProperty("result") UIElicitationResponse result ) { - - /** The elicitation response (accept with form values, decline, or cancel) */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionUiHandlePendingElicitationParamsResult( - /** The user's response: accept (submitted), decline (rejected), or cancel (dismissed) */ - @JsonProperty("action") SessionUiHandlePendingElicitationParamsResultAction action, - /** The form values submitted by the user (present when action is 'accept') */ - @JsonProperty("content") Map content - ) { - - /** The user's response: accept (submitted), decline (rejected), or cancel (dismissed) */ - public enum SessionUiHandlePendingElicitationParamsResultAction { - /** The {@code accept} variant. */ - ACCEPT("accept"), - /** The {@code decline} variant. */ - DECLINE("decline"), - /** The {@code cancel} variant. */ - CANCEL("cancel"); - - private final String value; - SessionUiHandlePendingElicitationParamsResultAction(String value) { this.value = value; } - @com.fasterxml.jackson.annotation.JsonValue - public String getValue() { return value; } - @com.fasterxml.jackson.annotation.JsonCreator - public static SessionUiHandlePendingElicitationParamsResultAction fromValue(String value) { - for (SessionUiHandlePendingElicitationParamsResultAction v : values()) { - if (v.value.equals(value)) return v; - } - throw new IllegalArgumentException("Unknown SessionUiHandlePendingElicitationParamsResultAction value: " + value); - } - } - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingElicitationResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingElicitationResult.java index 549609a87b..bf25a16860 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingElicitationResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingElicitationResult.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code session.ui.handlePendingElicitation} RPC method. + * Indicates whether the elicitation response was accepted; false if it was already resolved by another client. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingExitPlanModeParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingExitPlanModeParams.java new file mode 100644 index 0000000000..a83d7d0389 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingExitPlanModeParams.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Request ID of a pending `exit_plan_mode.requested` event and the user's response. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionUiHandlePendingExitPlanModeParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** The unique request ID from the exit_plan_mode.requested event */ + @JsonProperty("requestId") String requestId, + /** Schema for the `UIExitPlanModeResponse` type. */ + @JsonProperty("response") UIExitPlanModeResponse response +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingExitPlanModeResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingExitPlanModeResult.java new file mode 100644 index 0000000000..c3c183b515 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingExitPlanModeResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the pending UI request was resolved by this call. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionUiHandlePendingExitPlanModeResult( + /** True if the request was still pending and was resolved by this call. False if the request ID was unknown, already resolved by another client (e.g. GitHub), expired, or otherwise no longer pending. */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingSamplingParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingSamplingParams.java new file mode 100644 index 0000000000..6c4304fd5e --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingSamplingParams.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Request ID of a pending `sampling.requested` event and an optional sampling result payload (omit to reject). + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionUiHandlePendingSamplingParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** The unique request ID from the sampling.requested event */ + @JsonProperty("requestId") String requestId, + /** Optional sampling result payload. Omit to reject/cancel the sampling request without providing a result. */ + @JsonProperty("response") UIHandlePendingSamplingResponse response +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingSamplingResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingSamplingResult.java new file mode 100644 index 0000000000..2fa7e09e1c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingSamplingResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the pending UI request was resolved by this call. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionUiHandlePendingSamplingResult( + /** True if the request was still pending and was resolved by this call. False if the request ID was unknown, already resolved by another client (e.g. GitHub), expired, or otherwise no longer pending. */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingUserInputParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingUserInputParams.java new file mode 100644 index 0000000000..3e1624bf26 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingUserInputParams.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Request ID of a pending `user_input.requested` event and the user's response. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionUiHandlePendingUserInputParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** The unique request ID from the user_input.requested event */ + @JsonProperty("requestId") String requestId, + /** Schema for the `UIUserInputResponse` type. */ + @JsonProperty("response") UIUserInputResponse response +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingUserInputResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingUserInputResult.java new file mode 100644 index 0000000000..fb240b3c5c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingUserInputResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the pending UI request was resolved by this call. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionUiHandlePendingUserInputResult( + /** True if the request was still pending and was resolved by this call. False if the request ID was unknown, already resolved by another client (e.g. GitHub), expired, or otherwise no longer pending. */ + @JsonProperty("success") Boolean success +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiRegisterDirectAutoModeSwitchHandlerParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiRegisterDirectAutoModeSwitchHandlerParams.java new file mode 100644 index 0000000000..42c8ba2a5b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiRegisterDirectAutoModeSwitchHandlerParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionUiRegisterDirectAutoModeSwitchHandlerParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiRegisterDirectAutoModeSwitchHandlerResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiRegisterDirectAutoModeSwitchHandlerResult.java new file mode 100644 index 0000000000..5aedb596ba --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiRegisterDirectAutoModeSwitchHandlerResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Register an in-process handler for `auto_mode_switch.requested` events. The caller still attaches the actual listener via the standard event-subscription mechanism; this registration solely tells the server bridge to skip its own dispatch (so a remote client doesn't race the in-process handler for the same requestId). + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionUiRegisterDirectAutoModeSwitchHandlerResult( + /** Opaque handle representing the registration. Pass this same handle to `unregisterDirectAutoModeSwitchHandler` when the in-process handler is no longer active. Multiple registrations are reference-counted; the server bridge will only dispatch auto-mode-switch requests when no handles are active. */ + @JsonProperty("handle") String handle +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiUnregisterDirectAutoModeSwitchHandlerParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiUnregisterDirectAutoModeSwitchHandlerParams.java new file mode 100644 index 0000000000..c22ad46e78 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiUnregisterDirectAutoModeSwitchHandlerParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Opaque handle previously returned by `registerDirectAutoModeSwitchHandler` to release. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionUiUnregisterDirectAutoModeSwitchHandlerParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Handle previously returned by `registerDirectAutoModeSwitchHandler` */ + @JsonProperty("handle") String handle +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiUnregisterDirectAutoModeSwitchHandlerResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiUnregisterDirectAutoModeSwitchHandlerResult.java new file mode 100644 index 0000000000..6d36ad751c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiUnregisterDirectAutoModeSwitchHandlerResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Indicates whether the handle was active and the registration count was decremented. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionUiUnregisterDirectAutoModeSwitchHandlerResult( + /** True if the handle was active and decremented the counter; false if the handle was unknown. */ + @JsonProperty("unregistered") Boolean unregistered +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUsageApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUsageApi.java index 7b34027327..c3db06d6bc 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUsageApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUsageApi.java @@ -28,7 +28,7 @@ public final class SessionUsageApi { } /** - * Invokes {@code session.usage.getMetrics}. + * Identifies the target session. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUsageGetMetricsParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUsageGetMetricsParams.java index 4696c7fc98..72cb52de9a 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUsageGetMetricsParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUsageGetMetricsParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code session.usage.getMetrics} RPC method. + * Identifies the target session. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUsageGetMetricsResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUsageGetMetricsResult.java index 5a98516d4d..21feae576b 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUsageGetMetricsResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUsageGetMetricsResult.java @@ -10,11 +10,12 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; import java.util.Map; import javax.annotation.processing.Generated; /** - * Result for the {@code session.usage.getMetrics} RPC method. + * Accumulated session usage metrics, including premium request cost, token counts, model breakdown, and code-change totals. * * @since 1.0.0 */ @@ -26,14 +27,18 @@ public record SessionUsageGetMetricsResult( @JsonProperty("totalPremiumRequestCost") Double totalPremiumRequestCost, /** Raw count of user-initiated API requests */ @JsonProperty("totalUserRequests") Long totalUserRequests, + /** Session-wide accumulated nano-AI units cost */ + @JsonProperty("totalNanoAiu") Double totalNanoAiu, + /** Session-wide per-token-type accumulated token counts */ + @JsonProperty("tokenDetails") Map tokenDetails, /** Total time spent in model API calls (milliseconds) */ - @JsonProperty("totalApiDurationMs") Double totalApiDurationMs, - /** Session start timestamp (epoch milliseconds) */ - @JsonProperty("sessionStartTime") Long sessionStartTime, + @JsonProperty("totalApiDurationMs") Long totalApiDurationMs, + /** ISO 8601 timestamp when the session started */ + @JsonProperty("sessionStartTime") OffsetDateTime sessionStartTime, /** Aggregated code change metrics */ - @JsonProperty("codeChanges") SessionUsageGetMetricsResultCodeChanges codeChanges, + @JsonProperty("codeChanges") UsageMetricsCodeChanges codeChanges, /** Per-model token and request metrics, keyed by model identifier */ - @JsonProperty("modelMetrics") Map modelMetrics, + @JsonProperty("modelMetrics") Map modelMetrics, /** Currently active model identifier */ @JsonProperty("currentModel") String currentModel, /** Input tokens from the most recent main-agent API call */ @@ -41,55 +46,4 @@ public record SessionUsageGetMetricsResult( /** Output tokens from the most recent main-agent API call */ @JsonProperty("lastCallOutputTokens") Long lastCallOutputTokens ) { - - /** Aggregated code change metrics */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionUsageGetMetricsResultCodeChanges( - /** Total lines of code added */ - @JsonProperty("linesAdded") Long linesAdded, - /** Total lines of code removed */ - @JsonProperty("linesRemoved") Long linesRemoved, - /** Number of distinct files modified */ - @JsonProperty("filesModifiedCount") Long filesModifiedCount - ) { - } - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionUsageGetMetricsResultModelMetricsValue( - /** Request count and cost metrics for this model */ - @JsonProperty("requests") SessionUsageGetMetricsResultModelMetricsValueRequests requests, - /** Token usage metrics for this model */ - @JsonProperty("usage") SessionUsageGetMetricsResultModelMetricsValueUsage usage - ) { - - /** Request count and cost metrics for this model */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionUsageGetMetricsResultModelMetricsValueRequests( - /** Number of API requests made with this model */ - @JsonProperty("count") Long count, - /** User-initiated premium request cost (with multiplier applied) */ - @JsonProperty("cost") Double cost - ) { - } - - /** Token usage metrics for this model */ - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record SessionUsageGetMetricsResultModelMetricsValueUsage( - /** Total input tokens consumed */ - @JsonProperty("inputTokens") Long inputTokens, - /** Total output tokens produced */ - @JsonProperty("outputTokens") Long outputTokens, - /** Total tokens read from prompt cache */ - @JsonProperty("cacheReadTokens") Long cacheReadTokens, - /** Total tokens written to prompt cache */ - @JsonProperty("cacheWriteTokens") Long cacheWriteTokens, - /** Total output tokens used for reasoning */ - @JsonProperty("reasoningTokens") Long reasoningTokens - ) { - } - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkingDirectoryContext.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkingDirectoryContext.java new file mode 100644 index 0000000000..4c17aa5ea7 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkingDirectoryContext.java @@ -0,0 +1,41 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Updated working directory and git context. Emitted as the new payload of `session.context_changed`. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionWorkingDirectoryContext( + /** Current working directory path */ + @JsonProperty("cwd") String cwd, + /** Root directory of the git repository, resolved via git rev-parse */ + @JsonProperty("gitRoot") String gitRoot, + /** Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps) */ + @JsonProperty("repository") String repository, + /** Hosting platform type of the repository */ + @JsonProperty("hostType") SessionWorkingDirectoryContextHostType hostType, + /** Raw host string from the git remote URL (e.g. "github.com", "dev.azure.com") */ + @JsonProperty("repositoryHost") String repositoryHost, + /** Current git branch name */ + @JsonProperty("branch") String branch, + /** Head commit of the current git branch */ + @JsonProperty("headCommit") String headCommit, + /** Merge-base commit SHA (fork point from the remote default branch) */ + @JsonProperty("baseCommit") String baseCommit +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkingDirectoryContextHostType.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkingDirectoryContextHostType.java new file mode 100644 index 0000000000..0c5a0cffe7 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkingDirectoryContextHostType.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Hosting platform type of the repository + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SessionWorkingDirectoryContextHostType { + /** The {@code github} variant. */ + GITHUB("github"), + /** The {@code ado} variant. */ + ADO("ado"); + + private final String value; + SessionWorkingDirectoryContextHostType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SessionWorkingDirectoryContextHostType fromValue(String value) { + for (SessionWorkingDirectoryContextHostType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SessionWorkingDirectoryContextHostType value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesApi.java new file mode 100644 index 0000000000..de51e4a907 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesApi.java @@ -0,0 +1,122 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code workspaces} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionWorkspacesApi { + + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionWorkspacesApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture getWorkspace() { + return caller.invoke("session.workspaces.getWorkspace", java.util.Map.of("sessionId", this.sessionId), SessionWorkspacesGetWorkspaceResult.class); + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture listFiles() { + return caller.invoke("session.workspaces.listFiles", java.util.Map.of("sessionId", this.sessionId), SessionWorkspacesListFilesResult.class); + } + + /** + * Relative path of the workspace file to read. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture readFile(SessionWorkspacesReadFileParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.workspaces.readFile", _p, SessionWorkspacesReadFileResult.class); + } + + /** + * Relative path and UTF-8 content for the workspace file to create or overwrite. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture createFile(SessionWorkspacesCreateFileParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.workspaces.createFile", _p, Void.class); + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture listCheckpoints() { + return caller.invoke("session.workspaces.listCheckpoints", java.util.Map.of("sessionId", this.sessionId), SessionWorkspacesListCheckpointsResult.class); + } + + /** + * Checkpoint number to read. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture readCheckpoint(SessionWorkspacesReadCheckpointParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.workspaces.readCheckpoint", _p, SessionWorkspacesReadCheckpointResult.class); + } + + /** + * Pasted content to save as a UTF-8 file in the session workspace. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture saveLargePaste(SessionWorkspacesSaveLargePasteParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.workspaces.saveLargePaste", _p, SessionWorkspacesSaveLargePasteResult.class); + } + +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesCreateFileParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesCreateFileParams.java new file mode 100644 index 0000000000..b57681a172 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesCreateFileParams.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Relative path and UTF-8 content for the workspace file to create or overwrite. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionWorkspacesCreateFileParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Relative path within the workspace files directory */ + @JsonProperty("path") String path, + /** File content to write as a UTF-8 string */ + @JsonProperty("content") String content +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesGetWorkspaceParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesGetWorkspaceParams.java new file mode 100644 index 0000000000..9f9628bb6f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesGetWorkspaceParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionWorkspacesGetWorkspaceParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesGetWorkspaceResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesGetWorkspaceResult.java new file mode 100644 index 0000000000..ded4778b47 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesGetWorkspaceResult.java @@ -0,0 +1,53 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import javax.annotation.processing.Generated; + +/** + * Current workspace metadata for the session, including its absolute filesystem path when available. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionWorkspacesGetWorkspaceResult( + /** Current workspace metadata, or null if not available */ + @JsonProperty("workspace") SessionWorkspacesGetWorkspaceResultWorkspace workspace, + /** Absolute filesystem path to the workspace directory. Omitted when the session has no workspace (e.g. remote sessions). */ + @JsonProperty("path") String path +) { + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record SessionWorkspacesGetWorkspaceResultWorkspace( + @JsonProperty("id") String id, + @JsonProperty("cwd") String cwd, + @JsonProperty("git_root") String gitRoot, + @JsonProperty("repository") String repository, + /** Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. */ + @JsonProperty("host_type") WorkspacesWorkspaceDetailsHostType hostType, + @JsonProperty("branch") String branch, + @JsonProperty("name") String name, + @JsonProperty("user_named") Boolean userNamed, + @JsonProperty("summary_count") Long summaryCount, + @JsonProperty("created_at") OffsetDateTime createdAt, + @JsonProperty("updated_at") OffsetDateTime updatedAt, + @JsonProperty("remote_steerable") Boolean remoteSteerable, + @JsonProperty("mc_task_id") String mcTaskId, + @JsonProperty("mc_session_id") String mcSessionId, + @JsonProperty("mc_last_event_id") String mcLastEventId, + @JsonProperty("chronicle_sync_dismissed") Boolean chronicleSyncDismissed + ) { + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesListCheckpointsParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesListCheckpointsParams.java new file mode 100644 index 0000000000..3f3c1ac1e1 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesListCheckpointsParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionWorkspacesListCheckpointsParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesListCheckpointsResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesListCheckpointsResult.java new file mode 100644 index 0000000000..c25be02d4c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesListCheckpointsResult.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Workspace checkpoints in chronological order; empty when the workspace is not enabled. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionWorkspacesListCheckpointsResult( + /** Workspace checkpoints in chronological order. Empty when workspace is not enabled. */ + @JsonProperty("checkpoints") List checkpoints +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesListFilesParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesListFilesParams.java new file mode 100644 index 0000000000..68b976a60e --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesListFilesParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionWorkspacesListFilesParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesListFilesResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesListFilesResult.java new file mode 100644 index 0000000000..06908175b3 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesListFilesResult.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Relative paths of files stored in the session workspace files directory. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionWorkspacesListFilesResult( + /** Relative file paths in the workspace files directory */ + @JsonProperty("files") List files +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesReadCheckpointParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesReadCheckpointParams.java new file mode 100644 index 0000000000..851a01bd45 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesReadCheckpointParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Checkpoint number to read. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionWorkspacesReadCheckpointParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Checkpoint number to read */ + @JsonProperty("number") Long number +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesReadCheckpointResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesReadCheckpointResult.java new file mode 100644 index 0000000000..4f9e18709f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesReadCheckpointResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionWorkspacesReadCheckpointResult( + /** Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing */ + @JsonProperty("content") String content +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesReadFileParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesReadFileParams.java new file mode 100644 index 0000000000..e322ee06da --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesReadFileParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Relative path of the workspace file to read. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionWorkspacesReadFileParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Relative path within the workspace files directory */ + @JsonProperty("path") String path +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesReadFileResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesReadFileResult.java new file mode 100644 index 0000000000..7a0717dbeb --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesReadFileResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Contents of the requested workspace file as a UTF-8 string. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionWorkspacesReadFileResult( + /** File content as a UTF-8 string */ + @JsonProperty("content") String content +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesSaveLargePasteParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesSaveLargePasteParams.java new file mode 100644 index 0000000000..466f5b7bae --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesSaveLargePasteParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Pasted content to save as a UTF-8 file in the session workspace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionWorkspacesSaveLargePasteParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Pasted content to save as a UTF-8 file */ + @JsonProperty("content") String content +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesSaveLargePasteResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesSaveLargePasteResult.java new file mode 100644 index 0000000000..84e5719d70 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesSaveLargePasteResult.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Descriptor for the saved paste file, or null when the workspace is unavailable. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionWorkspacesSaveLargePasteResult( + /** Saved-paste descriptor, or null when the workspace is unavailable (e.g. CCA runtime, non-infinite sessions, remote sessions) */ + @JsonProperty("saved") SessionWorkspacesSaveLargePasteResultSaved saved +) { + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record SessionWorkspacesSaveLargePasteResultSaved( + /** Absolute filesystem path to the saved paste file */ + @JsonProperty("filePath") String filePath, + /** Filename within the workspace files directory */ + @JsonProperty("filename") String filename, + /** Size of the saved file in bytes */ + @JsonProperty("sizeBytes") Long sizeBytes + ) { + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsBulkDeleteParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsBulkDeleteParams.java new file mode 100644 index 0000000000..986103825b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsBulkDeleteParams.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Session IDs to close, deactivate, and delete from disk. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsBulkDeleteParams( + /** Session IDs to close, deactivate, and delete from disk */ + @JsonProperty("sessionIds") List sessionIds +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsBulkDeleteResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsBulkDeleteResult.java new file mode 100644 index 0000000000..893dd8210c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsBulkDeleteResult.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import javax.annotation.processing.Generated; + +/** + * Map of sessionId -> bytes freed by removing the session's workspace directory. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsBulkDeleteResult( + /** Map of sessionId -> bytes freed by removing the session's workspace directory. Sessions whose deletion failed are omitted from this map (failures are logged on the server but not surfaced per-id; check the map for absent IDs to detect them). */ + @JsonProperty("freedBytes") Map freedBytes +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsCheckInUseParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsCheckInUseParams.java new file mode 100644 index 0000000000..be8b2e3857 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsCheckInUseParams.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Session IDs to test for live in-use locks. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsCheckInUseParams( + /** Session IDs to test for live in-use locks */ + @JsonProperty("sessionIds") List sessionIds +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsCheckInUseResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsCheckInUseResult.java new file mode 100644 index 0000000000..c22e818cc8 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsCheckInUseResult.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Session IDs from the input set that are currently in use by another process. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsCheckInUseResult( + /** Session IDs from the input set that are currently held by another running process via an alive lock file */ + @JsonProperty("inUse") List inUse +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsCloseParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsCloseParams.java new file mode 100644 index 0000000000..c29d385be6 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsCloseParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Session ID to close. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsCloseParams( + /** Session ID to close */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsCloseResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsCloseResult.java new file mode 100644 index 0000000000..fc8c5ee66a --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsCloseResult.java @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Closes a session: emits shutdown, flushes pending events to disk, releases the in-use lock, disposes the active session. Idempotent: succeeds even if the session is not currently active. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsCloseResult() { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsConnectParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsConnectParams.java new file mode 100644 index 0000000000..a8a9e76f65 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsConnectParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Remote session connection parameters. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsConnectParams( + /** Session ID to connect to. */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsConnectResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsConnectResult.java new file mode 100644 index 0000000000..b67783328b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsConnectResult.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Remote session connection result. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsConnectResult( + /** SDK session ID for the connected remote session. */ + @JsonProperty("sessionId") String sessionId, + /** Metadata for a connected remote session. */ + @JsonProperty("metadata") ConnectedRemoteSessionMetadata metadata +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsEnrichMetadataParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsEnrichMetadataParams.java new file mode 100644 index 0000000000..ef3330a97b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsEnrichMetadataParams.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Session metadata records to enrich with summary and context information. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsEnrichMetadataParams( + /** Session metadata records to enrich. Records that already have summary and context are returned unchanged. */ + @JsonProperty("sessions") List sessions +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsEnrichMetadataResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsEnrichMetadataResult.java new file mode 100644 index 0000000000..fee15a2ed9 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsEnrichMetadataResult.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * The same metadata records, with summary and context fields backfilled where available. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsEnrichMetadataResult( + /** Same records, with summary and context backfilled */ + @JsonProperty("sessions") List sessions +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsFindByPrefixParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsFindByPrefixParams.java new file mode 100644 index 0000000000..628d93cb8e --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsFindByPrefixParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * UUID prefix to resolve to a unique session ID. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsFindByPrefixParams( + /** UUID prefix (>=7 hex chars, <36 chars). Returns the unique session ID, or undefined when there is no match or the prefix matches multiple sessions. */ + @JsonProperty("prefix") String prefix +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsFindByPrefixResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsFindByPrefixResult.java new file mode 100644 index 0000000000..94b3a106c3 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsFindByPrefixResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Session ID matching the prefix, omitted when no unique match exists. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsFindByPrefixResult( + /** Omitted when no unique session matches the prefix (no match or ambiguous) */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsFindByTaskIdParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsFindByTaskIdParams.java new file mode 100644 index 0000000000..23e1aaaedb --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsFindByTaskIdParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * GitHub task ID to look up. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsFindByTaskIdParams( + /** GitHub task ID to look up */ + @JsonProperty("taskId") String taskId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsFindByTaskIdResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsFindByTaskIdResult.java new file mode 100644 index 0000000000..eb5b9bfd4f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsFindByTaskIdResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * ID of the local session bound to the given GitHub task, or omitted when none. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsFindByTaskIdResult( + /** Omitted when no local session is bound to that GitHub task */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsForkParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsForkParams.java index 06ea46c932..19858ac970 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsForkParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsForkParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code sessions.fork} RPC method. + * Source session identifier to fork from, optional event-ID boundary, and optional friendly name for the new session. * * @since 1.0.0 */ @@ -24,6 +24,8 @@ public record SessionsForkParams( /** Source session ID to fork from */ @JsonProperty("sessionId") String sessionId, /** Optional event ID boundary. When provided, the fork includes only events before this ID (exclusive). When omitted, all events are included. */ - @JsonProperty("toEventId") String toEventId + @JsonProperty("toEventId") String toEventId, + /** Optional friendly name to assign to the forked session. */ + @JsonProperty("name") String name ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsForkResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsForkResult.java index 911574f568..29bcb8c92f 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsForkResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsForkResult.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Result for the {@code sessions.fork} RPC method. + * Identifier and optional friendly name assigned to the newly forked session. * * @since 1.0.0 */ @@ -22,6 +22,8 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record SessionsForkResult( /** The new forked session's ID */ - @JsonProperty("sessionId") String sessionId + @JsonProperty("sessionId") String sessionId, + /** Friendly name assigned to the forked session, if any. */ + @JsonProperty("name") String name ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetEventFilePathParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetEventFilePathParams.java new file mode 100644 index 0000000000..a23a5434c1 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetEventFilePathParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Session ID whose event-log file path to compute. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsGetEventFilePathParams( + /** Session ID whose event-log file path to compute */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetEventFilePathResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetEventFilePathResult.java new file mode 100644 index 0000000000..261a0d4526 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetEventFilePathResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Absolute path to the session's events.jsonl file on disk. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsGetEventFilePathResult( + /** Absolute path to the session's events.jsonl file */ + @JsonProperty("filePath") String filePath +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetLastForContextParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetLastForContextParams.java new file mode 100644 index 0000000000..0b06f161f8 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetLastForContextParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Optional working-directory context used to score session relevance. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsGetLastForContextParams( + /** Optional working-directory context used to score session relevance. When omitted the most-recently-modified session wins. */ + @JsonProperty("context") SessionContext context +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetLastForContextResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetLastForContextResult.java new file mode 100644 index 0000000000..c31e8d781e --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetLastForContextResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Most-relevant session ID for the supplied context, or omitted when no sessions exist. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsGetLastForContextResult( + /** Most-relevant session ID for the supplied context, or omitted when no sessions exist */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetPersistedRemoteSteerableParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetPersistedRemoteSteerableParams.java new file mode 100644 index 0000000000..1fd9e476f5 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetPersistedRemoteSteerableParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Session ID to look up the persisted remote-steerable flag for. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsGetPersistedRemoteSteerableParams( + /** Session ID to look up the persisted remote-steerable flag for */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetPersistedRemoteSteerableResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetPersistedRemoteSteerableResult.java new file mode 100644 index 0000000000..c4de7b09b0 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetPersistedRemoteSteerableResult.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * The session's persisted remote-steerable flag, or omitted when no value has been persisted. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsGetPersistedRemoteSteerableResult( + /** The session's persisted remote-steerable flag if recorded; omitted when no value has been persisted */ + @JsonProperty("remoteSteerable") Boolean remoteSteerable +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetSizesResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetSizesResult.java new file mode 100644 index 0000000000..98ec269e49 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsGetSizesResult.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import javax.annotation.processing.Generated; + +/** + * Map of sessionId -> on-disk size in bytes for each session's workspace directory. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsGetSizesResult( + /** Map of sessionId -> on-disk size in bytes for the session's workspace directory */ + @JsonProperty("sizes") Map sizes +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsListResult.java new file mode 100644 index 0000000000..99060bb18b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsListResult.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Persisted sessions matching the filter, ordered most-recently-modified first. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsListResult( + /** Sessions ordered most-recently-modified first */ + @JsonProperty("sessions") List sessions +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsLoadDeferredRepoHooksParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsLoadDeferredRepoHooksParams.java new file mode 100644 index 0000000000..67590914ec --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsLoadDeferredRepoHooksParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Active session ID whose deferred repo-level hooks should be loaded. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsLoadDeferredRepoHooksParams( + /** Active session ID whose deferred repo-level hooks should be loaded */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsLoadDeferredRepoHooksResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsLoadDeferredRepoHooksResult.java new file mode 100644 index 0000000000..6f2299a491 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsLoadDeferredRepoHooksResult.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Queued repo-level startup prompts and the total hook command count after loading. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsLoadDeferredRepoHooksResult( + /** Repo-level startup prompts queued from repo hook configs. Empty on resume, when no repo configs were pending, or when disableAllHooks is set. */ + @JsonProperty("startupPrompts") List startupPrompts, + /** Total hook command count (user + plugin + repo) loaded for the session by this call. Captured atomically with startupPrompts so callers don't need to read a separate counter. */ + @JsonProperty("hookCount") Long hookCount +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsPruneOldParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsPruneOldParams.java new file mode 100644 index 0000000000..e36c033e35 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsPruneOldParams.java @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Age threshold and optional flags controlling which old sessions are pruned (or simulated when dryRun is true). + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsPruneOldParams( + /** Delete sessions whose modifiedTime is at least this many days old */ + @JsonProperty("olderThanDays") Long olderThanDays, + /** When true, only report what would be deleted without performing any deletion */ + @JsonProperty("dryRun") Boolean dryRun, + /** When true, named sessions (set via /rename) are also eligible for pruning */ + @JsonProperty("includeNamed") Boolean includeNamed, + /** Session IDs that should never be considered for pruning */ + @JsonProperty("excludeSessionIds") List excludeSessionIds +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsPruneOldResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsPruneOldResult.java new file mode 100644 index 0000000000..6bcf5cecd8 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsPruneOldResult.java @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Outcome of the prune operation: deleted IDs, dry-run candidates, skipped IDs, total bytes freed, and the dry-run flag. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsPruneOldResult( + /** Session IDs that were deleted (always empty in dry-run mode) */ + @JsonProperty("deleted") List deleted, + /** Session IDs that would be deleted in dry-run mode (always empty otherwise) */ + @JsonProperty("candidates") List candidates, + /** Session IDs that were skipped (e.g., named sessions) */ + @JsonProperty("skipped") List skipped, + /** Total bytes freed (actual when not dry-run, projected when dry-run) */ + @JsonProperty("freedBytes") Long freedBytes, + /** True when no deletions were actually performed */ + @JsonProperty("dryRun") Boolean dryRun +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsReleaseLockParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsReleaseLockParams.java new file mode 100644 index 0000000000..81c9682515 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsReleaseLockParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Session ID whose in-use lock should be released. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsReleaseLockParams( + /** Session ID whose in-use lock should be released */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsReleaseLockResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsReleaseLockResult.java new file mode 100644 index 0000000000..e3c660dc66 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsReleaseLockResult.java @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Release the in-use lock held by this process for the given session. No-op when this process does not currently hold a lock for the session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsReleaseLockResult() { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsReloadPluginHooksParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsReloadPluginHooksParams.java new file mode 100644 index 0000000000..a9537382a6 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsReloadPluginHooksParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Active session ID and an optional flag for deferring repo-level hooks until folder trust. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsReloadPluginHooksParams( + /** Active session ID to reload hooks for */ + @JsonProperty("sessionId") String sessionId, + /** When true, skip repo-level hooks. Use before folder trust is confirmed; loadDeferredRepoHooks loads them post-trust. */ + @JsonProperty("deferRepoHooks") Boolean deferRepoHooks +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsReloadPluginHooksResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsReloadPluginHooksResult.java new file mode 100644 index 0000000000..0920dd86e2 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsReloadPluginHooksResult.java @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Reload all hooks (user, plugin, optionally repo) and apply them to the active session. Call after installing or removing plugins so their hooks take effect immediately. No-op when no active session matches the given sessionId. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsReloadPluginHooksResult() { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsSaveParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsSaveParams.java new file mode 100644 index 0000000000..ae3b42b029 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsSaveParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Session ID whose pending events should be flushed to disk. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsSaveParams( + /** Session ID whose pending events should be flushed to disk */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsSaveResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsSaveResult.java new file mode 100644 index 0000000000..74ae1a4669 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsSaveResult.java @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Flush a session's pending events to disk. No-op when no writer exists for the session (e.g., already closed). + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsSaveResult() { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsSetAdditionalPluginsParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsSetAdditionalPluginsParams.java new file mode 100644 index 0000000000..34ca74de9d --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsSetAdditionalPluginsParams.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Manager-wide additional plugins to register; replaces any previously-configured set. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsSetAdditionalPluginsParams( + /** Manager-wide additional plugins to register. Replaces any previously-configured set. Pass an empty array to clear. */ + @JsonProperty("plugins") List plugins +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsSetAdditionalPluginsResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsSetAdditionalPluginsResult.java new file mode 100644 index 0000000000..e6f2a5b4cf --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsSetAdditionalPluginsResult.java @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Replace the manager-wide additional plugins. New session creations and subsequent hook reloads see the new set; already-running sessions keep their existing hook installation until the next reload. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionsSetAdditionalPluginsResult() { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ShellKillSignal.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ShellKillSignal.java new file mode 100644 index 0000000000..92700c5c0f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ShellKillSignal.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Signal to send (default: SIGTERM) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ShellKillSignal { + /** The {@code SIGTERM} variant. */ + SIGTERM("SIGTERM"), + /** The {@code SIGKILL} variant. */ + SIGKILL("SIGKILL"), + /** The {@code SIGINT} variant. */ + SIGINT("SIGINT"); + + private final String value; + ShellKillSignal(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ShellKillSignal fromValue(String value) { + for (ShellKillSignal v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ShellKillSignal value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ShutdownType.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ShutdownType.java new file mode 100644 index 0000000000..5dac44cfbc --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ShutdownType.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Why the session is being shut down. Defaults to "routine" when omitted. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ShutdownType { + /** The {@code routine} variant. */ + ROUTINE("routine"), + /** The {@code error} variant. */ + ERROR("error"); + + private final String value; + ShutdownType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ShutdownType fromValue(String value) { + for (ShutdownType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ShutdownType value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/Skill.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/Skill.java new file mode 100644 index 0000000000..92f94d6615 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/Skill.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `Skill` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record Skill( + /** Unique identifier for the skill */ + @JsonProperty("name") String name, + /** Description of what the skill does */ + @JsonProperty("description") String description, + /** Source location type (e.g., project, personal-copilot, plugin, builtin) */ + @JsonProperty("source") SkillSource source, + /** Whether the skill can be invoked by the user as a slash command */ + @JsonProperty("userInvocable") Boolean userInvocable, + /** Whether the skill is currently enabled */ + @JsonProperty("enabled") Boolean enabled, + /** Absolute path to the skill file */ + @JsonProperty("path") String path, + /** Name of the plugin that provides the skill, when source is 'plugin' */ + @JsonProperty("pluginName") String pluginName +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SkillSource.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SkillSource.java new file mode 100644 index 0000000000..db5f405a4a --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SkillSource.java @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Source location type (e.g., project, personal-copilot, plugin, builtin) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SkillSource { + /** The {@code project} variant. */ + PROJECT("project"), + /** The {@code inherited} variant. */ + INHERITED("inherited"), + /** The {@code personal-copilot} variant. */ + PERSONAL_COPILOT("personal-copilot"), + /** The {@code personal-agents} variant. */ + PERSONAL_AGENTS("personal-agents"), + /** The {@code plugin} variant. */ + PLUGIN("plugin"), + /** The {@code custom} variant. */ + CUSTOM("custom"), + /** The {@code builtin} variant. */ + BUILTIN("builtin"); + + private final String value; + SkillSource(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SkillSource fromValue(String value) { + for (SkillSource v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SkillSource value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SkillsConfigSetDisabledSkillsParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SkillsConfigSetDisabledSkillsParams.java new file mode 100644 index 0000000000..f704129dd5 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SkillsConfigSetDisabledSkillsParams.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Skill names to mark as disabled in global configuration, replacing any previous list. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SkillsConfigSetDisabledSkillsParams( + /** List of skill names to disable */ + @JsonProperty("disabledSkills") List disabledSkills +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SkillsDiscoverParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SkillsDiscoverParams.java new file mode 100644 index 0000000000..be1d1921fe --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SkillsDiscoverParams.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Optional project paths and additional skill directories to include in discovery. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SkillsDiscoverParams( + /** Optional list of project directory paths to scan for project-scoped skills */ + @JsonProperty("projectPaths") List projectPaths, + /** Optional list of additional skill directory paths to include */ + @JsonProperty("skillDirectories") List skillDirectories +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SkillsDiscoverResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SkillsDiscoverResult.java new file mode 100644 index 0000000000..c80a738376 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SkillsDiscoverResult.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Skills discovered across global and project sources. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SkillsDiscoverResult( + /** All discovered skills across all sources */ + @JsonProperty("skills") List skills +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SkillsInvokedSkill.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SkillsInvokedSkill.java new file mode 100644 index 0000000000..7dde089424 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SkillsInvokedSkill.java @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Schema for the `SkillsInvokedSkill` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SkillsInvokedSkill( + /** Unique identifier for the skill */ + @JsonProperty("name") String name, + /** Path to the SKILL.md file */ + @JsonProperty("path") String path, + /** Full content of the skill file */ + @JsonProperty("content") String content, + /** Tools that should be auto-approved when this skill is active, captured at invocation time */ + @JsonProperty("allowedTools") List allowedTools, + /** Turn number when the skill was invoked */ + @JsonProperty("invokedAtTurn") Long invokedAtTurn +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInfo.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInfo.java new file mode 100644 index 0000000000..686018c517 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInfo.java @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Schema for the `SlashCommandInfo` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SlashCommandInfo( + /** Canonical command name without a leading slash */ + @JsonProperty("name") String name, + /** Canonical aliases without leading slashes */ + @JsonProperty("aliases") List aliases, + /** Human-readable command description */ + @JsonProperty("description") String description, + /** Coarse command category for grouping and behavior: runtime built-in, skill-backed command, or SDK/client-owned command */ + @JsonProperty("kind") SlashCommandKind kind, + /** Optional unstructured input hint */ + @JsonProperty("input") SlashCommandInput input, + /** Whether the command may run while an agent turn is active */ + @JsonProperty("allowDuringAgentExecution") Boolean allowDuringAgentExecution, + /** Whether the command is experimental */ + @JsonProperty("experimental") Boolean experimental +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInput.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInput.java new file mode 100644 index 0000000000..186dec5a81 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInput.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Optional unstructured input hint + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SlashCommandInput( + /** Hint to display when command input has not been provided */ + @JsonProperty("hint") String hint, + /** When true, the command requires non-empty input; clients should render the input hint as required */ + @JsonProperty("required") Boolean required, + /** Optional completion hint for the input (e.g. 'directory' for filesystem path completion) */ + @JsonProperty("completion") SlashCommandInputCompletion completion, + /** When true, clients should pass the full text after the command name as a single argument rather than splitting on whitespace */ + @JsonProperty("preserveMultilineInput") Boolean preserveMultilineInput +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInputCompletion.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInputCompletion.java new file mode 100644 index 0000000000..c192fa9c0f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInputCompletion.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Optional completion hint for the input (e.g. 'directory' for filesystem path completion) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SlashCommandInputCompletion { + /** The {@code directory} variant. */ + DIRECTORY("directory"); + + private final String value; + SlashCommandInputCompletion(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SlashCommandInputCompletion fromValue(String value) { + for (SlashCommandInputCompletion v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SlashCommandInputCompletion value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandKind.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandKind.java new file mode 100644 index 0000000000..1f08c4efcd --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandKind.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Coarse command category for grouping and behavior: runtime built-in, skill-backed command, or SDK/client-owned command + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SlashCommandKind { + /** The {@code builtin} variant. */ + BUILTIN("builtin"), + /** The {@code skill} variant. */ + SKILL("skill"), + /** The {@code client} variant. */ + CLIENT("client"); + + private final String value; + SlashCommandKind(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SlashCommandKind fromValue(String value) { + for (SlashCommandKind v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SlashCommandKind value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/Tool.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/Tool.java new file mode 100644 index 0000000000..5954c2c030 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/Tool.java @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import javax.annotation.processing.Generated; + +/** + * Schema for the `Tool` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record Tool( + /** Tool identifier (e.g., "bash", "grep", "str_replace_editor") */ + @JsonProperty("name") String name, + /** Optional namespaced name for declarative filtering (e.g., "playwright/navigate" for MCP tools) */ + @JsonProperty("namespacedName") String namespacedName, + /** Description of what the tool does */ + @JsonProperty("description") String description, + /** JSON Schema for the tool's input parameters */ + @JsonProperty("parameters") Map parameters, + /** Optional instructions for how to use this tool effectively */ + @JsonProperty("instructions") String instructions +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ToolsListParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ToolsListParams.java index 2c5aa5b09e..3072c46eb9 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/ToolsListParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ToolsListParams.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Request parameters for the {@code tools.list} RPC method. + * Optional model identifier whose tool overrides should be applied to the listing. * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ToolsListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ToolsListResult.java index d56ef7e7cb..30e3b0962e 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/ToolsListResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ToolsListResult.java @@ -11,11 +11,10 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -import java.util.Map; import javax.annotation.processing.Generated; /** - * Result for the {@code tools.list} RPC method. + * Built-in tools available for the requested model, with their parameters and instructions. * * @since 1.0.0 */ @@ -24,22 +23,6 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record ToolsListResult( /** List of available built-in tools with metadata */ - @JsonProperty("tools") List tools + @JsonProperty("tools") List tools ) { - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_NULL) - public record ToolsListResultToolsItem( - /** Tool identifier (e.g., "bash", "grep", "str_replace_editor") */ - @JsonProperty("name") String name, - /** Optional namespaced name for declarative filtering (e.g., "playwright/navigate" for MCP tools) */ - @JsonProperty("namespacedName") String namespacedName, - /** Description of what the tool does */ - @JsonProperty("description") String description, - /** JSON Schema for the tool's input parameters */ - @JsonProperty("parameters") Map parameters, - /** Optional instructions for how to use this tool effectively */ - @JsonProperty("instructions") String instructions - ) { - } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/UIAutoModeSwitchResponse.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/UIAutoModeSwitchResponse.java new file mode 100644 index 0000000000..170c378a44 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/UIAutoModeSwitchResponse.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * User's choice for auto-mode switching: yes (allow this turn), yes_always (allow + persist as setting), or no (decline). + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum UIAutoModeSwitchResponse { + /** The {@code yes} variant. */ + YES("yes"), + /** The {@code yes_always} variant. */ + YES_ALWAYS("yes_always"), + /** The {@code no} variant. */ + NO("no"); + + private final String value; + UIAutoModeSwitchResponse(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static UIAutoModeSwitchResponse fromValue(String value) { + for (UIAutoModeSwitchResponse v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown UIAutoModeSwitchResponse value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/UIElicitationResponse.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/UIElicitationResponse.java new file mode 100644 index 0000000000..058a68c0df --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/UIElicitationResponse.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import javax.annotation.processing.Generated; + +/** + * The elicitation response (accept with form values, decline, or cancel) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record UIElicitationResponse( + /** The user's response: accept (submitted), decline (rejected), or cancel (dismissed) */ + @JsonProperty("action") UIElicitationResponseAction action, + /** The form values submitted by the user (present when action is 'accept') */ + @JsonProperty("content") Map content +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/UIElicitationResponseAction.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/UIElicitationResponseAction.java new file mode 100644 index 0000000000..e4811ef956 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/UIElicitationResponseAction.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * The user's response: accept (submitted), decline (rejected), or cancel (dismissed) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum UIElicitationResponseAction { + /** The {@code accept} variant. */ + ACCEPT("accept"), + /** The {@code decline} variant. */ + DECLINE("decline"), + /** The {@code cancel} variant. */ + CANCEL("cancel"); + + private final String value; + UIElicitationResponseAction(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static UIElicitationResponseAction fromValue(String value) { + for (UIElicitationResponseAction v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown UIElicitationResponseAction value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/UIElicitationSchema.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/UIElicitationSchema.java new file mode 100644 index 0000000000..171f5c6883 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/UIElicitationSchema.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; +import javax.annotation.processing.Generated; + +/** + * JSON Schema describing the form fields to present to the user + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record UIElicitationSchema( + /** Schema type indicator (always 'object') */ + @JsonProperty("type") String type, + /** Form field definitions, keyed by field name */ + @JsonProperty("properties") Map properties, + /** List of required field names */ + @JsonProperty("required") List required +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/UIExitPlanModeAction.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/UIExitPlanModeAction.java new file mode 100644 index 0000000000..7ea38d6fdb --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/UIExitPlanModeAction.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * The action the user selected. Defaults to 'autopilot' when autoApproveEdits is true, otherwise 'interactive'. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum UIExitPlanModeAction { + /** The {@code exit_only} variant. */ + EXIT_ONLY("exit_only"), + /** The {@code interactive} variant. */ + INTERACTIVE("interactive"), + /** The {@code autopilot} variant. */ + AUTOPILOT("autopilot"), + /** The {@code autopilot_fleet} variant. */ + AUTOPILOT_FLEET("autopilot_fleet"); + + private final String value; + UIExitPlanModeAction(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static UIExitPlanModeAction fromValue(String value) { + for (UIExitPlanModeAction v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown UIExitPlanModeAction value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/UIExitPlanModeResponse.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/UIExitPlanModeResponse.java new file mode 100644 index 0000000000..55cd430a9f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/UIExitPlanModeResponse.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `UIExitPlanModeResponse` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record UIExitPlanModeResponse( + /** Whether the plan was approved. */ + @JsonProperty("approved") Boolean approved, + /** The action the user selected. Defaults to 'autopilot' when autoApproveEdits is true, otherwise 'interactive'. */ + @JsonProperty("selectedAction") UIExitPlanModeAction selectedAction, + /** Whether subsequent edits should be auto-approved without confirmation. */ + @JsonProperty("autoApproveEdits") Boolean autoApproveEdits, + /** Feedback from the user when they declined the plan or requested changes. */ + @JsonProperty("feedback") String feedback +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/UIHandlePendingSamplingResponse.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/UIHandlePendingSamplingResponse.java new file mode 100644 index 0000000000..f000843154 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/UIHandlePendingSamplingResponse.java @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Optional sampling result payload. Omit to reject/cancel the sampling request without providing a result. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record UIHandlePendingSamplingResponse() { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/UIUserInputResponse.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/UIUserInputResponse.java new file mode 100644 index 0000000000..ec8b6e842a --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/UIUserInputResponse.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `UIUserInputResponse` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record UIUserInputResponse( + /** The user's answer text */ + @JsonProperty("answer") String answer, + /** True if the user typed a freeform response, false if they selected a presented choice. Used by telemetry to differentiate between free text input and choice selection. */ + @JsonProperty("wasFreeform") Boolean wasFreeform +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsCodeChanges.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsCodeChanges.java new file mode 100644 index 0000000000..b425ca3d5b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsCodeChanges.java @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Aggregated code change metrics + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record UsageMetricsCodeChanges( + /** Total lines of code added */ + @JsonProperty("linesAdded") Long linesAdded, + /** Total lines of code removed */ + @JsonProperty("linesRemoved") Long linesRemoved, + /** Number of distinct files modified */ + @JsonProperty("filesModifiedCount") Long filesModifiedCount, + /** Distinct file paths modified during the session */ + @JsonProperty("filesModified") List filesModified +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsModelMetric.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsModelMetric.java new file mode 100644 index 0000000000..f86aab3540 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsModelMetric.java @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import javax.annotation.processing.Generated; + +/** + * Schema for the `UsageMetricsModelMetric` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record UsageMetricsModelMetric( + /** Request count and cost metrics for this model */ + @JsonProperty("requests") UsageMetricsModelMetricRequests requests, + /** Token usage metrics for this model */ + @JsonProperty("usage") UsageMetricsModelMetricUsage usage, + /** Accumulated nano-AI units cost for this model */ + @JsonProperty("totalNanoAiu") Double totalNanoAiu, + /** Token count details per type */ + @JsonProperty("tokenDetails") Map tokenDetails +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsModelMetricRequests.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsModelMetricRequests.java new file mode 100644 index 0000000000..ac18ded858 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsModelMetricRequests.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Request count and cost metrics for this model + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record UsageMetricsModelMetricRequests( + /** Number of API requests made with this model */ + @JsonProperty("count") Long count, + /** User-initiated premium request cost (with multiplier applied) */ + @JsonProperty("cost") Double cost +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsModelMetricTokenDetail.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsModelMetricTokenDetail.java new file mode 100644 index 0000000000..1a64c76e90 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsModelMetricTokenDetail.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `UsageMetricsModelMetricTokenDetail` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record UsageMetricsModelMetricTokenDetail( + /** Accumulated token count for this token type */ + @JsonProperty("tokenCount") Long tokenCount +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsModelMetricUsage.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsModelMetricUsage.java new file mode 100644 index 0000000000..f7c556a0f8 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsModelMetricUsage.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Token usage metrics for this model + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record UsageMetricsModelMetricUsage( + /** Total input tokens consumed */ + @JsonProperty("inputTokens") Long inputTokens, + /** Total output tokens produced */ + @JsonProperty("outputTokens") Long outputTokens, + /** Total tokens read from prompt cache */ + @JsonProperty("cacheReadTokens") Long cacheReadTokens, + /** Total tokens written to prompt cache */ + @JsonProperty("cacheWriteTokens") Long cacheWriteTokens, + /** Total output tokens used for reasoning */ + @JsonProperty("reasoningTokens") Long reasoningTokens +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsTokenDetail.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsTokenDetail.java new file mode 100644 index 0000000000..1175c7b8b1 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsTokenDetail.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `UsageMetricsTokenDetail` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record UsageMetricsTokenDetail( + /** Accumulated token count for this token type */ + @JsonProperty("tokenCount") Long tokenCount +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/WorkspaceSummaryHostType.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/WorkspaceSummaryHostType.java new file mode 100644 index 0000000000..58cc24ea50 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/WorkspaceSummaryHostType.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Repository host type, if known + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum WorkspaceSummaryHostType { + /** The {@code github} variant. */ + GITHUB("github"), + /** The {@code ado} variant. */ + ADO("ado"); + + private final String value; + WorkspaceSummaryHostType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static WorkspaceSummaryHostType fromValue(String value) { + for (WorkspaceSummaryHostType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown WorkspaceSummaryHostType value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/WorkspacesCheckpoints.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/WorkspacesCheckpoints.java new file mode 100644 index 0000000000..81c49f6fa4 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/WorkspacesCheckpoints.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `WorkspacesCheckpoints` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record WorkspacesCheckpoints( + /** Checkpoint number assigned by the workspace manager */ + @JsonProperty("number") Long number, + /** Human-readable checkpoint title */ + @JsonProperty("title") String title, + /** Filename of the checkpoint within the workspace checkpoints directory */ + @JsonProperty("filename") String filename +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/WorkspacesWorkspaceDetailsHostType.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/WorkspacesWorkspaceDetailsHostType.java new file mode 100644 index 0000000000..0872a87a44 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/WorkspacesWorkspaceDetailsHostType.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum WorkspacesWorkspaceDetailsHostType { + /** The {@code github} variant. */ + GITHUB("github"), + /** The {@code ado} variant. */ + ADO("ado"); + + private final String value; + WorkspacesWorkspaceDetailsHostType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static WorkspacesWorkspaceDetailsHostType fromValue(String value) { + for (WorkspacesWorkspaceDetailsHostType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown WorkspacesWorkspaceDetailsHostType value: " + value); + } +} diff --git a/src/main/java/com/github/copilot/sdk/CliServerManager.java b/src/main/java/com/github/copilot/sdk/CliServerManager.java index 2176999865..bd4effe5a8 100644 --- a/src/main/java/com/github/copilot/sdk/CliServerManager.java +++ b/src/main/java/com/github/copilot/sdk/CliServerManager.java @@ -30,14 +30,28 @@ final class CliServerManager { private static final Logger LOG = Logger.getLogger(CliServerManager.class.getName()); + private static final int STDERR_READER_JOIN_TIMEOUT_MS = 5000; private final CopilotClientOptions options; private final StringBuilder stderrBuffer = new StringBuilder(); + private volatile Thread stderrThread; + private String connectionToken; CliServerManager(CopilotClientOptions options) { this.options = options; } + /** + * Sets the connection token to pass to the CLI process via environment + * variable. + * + * @param connectionToken + * the token, or {@code null} if not applicable + */ + void setConnectionToken(String connectionToken) { + this.connectionToken = connectionToken; + } + /** * Starts the CLI server process. * @@ -76,13 +90,22 @@ ProcessInfo startCliServer() throws IOException, InterruptedException { } // Default UseLoggedInUser to false when GitHubToken is provided - boolean useLoggedInUser = options.getUseLoggedInUser() != null - ? options.getUseLoggedInUser() - : (options.getGitHubToken() == null || options.getGitHubToken().isEmpty()); + boolean useLoggedInUser = options.getUseLoggedInUser() + .orElse(options.getGitHubToken() == null || options.getGitHubToken().isEmpty()); if (!useLoggedInUser) { args.add("--no-auto-login"); } + if (options.getSessionIdleTimeoutSeconds().isPresent() + && options.getSessionIdleTimeoutSeconds().getAsInt() > 0) { + args.add("--session-idle-timeout"); + args.add(String.valueOf(options.getSessionIdleTimeoutSeconds().getAsInt())); + } + + if (options.isRemote()) { + args.add("--remote"); + } + List command = resolveCliCommand(cliPath, args); var pb = new ProcessBuilder(command); @@ -110,6 +133,16 @@ ProcessInfo startCliServer() throws IOException, InterruptedException { pb.environment().put("COPILOT_SDK_AUTH_TOKEN", options.getGitHubToken()); } + // Set Copilot home directory if configured + if (options.getCopilotHome() != null && !options.getCopilotHome().isEmpty()) { + pb.environment().put("COPILOT_HOME", options.getCopilotHome()); + } + + // Set connection token for TCP mode + if (connectionToken != null && !connectionToken.isEmpty()) { + pb.environment().put("COPILOT_CONNECTION_TOKEN", connectionToken); + } + // Set telemetry environment variables if configured if (options.getTelemetry() != null) { var telemetry = options.getTelemetry(); @@ -126,9 +159,9 @@ ProcessInfo startCliServer() throws IOException, InterruptedException { if (telemetry.getSourceName() != null) { pb.environment().put("COPILOT_OTEL_SOURCE_NAME", telemetry.getSourceName()); } - if (telemetry.getCaptureContent() != null) { + if (telemetry.getCaptureContent().isPresent()) { pb.environment().put("OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT", - telemetry.getCaptureContent() ? "true" : "false"); + telemetry.getCaptureContent().get() ? "true" : "false"); } } @@ -172,7 +205,7 @@ JsonRpcClient connectToServer(Process process, String tcpHost, Integer tcpPort) } private void startStderrReader(Process process) { - var stderrThread = new Thread(() -> { + var thread = new Thread(() -> { try (BufferedReader reader = new BufferedReader( new InputStreamReader(process.getErrorStream(), StandardCharsets.UTF_8))) { String line; @@ -186,8 +219,9 @@ private void startStderrReader(Process process) { LOG.log(Level.FINE, "Error reading stderr", e); } }, "cli-stderr-reader"); - stderrThread.setDaemon(true); - stderrThread.start(); + thread.setDaemon(true); + thread.start(); + this.stderrThread = thread; } private Integer waitForPortAnnouncement(Process process) throws IOException { @@ -199,11 +233,9 @@ private Integer waitForPortAnnouncement(Process process) throws IOException { while (System.currentTimeMillis() < deadline) { String line = reader.readLine(); if (line == null) { + awaitStderrReader(); String stderr = getStderrOutput(); - if (!stderr.isEmpty()) { - throw new IOException("CLI process exited unexpectedly. stderr: " + stderr); - } - throw new IOException("CLI process exited unexpectedly"); + throw new IOException(formatCliExitedMessage("CLI process exited unexpectedly.", stderr)); } Matcher matcher = portPattern.matcher(line); @@ -223,12 +255,30 @@ String getStderrOutput() { } } + private void awaitStderrReader() { + Thread t = this.stderrThread; + if (t != null) { + try { + t.join(STDERR_READER_JOIN_TIMEOUT_MS); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } + } + private void clearStderrBuffer() { synchronized (stderrBuffer) { stderrBuffer.setLength(0); } } + static String formatCliExitedMessage(String message, String stderrOutput) { + if (stderrOutput == null || stderrOutput.isEmpty()) { + return message; + } + return message + "\nstderr: " + stderrOutput; + } + private List resolveCliCommand(String cliPath, List args) { boolean isJsFile = cliPath.toLowerCase().endsWith(".js"); diff --git a/src/main/java/com/github/copilot/sdk/CopilotClient.java b/src/main/java/com/github/copilot/sdk/CopilotClient.java index 4b3bb0904f..4d0770319a 100644 --- a/src/main/java/com/github/copilot/sdk/CopilotClient.java +++ b/src/main/java/com/github/copilot/sdk/CopilotClient.java @@ -21,6 +21,7 @@ import com.github.copilot.sdk.json.CopilotClientOptions; import com.github.copilot.sdk.json.CreateSessionResponse; +import com.github.copilot.sdk.generated.rpc.ConnectParams; import com.github.copilot.sdk.generated.rpc.ServerRpc; import com.github.copilot.sdk.json.DeleteSessionResponse; import com.github.copilot.sdk.json.GetAuthStatusResponse; @@ -75,6 +76,7 @@ public final class CopilotClient implements AutoCloseable { * shutdown via {@link #stop()}. */ public static final int AUTOCLOSEABLE_TIMEOUT_SECONDS = 10; + private static final int FORCE_KILL_TIMEOUT_SECONDS = 10; private final CopilotClientOptions options; private final CliServerManager serverManager; private final LifecycleEventManager lifecycleManager = new LifecycleEventManager(); @@ -83,6 +85,7 @@ public final class CopilotClient implements AutoCloseable { private volatile boolean disposed = false; private final String optionsHost; private final Integer optionsPort; + private final String effectiveConnectionToken; private volatile List modelsCache; private final Object modelsCacheLock = new Object(); @@ -117,11 +120,29 @@ public CopilotClient(CopilotClientOptions options) { // Validate auth options with external server if (this.options.getCliUrl() != null && !this.options.getCliUrl().isEmpty() - && (this.options.getGitHubToken() != null || this.options.getUseLoggedInUser() != null)) { + && (this.options.getGitHubToken() != null || this.options.getUseLoggedInUser().isPresent())) { throw new IllegalArgumentException( "GitHubToken and UseLoggedInUser cannot be used with CliUrl (external server manages its own auth)"); } + // Validate tcpConnectionToken + if (this.options.getTcpConnectionToken() != null) { + if (this.options.getTcpConnectionToken().isEmpty()) { + throw new IllegalArgumentException("TcpConnectionToken must be a non-empty string"); + } + if (this.options.isUseStdio()) { + throw new IllegalArgumentException("TcpConnectionToken cannot be used with UseStdio = true"); + } + } + + // Compute effective connection token: use provided, or auto-generate for + // SDK-spawned TCP mode, or null for stdio/external server + boolean sdkSpawnsCli = !this.options.isUseStdio() + && (this.options.getCliUrl() == null || this.options.getCliUrl().isEmpty()); + this.effectiveConnectionToken = this.options.getTcpConnectionToken() != null + ? this.options.getTcpConnectionToken() + : (sdkSpawnsCli ? java.util.UUID.randomUUID().toString() : null); + // Parse CliUrl if provided if (this.options.getCliUrl() != null && !this.options.getCliUrl().isEmpty()) { URI uri = CliServerManager.parseCliUrl(this.options.getCliUrl()); @@ -133,6 +154,7 @@ public CopilotClient(CopilotClientOptions options) { } this.serverManager = new CliServerManager(this.options); + this.serverManager.setConnectionToken(this.effectiveConnectionToken); } /** @@ -165,9 +187,10 @@ private CompletableFuture startCore() { } private Connection startCoreBody() { + Process process = null; + long startNanos = System.nanoTime(); try { JsonRpcClient rpc; - Process process = null; if (optionsHost != null && optionsPort != null) { // External server (TCP) @@ -180,6 +203,9 @@ private Connection startCoreBody() { processInfo.port()); } + LoggingHelpers.logTiming(LOG, Level.FINE, "CopilotClient.start transport setup complete. Elapsed={Elapsed}", + startNanos); + Connection connection = new Connection(rpc, process, new ServerRpc(rpc::invoke)); // Register handlers for server-to-client calls @@ -189,40 +215,81 @@ private Connection startCoreBody() { // Verify protocol version verifyProtocolVersion(connection); + LoggingHelpers.logTiming(LOG, Level.FINE, + "CopilotClient.start protocol verification complete. Elapsed={Elapsed}", startNanos); - LOG.info("Copilot client connected"); + LoggingHelpers.logTiming(LOG, Level.FINE, "CopilotClient.start complete. Elapsed={Elapsed}", startNanos); return connection; } catch (Exception e) { + if (!(e instanceof java.util.concurrent.CancellationException)) { + LoggingHelpers.logTiming(LOG, Level.WARNING, e, "CopilotClient.start failed. Elapsed={Elapsed}", + startNanos); + } + // Clean up the spawned process if connection setup failed + if (process != null) { + cleanupCliProcess(process); + } String stderr = serverManager.getStderrOutput(); if (!stderr.isEmpty()) { - throw new CompletionException(new IOException("CLI process exited unexpectedly. stderr: " + stderr, e)); + throw new CompletionException(new IOException( + CliServerManager.formatCliExitedMessage("CLI process exited unexpectedly.", stderr), e)); } throw new CompletionException(e); } } private static final int MIN_PROTOCOL_VERSION = 2; + private static final int METHOD_NOT_FOUND_ERROR_CODE = -32601; private void verifyProtocolVersion(Connection connection) throws Exception { int expectedVersion = SdkProtocolVersion.get(); - var params = new HashMap(); - params.put("message", null); - PingResponse pingResponse = connection.rpc.invoke("ping", params, PingResponse.class).get(30, TimeUnit.SECONDS); + Integer serverVersion; - if (pingResponse.protocolVersion() == null) { - throw new RuntimeException("SDK protocol version mismatch: SDK expects version " + expectedVersion - + ", but server does not report a protocol version. " + try { + // Try the new 'connect' RPC which supports connection tokens + var connectParams = new ConnectParams(effectiveConnectionToken); + var connectResponse = connection.rpc + .invoke("connect", connectParams, com.github.copilot.sdk.generated.rpc.ConnectResult.class) + .get(30, TimeUnit.SECONDS); + serverVersion = connectResponse.protocolVersion() != null + ? connectResponse.protocolVersion().intValue() + : null; + } catch (Exception e) { + // Unwrap CompletionException/ExecutionException to check inner cause + Throwable cause = e; + while (cause instanceof java.util.concurrent.ExecutionException || cause instanceof CompletionException) { + cause = cause.getCause(); + } + if (cause instanceof JsonRpcException rpcEx && isUnsupportedConnectMethod(rpcEx)) { + // Legacy server without 'connect'; fall back to 'ping'. + // A token, if any, is silently dropped β€” the legacy server can't enforce one. + var params = new HashMap(); + params.put("message", null); + PingResponse pingResponse = connection.rpc.invoke("ping", params, PingResponse.class).get(30, + TimeUnit.SECONDS); + serverVersion = pingResponse.protocolVersion(); + } else { + throw e; + } + } + + if (serverVersion == null) { + throw new RuntimeException("SDK protocol version mismatch: SDK supports versions " + MIN_PROTOCOL_VERSION + + "-" + expectedVersion + ", but server does not report a protocol version. " + "Please update your server to ensure compatibility."); } - int serverVersion = pingResponse.protocolVersion(); if (serverVersion < MIN_PROTOCOL_VERSION || serverVersion > expectedVersion) { - throw new RuntimeException("SDK protocol version mismatch: SDK expects version " + expectedVersion - + " (minimum " + MIN_PROTOCOL_VERSION + "), but server reports version " + serverVersion + ". " + throw new RuntimeException("SDK protocol version mismatch: SDK supports versions " + MIN_PROTOCOL_VERSION + + "-" + expectedVersion + ", but server reports version " + serverVersion + ". " + "Please update your SDK or server to ensure compatibility."); } } + private static boolean isUnsupportedConnectMethod(JsonRpcException ex) { + return ex.getCode() == METHOD_NOT_FOUND_ERROR_CODE || "Unhandled method connect".equals(ex.getMessage()); + } + /** * Disconnects from the Copilot server and closes all active sessions. *

@@ -299,15 +366,28 @@ private CompletableFuture cleanupConnection() { } if (connection.process != null) { - try { - if (connection.process.isAlive()) { - connection.process.destroyForcibly(); - } - } catch (Exception e) { - LOG.log(Level.FINE, "Error killing process", e); + cleanupCliProcess(connection.process); + } + }).exceptionally(ex -> { + LOG.log(Level.FINE, "Ignoring failed Copilot client startup during cleanup", ex); + return null; + }); + } + + private static void cleanupCliProcess(Process process) { + try { + if (process.isAlive()) { + Process destroyedProcess = process.destroyForcibly(); + if (!destroyedProcess.waitFor(FORCE_KILL_TIMEOUT_SECONDS, TimeUnit.SECONDS)) { + LOG.fine("Process did not terminate within force kill timeout"); } } - }).exceptionally(ex -> null); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + LOG.log(Level.FINE, "Interrupted while killing process", e); + } catch (Exception e) { + LOG.log(Level.FINE, "Error killing process", e); + } } /** @@ -347,18 +427,23 @@ public CompletableFuture createSession(SessionConfig config) { + "new SessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL)")); } return ensureConnected().thenCompose(connection -> { + long totalNanos = System.nanoTime(); // Pre-generate session ID so the session can be registered before the RPC call, // ensuring no events emitted by the CLI during creation are lost. String sessionId = config.getSessionId() != null ? config.getSessionId() : java.util.UUID.randomUUID().toString(); + long setupNanos = System.nanoTime(); var session = new CopilotSession(sessionId, connection.rpc); if (options.getExecutor() != null) { session.setExecutor(options.getExecutor()); } SessionRequestBuilder.configureSession(session, config); sessions.put(sessionId, session); + LoggingHelpers.logTiming(LOG, Level.FINE, + "CopilotClient.createSession local setup complete. Elapsed={Elapsed}, SessionId=" + sessionId, + setupNanos); // Extract transform callbacks from the system message config. // Callbacks are registered with the session; a wire-safe copy of the @@ -374,7 +459,12 @@ public CompletableFuture createSession(SessionConfig config) { request.setSystemMessage(extracted.wireSystemMessage()); } + long rpcNanos = System.nanoTime(); return connection.rpc.invoke("session.create", request, CreateSessionResponse.class).thenApply(response -> { + LoggingHelpers.logTiming(LOG, Level.FINE, + "CopilotClient.createSession session creation request completed. Elapsed={Elapsed}, SessionId=" + + sessionId, + rpcNanos); session.setWorkspacePath(response.workspacePath()); session.setCapabilities(response.capabilities()); // If the server returned a different sessionId (e.g. a v2 CLI that ignores @@ -385,9 +475,13 @@ public CompletableFuture createSession(SessionConfig config) { session.setActiveSessionId(returnedId); sessions.put(returnedId, session); } + LoggingHelpers.logTiming(LOG, Level.FINE, + "CopilotClient.createSession complete. Elapsed={Elapsed}, SessionId=" + sessionId, totalNanos); return session; }).exceptionally(ex -> { sessions.remove(sessionId); + LoggingHelpers.logTiming(LOG, Level.WARNING, ex, + "CopilotClient.createSession failed. Elapsed={Elapsed}, SessionId=" + sessionId, totalNanos); throw ex instanceof RuntimeException re ? re : new RuntimeException(ex); }); }); @@ -426,13 +520,18 @@ public CompletableFuture resumeSession(String sessionId, ResumeS + "new ResumeSessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL)")); } return ensureConnected().thenCompose(connection -> { + long totalNanos = System.nanoTime(); // Register the session before the RPC call to avoid missing early events. + long setupNanos = System.nanoTime(); var session = new CopilotSession(sessionId, connection.rpc); if (options.getExecutor() != null) { session.setExecutor(options.getExecutor()); } SessionRequestBuilder.configureSession(session, config); sessions.put(sessionId, session); + LoggingHelpers.logTiming(LOG, Level.FINE, + "CopilotClient.resumeSession local setup complete. Elapsed={Elapsed}, SessionId=" + sessionId, + setupNanos); // Extract transform callbacks from the system message config. var extracted = SessionRequestBuilder.extractTransformCallbacks(config.getSystemMessage()); @@ -445,7 +544,12 @@ public CompletableFuture resumeSession(String sessionId, ResumeS request.setSystemMessage(extracted.wireSystemMessage()); } + long rpcNanos = System.nanoTime(); return connection.rpc.invoke("session.resume", request, ResumeSessionResponse.class).thenApply(response -> { + LoggingHelpers.logTiming(LOG, Level.FINE, + "CopilotClient.resumeSession session resume request completed. Elapsed={Elapsed}, SessionId=" + + sessionId, + rpcNanos); session.setWorkspacePath(response.workspacePath()); session.setCapabilities(response.capabilities()); // If the server returned a different sessionId than what was requested, re-key. @@ -455,9 +559,13 @@ public CompletableFuture resumeSession(String sessionId, ResumeS session.setActiveSessionId(returnedId); sessions.put(returnedId, session); } + LoggingHelpers.logTiming(LOG, Level.FINE, + "CopilotClient.resumeSession complete. Elapsed={Elapsed}, SessionId=" + sessionId, totalNanos); return session; }).exceptionally(ex -> { sessions.remove(sessionId); + LoggingHelpers.logTiming(LOG, Level.WARNING, ex, + "CopilotClient.resumeSession failed. Elapsed={Elapsed}, SessionId=" + sessionId, totalNanos); throw ex instanceof RuntimeException re ? re : new RuntimeException(ex); }); }); @@ -744,18 +852,15 @@ public CompletableFuture getForegroundSessionId() { * if the operation fails */ public CompletableFuture setForegroundSessionId(String sessionId) { - return ensureConnected() - .thenCompose( - connection -> connection.rpc - .invoke("session.setForeground", Map.of("sessionId", sessionId), - com.github.copilot.sdk.json.SetForegroundSessionResponse.class) - .thenAccept(response -> { - if (!response.success()) { - throw new RuntimeException(response.error() != null - ? response.error() - : "Failed to set foreground session"); - } - })); + return ensureConnected().thenCompose(connection -> connection.rpc + .invoke("session.setForeground", new com.github.copilot.sdk.json.SetForegroundSessionRequest(sessionId), + com.github.copilot.sdk.json.SetForegroundSessionResponse.class) + .thenAccept(response -> { + if (!response.success()) { + throw new RuntimeException( + response.error() != null ? response.error() : "Failed to set foreground session"); + } + })); } /** diff --git a/src/main/java/com/github/copilot/sdk/CopilotSession.java b/src/main/java/com/github/copilot/sdk/CopilotSession.java index b54b2cbf3c..4b75fbc7e5 100644 --- a/src/main/java/com/github/copilot/sdk/CopilotSession.java +++ b/src/main/java/com/github/copilot/sdk/CopilotSession.java @@ -32,15 +32,19 @@ import com.github.copilot.sdk.generated.AssistantMessageEvent; import com.github.copilot.sdk.generated.rpc.SessionCommandsHandlePendingCommandParams; import com.github.copilot.sdk.generated.rpc.SessionLogParams; +import com.github.copilot.sdk.generated.rpc.SessionLogLevel; +import com.github.copilot.sdk.generated.rpc.ModelCapabilitiesOverride; +import com.github.copilot.sdk.generated.rpc.ModelCapabilitiesOverrideLimits; +import com.github.copilot.sdk.generated.rpc.ModelCapabilitiesOverrideSupports; import com.github.copilot.sdk.generated.rpc.SessionModelSwitchToParams; import com.github.copilot.sdk.generated.rpc.SessionPermissionsHandlePendingPermissionRequestParams; import com.github.copilot.sdk.generated.rpc.SessionRpc; import com.github.copilot.sdk.generated.rpc.SessionToolsHandlePendingToolCallParams; import com.github.copilot.sdk.generated.rpc.SessionUiElicitationParams; -import com.github.copilot.sdk.generated.rpc.SessionUiElicitationResult; import com.github.copilot.sdk.generated.rpc.SessionUiHandlePendingElicitationParams; -import com.github.copilot.sdk.generated.rpc.SessionUiHandlePendingElicitationParams.SessionUiHandlePendingElicitationParamsResult; -import com.github.copilot.sdk.generated.rpc.SessionUiHandlePendingElicitationParams.SessionUiHandlePendingElicitationParamsResult.SessionUiHandlePendingElicitationParamsResultAction; +import com.github.copilot.sdk.generated.rpc.UIElicitationResponse; +import com.github.copilot.sdk.generated.rpc.UIElicitationResponseAction; +import com.github.copilot.sdk.generated.rpc.UIElicitationSchema; import com.github.copilot.sdk.generated.CapabilitiesChangedEvent; import com.github.copilot.sdk.generated.CommandExecuteEvent; import com.github.copilot.sdk.generated.ElicitationRequestedEvent; @@ -50,6 +54,10 @@ import com.github.copilot.sdk.generated.SessionEvent; import com.github.copilot.sdk.generated.SessionIdleEvent; import com.github.copilot.sdk.json.AgentInfo; +import com.github.copilot.sdk.json.AutoModeSwitchHandler; +import com.github.copilot.sdk.json.AutoModeSwitchInvocation; +import com.github.copilot.sdk.json.AutoModeSwitchRequest; +import com.github.copilot.sdk.json.AutoModeSwitchResponse; import com.github.copilot.sdk.json.CommandContext; import com.github.copilot.sdk.json.CommandDefinition; import com.github.copilot.sdk.json.CommandHandler; @@ -58,6 +66,10 @@ import com.github.copilot.sdk.json.ElicitationParams; import com.github.copilot.sdk.json.ElicitationResult; import com.github.copilot.sdk.json.ElicitationResultAction; +import com.github.copilot.sdk.json.ExitPlanModeHandler; +import com.github.copilot.sdk.json.ExitPlanModeInvocation; +import com.github.copilot.sdk.json.ExitPlanModeRequest; +import com.github.copilot.sdk.json.ExitPlanModeResult; import com.github.copilot.sdk.json.ElicitationSchema; import com.github.copilot.sdk.json.GetMessagesResponse; import com.github.copilot.sdk.json.HookInvocation; @@ -69,6 +81,7 @@ import com.github.copilot.sdk.json.PermissionRequestResult; import com.github.copilot.sdk.json.PermissionRequestResultKind; import com.github.copilot.sdk.json.PostToolUseHookInput; +import com.github.copilot.sdk.json.PreMcpToolCallHookInput; import com.github.copilot.sdk.json.PreToolUseHookInput; import com.github.copilot.sdk.json.SendMessageRequest; import com.github.copilot.sdk.json.SendMessageResponse; @@ -152,6 +165,8 @@ public final class CopilotSession implements AutoCloseable { private final AtomicReference permissionHandler = new AtomicReference<>(); private final AtomicReference userInputHandler = new AtomicReference<>(); private final AtomicReference elicitationHandler = new AtomicReference<>(); + private final AtomicReference exitPlanModeHandler = new AtomicReference<>(); + private final AtomicReference autoModeSwitchHandler = new AtomicReference<>(); private final AtomicReference hooksHandler = new AtomicReference<>(); private volatile EventErrorHandler eventErrorHandler; private volatile EventErrorPolicy eventErrorPolicy = EventErrorPolicy.PROPAGATE_AND_LOG_ERRORS; @@ -493,13 +508,24 @@ public CompletableFuture send(MessageOptions options) { */ public CompletableFuture sendAndWait(MessageOptions options, long timeoutMs) { ensureNotTerminated(); + long totalNanos = System.nanoTime(); var future = new CompletableFuture(); var lastAssistantMessage = new AtomicReference(); + var firstAssistantMessageLogged = new java.util.concurrent.atomic.AtomicBoolean(false); Consumer handler = evt -> { if (evt instanceof AssistantMessageEvent msg) { lastAssistantMessage.set(msg); + if (firstAssistantMessageLogged.compareAndSet(false, true)) { + LoggingHelpers.logTiming(LOG, Level.FINE, + "CopilotSession.sendAndWait first assistant message. Elapsed={Elapsed}, SessionId=" + + sessionId, + totalNanos); + } } else if (evt instanceof SessionIdleEvent) { + LoggingHelpers.logTiming(LOG, Level.FINE, + "CopilotSession.sendAndWait idle received. Elapsed={Elapsed}, SessionId=" + sessionId, + totalNanos); future.complete(lastAssistantMessage.get()); } else if (evt instanceof SessionErrorEvent errorEvent) { String message = errorEvent.getData() != null ? errorEvent.getData().message() : "session error"; @@ -564,8 +590,23 @@ public CompletableFuture sendAndWait(MessageOptions optio } if (!result.isDone()) { if (ex != null) { + if (ex instanceof TimeoutException) { + LoggingHelpers.logTiming(LOG, Level.WARNING, ex, + "CopilotSession.sendAndWait failed. Elapsed={Elapsed}, SessionId=" + sessionId + + ", CompletedBy=timeout", + totalNanos); + } else if (!(ex instanceof java.util.concurrent.CancellationException)) { + LoggingHelpers.logTiming(LOG, Level.WARNING, ex, + "CopilotSession.sendAndWait failed. Elapsed={Elapsed}, SessionId=" + sessionId + + ", CompletedBy=error", + totalNanos); + } result.completeExceptionally(ex); } else { + LoggingHelpers.logTiming( + LOG, Level.FINE, "CopilotSession.sendAndWait complete. Elapsed={Elapsed}, SessionId=" + + sessionId + ", CompletedBy=idle, AssistantMessageReceived=" + (r != null), + totalNanos); result.complete(r); } } @@ -880,8 +921,7 @@ private void executeToolAndRespondAsync(String requestId, String toolName, Strin * future completes exceptionally. */ private SessionUiHandlePendingElicitationParams buildElicitationCancelParams(String requestId) { - var cancelResult = new SessionUiHandlePendingElicitationParamsResult( - SessionUiHandlePendingElicitationParamsResultAction.CANCEL, null); + var cancelResult = new UIElicitationResponse(UIElicitationResponseAction.CANCEL, null); return new SessionUiHandlePendingElicitationParams(sessionId, requestId, cancelResult); } @@ -1037,9 +1077,8 @@ private void handleElicitationRequestAsync(ElicitationContext context, String re String actionStr = result.getAction() != null ? result.getAction().getValue() : ElicitationResultAction.CANCEL.getValue(); - var parsedAction = SessionUiHandlePendingElicitationParamsResultAction.fromValue(actionStr); - var elicitationResult = new SessionUiHandlePendingElicitationParamsResult(parsedAction, - result.getContent()); + var parsedAction = UIElicitationResponseAction.fromValue(actionStr); + var elicitationResult = new UIElicitationResponse(parsedAction, result.getContent()); getRpc().ui.handlePendingElicitation( new SessionUiHandlePendingElicitationParams(sessionId, requestId, elicitationResult)); } catch (Exception e) { @@ -1080,9 +1119,9 @@ private void handleElicitationRequestAsync(ElicitationContext context, String re */ private void assertElicitation() { SessionCapabilities caps = capabilities; - if (caps == null || caps.getUi() == null || !Boolean.TRUE.equals(caps.getUi().getElicitation())) { + if (caps == null || caps.getUi() == null || !caps.getUi().getElicitation().orElse(false)) { throw new IllegalStateException("Elicitation is not supported by the host. " - + "Check session.getCapabilities().getUi()?.getElicitation() before calling UI methods."); + + "Check session.getCapabilities().getUi().getElicitation().orElse(false) before calling UI methods."); } } @@ -1095,9 +1134,8 @@ private final class SessionUiApiImpl implements SessionUiApi { public CompletableFuture elicitation(ElicitationParams params) { assertElicitation(); return getRpc().ui.elicitation(new SessionUiElicitationParams(sessionId, params.getMessage(), - new SessionUiElicitationParams.SessionUiElicitationParamsRequestedSchema( - params.getRequestedSchema().getType(), params.getRequestedSchema().getProperties(), - params.getRequestedSchema().getRequired()))) + new UIElicitationSchema(params.getRequestedSchema().getType(), + params.getRequestedSchema().getProperties(), params.getRequestedSchema().getRequired()))) .thenApply(resp -> { var result = new ElicitationResult(); if (resp.action() != null) { @@ -1120,14 +1158,10 @@ public CompletableFuture elicitation(ElicitationParams params public CompletableFuture confirm(String message) { assertElicitation(); var field = Map.of("type", "boolean", "default", (Object) true); - return getRpc().ui - .elicitation( - new SessionUiElicitationParams(sessionId, message, - new SessionUiElicitationParams.SessionUiElicitationParamsRequestedSchema("object", - Map.of("confirmed", (Object) field), List.of("confirmed")))) + return getRpc().ui.elicitation(new SessionUiElicitationParams(sessionId, message, + new UIElicitationSchema("object", Map.of("confirmed", (Object) field), List.of("confirmed")))) .thenApply(resp -> { - if (resp.action() == SessionUiElicitationResult.SessionUiElicitationResultAction.ACCEPT - && resp.content() != null) { + if (resp.action() == UIElicitationResponseAction.ACCEPT && resp.content() != null) { Object val = resp.content().get("confirmed"); if (val instanceof Boolean b) { return b; @@ -1147,14 +1181,10 @@ public CompletableFuture confirm(String message) { public CompletableFuture select(String message, String[] options) { assertElicitation(); var field = Map.of("type", (Object) "string", "enum", (Object) options); - return getRpc().ui - .elicitation( - new SessionUiElicitationParams(sessionId, message, - new SessionUiElicitationParams.SessionUiElicitationParamsRequestedSchema("object", - Map.of("selection", (Object) field), List.of("selection")))) + return getRpc().ui.elicitation(new SessionUiElicitationParams(sessionId, message, + new UIElicitationSchema("object", Map.of("selection", (Object) field), List.of("selection")))) .thenApply(resp -> { - if (resp.action() == SessionUiElicitationResult.SessionUiElicitationResultAction.ACCEPT - && resp.content() != null) { + if (resp.action() == UIElicitationResponseAction.ACCEPT && resp.content() != null) { Object val = resp.content().get("selection"); return val != null ? val.toString() : null; } @@ -1172,21 +1202,20 @@ public CompletableFuture input(String message, InputOptions options) { field.put("title", options.getTitle()); if (options.getDescription() != null) field.put("description", options.getDescription()); - if (options.getMinLength() != null) - field.put("minLength", options.getMinLength()); - if (options.getMaxLength() != null) - field.put("maxLength", options.getMaxLength()); + if (options.getMinLength().isPresent()) + field.put("minLength", options.getMinLength().getAsInt()); + if (options.getMaxLength().isPresent()) + field.put("maxLength", options.getMaxLength().getAsInt()); if (options.getFormat() != null) field.put("format", options.getFormat()); if (options.getDefaultValue() != null) field.put("default", options.getDefaultValue()); } - return getRpc().ui.elicitation(new SessionUiElicitationParams(sessionId, message, - new SessionUiElicitationParams.SessionUiElicitationParamsRequestedSchema("object", - Map.of("value", (Object) field), List.of("value")))) + return getRpc().ui + .elicitation(new SessionUiElicitationParams(sessionId, message, + new UIElicitationSchema("object", Map.of("value", (Object) field), List.of("value")))) .thenApply(resp -> { - if (resp.action() == SessionUiElicitationResult.SessionUiElicitationResultAction.ACCEPT - && resp.content() != null) { + if (resp.action() == UIElicitationResponseAction.ACCEPT && resp.content() != null) { Object val = resp.content().get("value"); return val != null ? val.toString() : null; } @@ -1232,7 +1261,7 @@ CompletableFuture handlePermissionRequest(JsonNode perm PermissionHandler handler = permissionHandler.get(); if (handler == null) { PermissionRequestResult result = new PermissionRequestResult(); - result.setKind("denied-no-approval-rule-and-could-not-request-from-user"); + result.setKind(PermissionRequestResultKind.USER_NOT_AVAILABLE); return CompletableFuture.completedFuture(result); } @@ -1243,13 +1272,13 @@ CompletableFuture handlePermissionRequest(JsonNode perm return handler.handle(request, invocation).exceptionally(ex -> { LOG.log(Level.SEVERE, "Permission handler threw an exception", ex); PermissionRequestResult result = new PermissionRequestResult(); - result.setKind("denied-no-approval-rule-and-could-not-request-from-user"); + result.setKind(PermissionRequestResultKind.USER_NOT_AVAILABLE); return result; }); } catch (Exception e) { LOG.log(Level.SEVERE, "Failed to process permission request", e); PermissionRequestResult result = new PermissionRequestResult(); - result.setKind("denied-no-approval-rule-and-could-not-request-from-user"); + result.setKind(PermissionRequestResultKind.USER_NOT_AVAILABLE); return CompletableFuture.completedFuture(result); } } @@ -1299,6 +1328,32 @@ void registerElicitationHandler(ElicitationHandler handler) { elicitationHandler.set(handler); } + /** + * Registers an exit-plan-mode handler for this session. + *

+ * Called internally when creating or resuming a session with an exit-plan-mode + * handler. + * + * @param handler + * the handler to invoke when an exit-plan-mode request is received + */ + void registerExitPlanModeHandler(ExitPlanModeHandler handler) { + exitPlanModeHandler.set(handler); + } + + /** + * Registers an auto-mode-switch handler for this session. + *

+ * Called internally when creating or resuming a session with an + * auto-mode-switch handler. + * + * @param handler + * the handler to invoke when an auto-mode-switch request is received + */ + void registerAutoModeSwitchHandler(AutoModeSwitchHandler handler) { + autoModeSwitchHandler.set(handler); + } + /** * Sets the capabilities reported by the host for this session. *

@@ -1338,6 +1393,60 @@ CompletableFuture handleUserInputRequest(UserInputRequest req } } + /** + * Handles an exit-plan-mode request from the Copilot CLI. + *

+ * Called internally when the server sends an {@code exitPlanMode.request}. + * + * @param request + * the exit-plan-mode request + * @return a future that resolves with the user's decision + */ + CompletableFuture handleExitPlanModeRequest(ExitPlanModeRequest request) { + ExitPlanModeHandler handler = exitPlanModeHandler.get(); + if (handler == null) { + return CompletableFuture.completedFuture(new ExitPlanModeResult().setApproved(true)); + } + + try { + var invocation = new ExitPlanModeInvocation().setSessionId(sessionId); + return handler.handle(request, invocation).exceptionally(ex -> { + LOG.log(Level.SEVERE, "Exit plan mode handler threw an exception", ex); + throw new RuntimeException("Exit plan mode handler error", ex); + }); + } catch (Exception e) { + LOG.log(Level.SEVERE, "Failed to process exit plan mode request", e); + return CompletableFuture.failedFuture(e); + } + } + + /** + * Handles an auto-mode-switch request from the Copilot CLI. + *

+ * Called internally when the server sends an {@code autoModeSwitch.request}. + * + * @param request + * the auto-mode-switch request + * @return a future that resolves with the user's decision + */ + CompletableFuture handleAutoModeSwitchRequest(AutoModeSwitchRequest request) { + AutoModeSwitchHandler handler = autoModeSwitchHandler.get(); + if (handler == null) { + return CompletableFuture.completedFuture(AutoModeSwitchResponse.NO); + } + + try { + var invocation = new AutoModeSwitchInvocation().setSessionId(sessionId); + return handler.handle(request, invocation).exceptionally(ex -> { + LOG.log(Level.SEVERE, "Auto mode switch handler threw an exception", ex); + throw new RuntimeException("Auto mode switch handler error", ex); + }); + } catch (Exception e) { + LOG.log(Level.SEVERE, "Failed to process auto mode switch request", e); + return CompletableFuture.failedFuture(e); + } + } + /** * Registers hook handlers for this session. *

@@ -1439,6 +1548,13 @@ CompletableFuture handleHooksInvoke(String hookType, JsonNode input) { .thenApply(output -> (Object) output); } break; + case "preMcpToolCall" : + if (hooks.getOnPreMcpToolCall() != null) { + PreMcpToolCallHookInput mcpInput = MAPPER.treeToValue(input, PreMcpToolCallHookInput.class); + return hooks.getOnPreMcpToolCall().handle(mcpInput, invocation) + .thenApply(output -> (Object) output); + } + break; case "postToolUse" : if (hooks.getOnPostToolUse() != null) { PostToolUseHookInput postInput = MAPPER.treeToValue(input, PostToolUseHookInput.class); @@ -1549,7 +1665,7 @@ public CompletableFuture abort() { */ public CompletableFuture setModel(String model, String reasoningEffort) { ensureNotTerminated(); - return getRpc().model.switchTo(new SessionModelSwitchToParams(sessionId, model, reasoningEffort, null)) + return getRpc().model.switchTo(new SessionModelSwitchToParams(sessionId, model, reasoningEffort, null, null)) .thenApply(r -> null); } @@ -1582,24 +1698,24 @@ public CompletableFuture setModel(String model, String reasoningEffort) { public CompletableFuture setModel(String model, String reasoningEffort, com.github.copilot.sdk.json.ModelCapabilitiesOverride modelCapabilities) { ensureNotTerminated(); - SessionModelSwitchToParams.SessionModelSwitchToParamsModelCapabilities generatedCapabilities = null; + ModelCapabilitiesOverride generatedCapabilities = null; if (modelCapabilities != null) { - SessionModelSwitchToParams.SessionModelSwitchToParamsModelCapabilities.SessionModelSwitchToParamsModelCapabilitiesSupports supports = null; + ModelCapabilitiesOverrideSupports supports = null; if (modelCapabilities.getSupports() != null) { var s = modelCapabilities.getSupports(); - supports = new SessionModelSwitchToParams.SessionModelSwitchToParamsModelCapabilities.SessionModelSwitchToParamsModelCapabilitiesSupports( - s.getVision(), s.getReasoningEffort()); + supports = new ModelCapabilitiesOverrideSupports(s.getVision().orElse(null), + s.getReasoningEffort().orElse(null)); } - SessionModelSwitchToParams.SessionModelSwitchToParamsModelCapabilities.SessionModelSwitchToParamsModelCapabilitiesLimits limits = null; + ModelCapabilitiesOverrideLimits limits = null; if (modelCapabilities.getLimits() != null) { limits = new ObjectMapper().convertValue(modelCapabilities.getLimits(), - SessionModelSwitchToParams.SessionModelSwitchToParamsModelCapabilities.SessionModelSwitchToParamsModelCapabilitiesLimits.class); + ModelCapabilitiesOverrideLimits.class); } - generatedCapabilities = new SessionModelSwitchToParams.SessionModelSwitchToParamsModelCapabilities(supports, - limits); + generatedCapabilities = new ModelCapabilitiesOverride(supports, limits); } return getRpc().model - .switchTo(new SessionModelSwitchToParams(sessionId, model, reasoningEffort, generatedCapabilities)) + .switchTo( + new SessionModelSwitchToParams(sessionId, model, reasoningEffort, null, generatedCapabilities)) .thenApply(r -> null); } @@ -1658,15 +1774,16 @@ public CompletableFuture setModel(String model) { */ public CompletableFuture log(String message, String level, Boolean ephemeral, String url) { ensureNotTerminated(); - SessionLogParams.SessionLogParamsLevel rpcLevel = null; + SessionLogLevel rpcLevel = null; if (level != null) { try { - rpcLevel = SessionLogParams.SessionLogParamsLevel.fromValue(level); + rpcLevel = SessionLogLevel.fromValue(level); } catch (IllegalArgumentException e) { - rpcLevel = SessionLogParams.SessionLogParamsLevel.INFO; + rpcLevel = SessionLogLevel.INFO; } } - return getRpc().log(new SessionLogParams(sessionId, message, rpcLevel, ephemeral, url)).thenApply(r -> null); + return getRpc().log(new SessionLogParams(sessionId, message, rpcLevel, null, ephemeral, url, null)) + .thenApply(r -> null); } /** @@ -1834,6 +1951,8 @@ public void close() { permissionHandler.set(null); userInputHandler.set(null); elicitationHandler.set(null); + exitPlanModeHandler.set(null); + autoModeSwitchHandler.set(null); hooksHandler.set(null); } diff --git a/src/main/java/com/github/copilot/sdk/JsonRpcClient.java b/src/main/java/com/github/copilot/sdk/JsonRpcClient.java index 66ab1726df..73db478ca9 100644 --- a/src/main/java/com/github/copilot/sdk/JsonRpcClient.java +++ b/src/main/java/com/github/copilot/sdk/JsonRpcClient.java @@ -104,6 +104,7 @@ public void registerMethodHandler(String method, BiConsumer ha * Sends a JSON-RPC request and waits for the response. */ public CompletableFuture invoke(String method, Object params, Class responseType) { + long timingNanos = System.nanoTime(); long id = requestIdCounter.incrementAndGet(); var future = new CompletableFuture(); pendingRequests.put(id, future); @@ -123,13 +124,24 @@ public CompletableFuture invoke(String method, Object params, Class re return future.thenApply(result -> { try { - if (responseType == Void.class || responseType == void.class) { - return null; + T value = null; + if (responseType != Void.class && responseType != void.class) { + value = MAPPER.treeToValue(result, responseType); } - return MAPPER.treeToValue(result, responseType); + LoggingHelpers.logTiming(LOG, Level.FINE, + "JsonRpc.invoke JSON-RPC request finished. Elapsed={Elapsed}, Method=" + method + ", RequestId=" + + id + ", Status=Succeeded", + timingNanos); + return value; } catch (JsonProcessingException e) { throw new CompletionException(e); } + }).exceptionally(ex -> { + LoggingHelpers.logTiming(LOG, Level.WARNING, ex, + "JsonRpc.invoke JSON-RPC request finished. Elapsed={Elapsed}, Method=" + method + ", RequestId=" + + id + ", Status=Failed", + timingNanos); + throw ex instanceof RuntimeException re ? re : new RuntimeException(ex); }); } diff --git a/src/main/java/com/github/copilot/sdk/LoggingHelpers.java b/src/main/java/com/github/copilot/sdk/LoggingHelpers.java new file mode 100644 index 0000000000..654494ef13 --- /dev/null +++ b/src/main/java/com/github/copilot/sdk/LoggingHelpers.java @@ -0,0 +1,77 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk; + +import java.util.concurrent.TimeUnit; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * Internal helper for timing-based diagnostic logging. + */ +final class LoggingHelpers { + + private LoggingHelpers() { + // Utility class + } + + /** + * Formats elapsed time as a human-readable duration string. + * + * @param startNanos + * the start time from {@link System#nanoTime()} + * @return formatted duration (e.g. "PT0.123S") + */ + static String formatElapsed(long startNanos) { + long elapsedNanos = System.nanoTime() - startNanos; + long millis = TimeUnit.NANOSECONDS.toMillis(elapsedNanos); + return String.format("PT%d.%03dS", millis / 1000, millis % 1000); + } + + /** + * Logs a timing message at the given level if the logger accepts it. + * + * @param logger + * the logger to use + * @param level + * the log level + * @param message + * the message template + * @param startNanos + * the start time from {@link System#nanoTime()} + */ + static void logTiming(Logger logger, Level level, String message, long startNanos) { + if (!logger.isLoggable(level)) { + return; + } + logger.log(level, message.replace("{Elapsed}", formatElapsed(startNanos))); + } + + /** + * Logs a timing message at the given level with an exception. + * + * @param logger + * the logger to use + * @param level + * the log level + * @param exception + * the exception, may be {@code null} + * @param message + * the message template + * @param startNanos + * the start time from {@link System#nanoTime()} + */ + static void logTiming(Logger logger, Level level, Throwable exception, String message, long startNanos) { + if (!logger.isLoggable(level)) { + return; + } + String formatted = message.replace("{Elapsed}", formatElapsed(startNanos)); + if (exception != null) { + logger.log(level, formatted, exception); + } else { + logger.log(level, formatted); + } + } +} diff --git a/src/main/java/com/github/copilot/sdk/RpcHandlerDispatcher.java b/src/main/java/com/github/copilot/sdk/RpcHandlerDispatcher.java index d085f7fcec..1d76d8b88a 100644 --- a/src/main/java/com/github/copilot/sdk/RpcHandlerDispatcher.java +++ b/src/main/java/com/github/copilot/sdk/RpcHandlerDispatcher.java @@ -17,6 +17,8 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.copilot.sdk.generated.SessionEvent; +import com.github.copilot.sdk.json.AutoModeSwitchRequest; +import com.github.copilot.sdk.json.ExitPlanModeRequest; import com.github.copilot.sdk.json.PermissionRequestResult; import com.github.copilot.sdk.json.PermissionRequestResultKind; import com.github.copilot.sdk.json.SessionLifecycleEvent; @@ -79,6 +81,10 @@ void registerHandlers(JsonRpcClient rpc) { (requestId, params) -> handlePermissionRequest(rpc, requestId, params)); rpc.registerMethodHandler("userInput.request", (requestId, params) -> handleUserInputRequest(rpc, requestId, params)); + rpc.registerMethodHandler("exitPlanMode.request", + (requestId, params) -> handleExitPlanModeRequest(rpc, requestId, params)); + rpc.registerMethodHandler("autoModeSwitch.request", + (requestId, params) -> handleAutoModeSwitchRequest(rpc, requestId, params)); rpc.registerMethodHandler("hooks.invoke", (requestId, params) -> handleHooksInvoke(rpc, requestId, params)); rpc.registerMethodHandler("systemMessage.transform", (requestId, params) -> handleSystemMessageTransform(rpc, requestId, params)); @@ -125,6 +131,10 @@ private void handleLifecycleEvent(JsonNode params) { private void handleToolCall(JsonRpcClient rpc, String requestId, JsonNode params) { runAsync(() -> { + final long requestIdLong = parseRequestId(requestId, "tool.call"); + if (requestIdLong == -1) { + return; + } try { String sessionId = params.get("sessionId").asText(); String toolCallId = params.get("toolCallId").asText(); @@ -133,7 +143,7 @@ private void handleToolCall(JsonRpcClient rpc, String requestId, JsonNode params CopilotSession session = sessions.get(sessionId); if (session == null) { - rpc.sendErrorResponse(Long.parseLong(requestId), -32602, "Unknown session " + sessionId); + rpc.sendErrorResponse(requestIdLong, -32602, "Unknown session " + sessionId); return; } @@ -141,7 +151,7 @@ private void handleToolCall(JsonRpcClient rpc, String requestId, JsonNode params if (tool == null || tool.handler() == null) { var result = ToolResultObject.failure("Tool '" + toolName + "' is not supported.", "tool '" + toolName + "' not supported"); - rpc.sendResponse(Long.parseLong(requestId), Map.of("result", result)); + rpc.sendResponse(requestIdLong, Map.of("result", result)); return; } @@ -157,7 +167,7 @@ private void handleToolCall(JsonRpcClient rpc, String requestId, JsonNode params toolResult = ToolResultObject .success(result instanceof String s ? s : MAPPER.writeValueAsString(result)); } - rpc.sendResponse(Long.parseLong(requestId), Map.of("result", toolResult)); + rpc.sendResponse(requestIdLong, Map.of("result", toolResult)); } catch (Exception e) { LOG.log(Level.SEVERE, "Error sending tool result", e); } @@ -166,7 +176,7 @@ private void handleToolCall(JsonRpcClient rpc, String requestId, JsonNode params var result = ToolResultObject.failure( "Invoking this tool produced an error. Detailed information is not available.", ex.getMessage()); - rpc.sendResponse(Long.parseLong(requestId), Map.of("result", result)); + rpc.sendResponse(requestIdLong, Map.of("result", result)); } catch (Exception e) { LOG.log(Level.SEVERE, "Error sending tool error", e); } @@ -175,7 +185,7 @@ private void handleToolCall(JsonRpcClient rpc, String requestId, JsonNode params } catch (Exception e) { LOG.log(Level.SEVERE, "Error handling tool call", e); try { - rpc.sendErrorResponse(Long.parseLong(requestId), -32603, e.getMessage()); + rpc.sendErrorResponse(requestIdLong, -32603, e.getMessage()); } catch (IOException ioe) { LOG.log(Level.SEVERE, "Failed to send error response", ioe); } @@ -185,6 +195,10 @@ private void handleToolCall(JsonRpcClient rpc, String requestId, JsonNode params private void handlePermissionRequest(JsonRpcClient rpc, String requestId, JsonNode params) { runAsync(() -> { + final long requestIdLong = parseRequestId(requestId, "permission.request"); + if (requestIdLong == -1) { + return; + } try { String sessionId = params.get("sessionId").asText(); JsonNode permissionRequest = params.get("permissionRequest"); @@ -193,7 +207,7 @@ private void handlePermissionRequest(JsonRpcClient rpc, String requestId, JsonNo if (session == null) { var result = new PermissionRequestResult() .setKind(PermissionRequestResultKind.DENIED_COULD_NOT_REQUEST_FROM_USER); - rpc.sendResponse(Long.parseLong(requestId), Map.of("result", result)); + rpc.sendResponse(requestIdLong, Map.of("result", result)); return; } @@ -206,7 +220,7 @@ private void handlePermissionRequest(JsonRpcClient rpc, String requestId, JsonNo throw new IllegalStateException( "Permission handlers cannot return 'no-result' when connected to a protocol v2 server."); } - rpc.sendResponse(Long.parseLong(requestId), Map.of("result", result)); + rpc.sendResponse(requestIdLong, Map.of("result", result)); } catch (IOException e) { LOG.log(Level.SEVERE, "Error sending permission result", e); } @@ -214,7 +228,7 @@ private void handlePermissionRequest(JsonRpcClient rpc, String requestId, JsonNo try { var result = new PermissionRequestResult() .setKind(PermissionRequestResultKind.DENIED_COULD_NOT_REQUEST_FROM_USER); - rpc.sendResponse(Long.parseLong(requestId), Map.of("result", result)); + rpc.sendResponse(requestIdLong, Map.of("result", result)); } catch (IOException e) { LOG.log(Level.SEVERE, "Error sending permission denied", e); } @@ -229,6 +243,10 @@ private void handlePermissionRequest(JsonRpcClient rpc, String requestId, JsonNo private void handleUserInputRequest(JsonRpcClient rpc, String requestId, JsonNode params) { LOG.fine("Received userInput.request: " + params); runAsync(() -> { + final long requestIdLong = parseRequestId(requestId, "userInput.request"); + if (requestIdLong == -1) { + return; + } try { String sessionId = params.get("sessionId").asText(); String question = params.get("question").asText(); @@ -240,7 +258,7 @@ private void handleUserInputRequest(JsonRpcClient rpc, String requestId, JsonNod LOG.fine("Found session: " + (session != null)); if (session == null) { LOG.fine("Session not found, sending error"); - rpc.sendErrorResponse(Long.parseLong(requestId), -32602, "Unknown session " + sessionId); + rpc.sendErrorResponse(requestIdLong, -32602, "Unknown session " + sessionId); return; } @@ -262,7 +280,7 @@ private void handleUserInputRequest(JsonRpcClient rpc, String requestId, JsonNod String answer = response.getAnswer() != null ? response.getAnswer() : ""; LOG.fine("Sending userInput response: answer=" + answer + ", wasFreeform=" + response.isWasFreeform()); - rpc.sendResponse(Long.parseLong(requestId), + rpc.sendResponse(requestIdLong, Map.of("answer", answer, "wasFreeform", response.isWasFreeform())); } catch (IOException e) { LOG.log(Level.SEVERE, "Error sending user input response", e); @@ -270,8 +288,7 @@ private void handleUserInputRequest(JsonRpcClient rpc, String requestId, JsonNod }).exceptionally(ex -> { LOG.log(Level.WARNING, "User input handler exception", ex); try { - rpc.sendErrorResponse(Long.parseLong(requestId), -32603, - "User input handler error: " + ex.getMessage()); + rpc.sendErrorResponse(requestIdLong, -32603, "User input handler error: " + ex.getMessage()); } catch (IOException e) { LOG.log(Level.SEVERE, "Error sending user input error", e); } @@ -283,8 +300,110 @@ private void handleUserInputRequest(JsonRpcClient rpc, String requestId, JsonNod }); } + private void handleExitPlanModeRequest(JsonRpcClient rpc, String requestId, JsonNode params) { + runAsync(() -> { + final long requestIdLong = parseRequestId(requestId, "exitPlanMode.request"); + if (requestIdLong == -1) { + return; + } + try { + String sessionId = params.get("sessionId").asText(); + + CopilotSession session = sessions.get(sessionId); + if (session == null) { + rpc.sendErrorResponse(requestIdLong, -32602, "Unknown session " + sessionId); + return; + } + + var request = new ExitPlanModeRequest(); + if (params.has("summary")) { + request.setSummary(params.get("summary").asText()); + } + if (params.has("planContent") && !params.get("planContent").isNull()) { + request.setPlanContent(params.get("planContent").asText()); + } + if (params.has("actions") && params.get("actions").isArray()) { + var actions = new ArrayList(); + for (JsonNode action : params.get("actions")) { + actions.add(action.asText()); + } + request.setActions(actions); + } + if (params.has("recommendedAction") && !params.get("recommendedAction").isNull()) { + request.setRecommendedAction(params.get("recommendedAction").asText()); + } + + session.handleExitPlanModeRequest(request).thenAccept(result -> { + try { + rpc.sendResponse(requestIdLong, MAPPER.valueToTree(result)); + } catch (IOException e) { + LOG.log(Level.SEVERE, "Error sending exit plan mode response", e); + } + }).exceptionally(ex -> { + try { + rpc.sendErrorResponse(requestIdLong, -32603, + "Exit plan mode handler error: " + ex.getMessage()); + } catch (IOException e) { + LOG.log(Level.SEVERE, "Error sending exit plan mode error", e); + } + return null; + }); + } catch (Exception e) { + LOG.log(Level.SEVERE, "Error handling exit plan mode request", e); + } + }); + } + + private void handleAutoModeSwitchRequest(JsonRpcClient rpc, String requestId, JsonNode params) { + runAsync(() -> { + final long requestIdLong = parseRequestId(requestId, "autoModeSwitch.request"); + if (requestIdLong == -1) { + return; + } + try { + String sessionId = params.get("sessionId").asText(); + + CopilotSession session = sessions.get(sessionId); + if (session == null) { + rpc.sendErrorResponse(requestIdLong, -32602, "Unknown session " + sessionId); + return; + } + + var request = new AutoModeSwitchRequest(); + if (params.has("errorCode") && !params.get("errorCode").isNull()) { + request.setErrorCode(params.get("errorCode").asText()); + } + if (params.has("retryAfterSeconds") && !params.get("retryAfterSeconds").isNull()) { + request.setRetryAfterSeconds(params.get("retryAfterSeconds").asDouble()); + } + + session.handleAutoModeSwitchRequest(request).thenAccept(response -> { + try { + rpc.sendResponse(requestIdLong, Map.of("response", response)); + } catch (IOException e) { + LOG.log(Level.SEVERE, "Error sending auto mode switch response", e); + } + }).exceptionally(ex -> { + try { + rpc.sendErrorResponse(requestIdLong, -32603, + "Auto mode switch handler error: " + ex.getMessage()); + } catch (IOException e) { + LOG.log(Level.SEVERE, "Error sending auto mode switch error", e); + } + return null; + }); + } catch (Exception e) { + LOG.log(Level.SEVERE, "Error handling auto mode switch request", e); + } + }); + } + private void handleHooksInvoke(JsonRpcClient rpc, String requestId, JsonNode params) { runAsync(() -> { + final long requestIdLong = parseRequestId(requestId, "hooks.invoke"); + if (requestIdLong == -1) { + return; + } try { String sessionId = params.get("sessionId").asText(); String hookType = params.get("hookType").asText(); @@ -292,20 +411,19 @@ private void handleHooksInvoke(JsonRpcClient rpc, String requestId, JsonNode par CopilotSession session = sessions.get(sessionId); if (session == null) { - rpc.sendErrorResponse(Long.parseLong(requestId), -32602, "Unknown session " + sessionId); + rpc.sendErrorResponse(requestIdLong, -32602, "Unknown session " + sessionId); return; } session.handleHooksInvoke(hookType, input).thenAccept(output -> { try { - rpc.sendResponse(Long.parseLong(requestId), Collections.singletonMap("output", output)); + rpc.sendResponse(requestIdLong, Collections.singletonMap("output", output)); } catch (IOException e) { LOG.log(Level.SEVERE, "Error sending hooks response", e); } }).exceptionally(ex -> { try { - rpc.sendErrorResponse(Long.parseLong(requestId), -32603, - "Hooks handler error: " + ex.getMessage()); + rpc.sendErrorResponse(requestIdLong, -32603, "Hooks handler error: " + ex.getMessage()); } catch (IOException e) { LOG.log(Level.SEVERE, "Error sending hooks error", e); } @@ -328,15 +446,11 @@ interface LifecycleEventDispatcher { private void handleSystemMessageTransform(JsonRpcClient rpc, String requestId, JsonNode params) { runAsync(() -> { + final long requestIdLong = parseRequestId(requestId, "systemMessage.transform"); + if (requestIdLong == -1) { + return; + } try { - final long requestIdLong; - try { - requestIdLong = Long.parseLong(requestId); - } catch (NumberFormatException nfe) { - LOG.log(Level.SEVERE, "Invalid requestId for systemMessage.transform: " + requestId, nfe); - return; - } - String sessionId = params.has("sessionId") ? params.get("sessionId").asText() : null; JsonNode sections = params.get("sections"); @@ -366,6 +480,25 @@ private void handleSystemMessageTransform(JsonRpcClient rpc, String requestId, J }); } + /** + * Parses a JSON-RPC request ID string into a {@code long}. + * + * @param requestId + * the request ID string received from the JSON-RPC layer + * @param methodName + * the RPC method name, used in the log message on failure + * @return the parsed request ID, or {@code -1} if the string is not a valid + * long + */ + private static long parseRequestId(String requestId, String methodName) { + try { + return Long.parseLong(requestId); + } catch (NumberFormatException nfe) { + LOG.log(Level.SEVERE, "Invalid requestId for " + methodName + ": " + requestId, nfe); + return -1; + } + } + private void runAsync(Runnable task) { try { if (executor != null) { diff --git a/src/main/java/com/github/copilot/sdk/SessionRequestBuilder.java b/src/main/java/com/github/copilot/sdk/SessionRequestBuilder.java index f20b0a21fc..0cdc4f942b 100644 --- a/src/main/java/com/github/copilot/sdk/SessionRequestBuilder.java +++ b/src/main/java/com/github/copilot/sdk/SessionRequestBuilder.java @@ -111,19 +111,28 @@ static CreateSessionRequest buildCreateRequest(SessionConfig config, String sess request.setAvailableTools(config.getAvailableTools()); request.setExcludedTools(config.getExcludedTools()); request.setProvider(config.getProvider()); - request.setRequestUserInput(config.getOnUserInputRequest() != null ? true : null); - request.setHooks(config.getHooks() != null && config.getHooks().hasHooks() ? true : null); + config.getEnableSessionTelemetry().ifPresent(request::setEnableSessionTelemetry); + if (config.getOnUserInputRequest() != null) { + request.setRequestUserInput(true); + } + if (config.getHooks() != null && config.getHooks().hasHooks()) { + request.setHooks(true); + } request.setWorkingDirectory(config.getWorkingDirectory()); - request.setStreaming(config.isStreaming() ? true : null); - request.setIncludeSubAgentStreamingEvents(config.getIncludeSubAgentStreamingEvents()); + if (config.isStreaming()) { + request.setStreaming(true); + } + config.getIncludeSubAgentStreamingEvents().ifPresent(request::setIncludeSubAgentStreamingEvents); request.setMcpServers(config.getMcpServers()); request.setCustomAgents(config.getCustomAgents()); + request.setDefaultAgent(config.getDefaultAgent()); request.setAgent(config.getAgent()); request.setInfiniteSessions(config.getInfiniteSessions()); request.setSkillDirectories(config.getSkillDirectories()); + request.setInstructionDirectories(config.getInstructionDirectories()); request.setDisabledSkills(config.getDisabledSkills()); request.setConfigDir(config.getConfigDir()); - request.setEnableConfigDiscovery(config.getEnableConfigDiscovery()); + config.getEnableConfigDiscovery().ifPresent(request::setEnableConfigDiscovery); request.setModelCapabilities(config.getModelCapabilities()); if (config.getCommands() != null && !config.getCommands().isEmpty()) { @@ -135,6 +144,15 @@ static CreateSessionRequest buildCreateRequest(SessionConfig config, String sess if (config.getOnElicitationRequest() != null) { request.setRequestElicitation(true); } + if (config.getOnExitPlanMode() != null) { + request.setRequestExitPlanMode(true); + } + if (config.getOnAutoModeSwitch() != null) { + request.setRequestAutoModeSwitch(true); + } + request.setGitHubToken(config.getGitHubToken()); + request.setRemoteSession(config.getRemoteSession()); + request.setCloud(config.getCloud()); return request; } @@ -184,18 +202,29 @@ static ResumeSessionRequest buildResumeRequest(String sessionId, ResumeSessionCo request.setAvailableTools(config.getAvailableTools()); request.setExcludedTools(config.getExcludedTools()); request.setProvider(config.getProvider()); - request.setRequestUserInput(config.getOnUserInputRequest() != null ? true : null); - request.setHooks(config.getHooks() != null && config.getHooks().hasHooks() ? true : null); + config.getEnableSessionTelemetry().ifPresent(request::setEnableSessionTelemetry); + if (config.getOnUserInputRequest() != null) { + request.setRequestUserInput(true); + } + if (config.getHooks() != null && config.getHooks().hasHooks()) { + request.setHooks(true); + } request.setWorkingDirectory(config.getWorkingDirectory()); request.setConfigDir(config.getConfigDir()); - request.setEnableConfigDiscovery(config.getEnableConfigDiscovery()); - request.setDisableResume(config.isDisableResume() ? true : null); - request.setStreaming(config.isStreaming() ? true : null); - request.setIncludeSubAgentStreamingEvents(config.getIncludeSubAgentStreamingEvents()); + config.getEnableConfigDiscovery().ifPresent(request::setEnableConfigDiscovery); + if (config.isDisableResume()) { + request.setDisableResume(true); + } + if (config.isStreaming()) { + request.setStreaming(true); + } + config.getIncludeSubAgentStreamingEvents().ifPresent(request::setIncludeSubAgentStreamingEvents); request.setMcpServers(config.getMcpServers()); request.setCustomAgents(config.getCustomAgents()); + request.setDefaultAgent(config.getDefaultAgent()); request.setAgent(config.getAgent()); request.setSkillDirectories(config.getSkillDirectories()); + request.setInstructionDirectories(config.getInstructionDirectories()); request.setDisabledSkills(config.getDisabledSkills()); request.setInfiniteSessions(config.getInfiniteSessions()); request.setModelCapabilities(config.getModelCapabilities()); @@ -209,6 +238,14 @@ static ResumeSessionRequest buildResumeRequest(String sessionId, ResumeSessionCo if (config.getOnElicitationRequest() != null) { request.setRequestElicitation(true); } + if (config.getOnExitPlanMode() != null) { + request.setRequestExitPlanMode(true); + } + if (config.getOnAutoModeSwitch() != null) { + request.setRequestAutoModeSwitch(true); + } + request.setGitHubToken(config.getGitHubToken()); + request.setRemoteSession(config.getRemoteSession()); return request; } @@ -244,6 +281,12 @@ static void configureSession(CopilotSession session, SessionConfig config) { if (config.getOnElicitationRequest() != null) { session.registerElicitationHandler(config.getOnElicitationRequest()); } + if (config.getOnExitPlanMode() != null) { + session.registerExitPlanModeHandler(config.getOnExitPlanMode()); + } + if (config.getOnAutoModeSwitch() != null) { + session.registerAutoModeSwitchHandler(config.getOnAutoModeSwitch()); + } if (config.getOnEvent() != null) { session.on(config.getOnEvent()); } @@ -280,6 +323,12 @@ static void configureSession(CopilotSession session, ResumeSessionConfig config) if (config.getOnElicitationRequest() != null) { session.registerElicitationHandler(config.getOnElicitationRequest()); } + if (config.getOnExitPlanMode() != null) { + session.registerExitPlanModeHandler(config.getOnExitPlanMode()); + } + if (config.getOnAutoModeSwitch() != null) { + session.registerAutoModeSwitchHandler(config.getOnAutoModeSwitch()); + } if (config.getOnEvent() != null) { session.on(config.getOnEvent()); } diff --git a/src/main/java/com/github/copilot/sdk/json/AutoModeSwitchHandler.java b/src/main/java/com/github/copilot/sdk/json/AutoModeSwitchHandler.java new file mode 100644 index 0000000000..5fa19f4b1f --- /dev/null +++ b/src/main/java/com/github/copilot/sdk/json/AutoModeSwitchHandler.java @@ -0,0 +1,48 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk.json; + +import java.util.concurrent.CompletableFuture; + +/** + * Handler for auto-mode-switch requests from the agent. + *

+ * Register an auto-mode-switch handler via + * {@link SessionConfig#setOnAutoModeSwitch(AutoModeSwitchHandler)} or + * {@link ResumeSessionConfig#setOnAutoModeSwitch(AutoModeSwitchHandler)}. When + * provided, the server routes {@code autoModeSwitch.request} callbacks to this + * handler. + * + *

Example Usage

+ * + *
{@code
+ * AutoModeSwitchHandler handler = (request, invocation) -> {
+ * 	System.out.println("Rate limited: " + request.getErrorCode());
+ * 	return CompletableFuture.completedFuture(AutoModeSwitchResponse.YES);
+ * };
+ *
+ * var session = client.createSession(new SessionConfig().setOnAutoModeSwitch(handler)).get();
+ * }
+ * + * @see AutoModeSwitchRequest + * @see AutoModeSwitchResponse + * @since 1.0.8 + */ +@FunctionalInterface +public interface AutoModeSwitchHandler { + + /** + * Handles an auto-mode-switch request from the agent. + * + * @param request + * the auto-mode-switch request containing the error code and + * retry-after seconds + * @param invocation + * context information about the invocation + * @return a future that resolves with the user's decision + */ + CompletableFuture handle(AutoModeSwitchRequest request, + AutoModeSwitchInvocation invocation); +} diff --git a/src/main/java/com/github/copilot/sdk/json/AutoModeSwitchInvocation.java b/src/main/java/com/github/copilot/sdk/json/AutoModeSwitchInvocation.java new file mode 100644 index 0000000000..278d10ccfd --- /dev/null +++ b/src/main/java/com/github/copilot/sdk/json/AutoModeSwitchInvocation.java @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk.json; + +/** + * Context for an auto-mode-switch request invocation. + * + * @since 1.0.8 + */ +public class AutoModeSwitchInvocation { + + private String sessionId; + + /** + * Gets the session ID. + * + * @return the session ID + */ + public String getSessionId() { + return sessionId; + } + + /** + * Sets the session ID. + * + * @param sessionId + * the session ID + * @return this instance for method chaining + */ + public AutoModeSwitchInvocation setSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } +} diff --git a/src/main/java/com/github/copilot/sdk/json/AutoModeSwitchRequest.java b/src/main/java/com/github/copilot/sdk/json/AutoModeSwitchRequest.java new file mode 100644 index 0000000000..0ef784c02a --- /dev/null +++ b/src/main/java/com/github/copilot/sdk/json/AutoModeSwitchRequest.java @@ -0,0 +1,68 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk.json; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request to switch to auto mode after an eligible rate limit. + *

+ * This is sent by the server when the agent encounters a rate limit and wants + * to switch to an alternative model automatically. + * + * @since 1.0.8 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class AutoModeSwitchRequest { + + @JsonProperty("errorCode") + private String errorCode; + + @JsonProperty("retryAfterSeconds") + private Double retryAfterSeconds; + + /** + * Gets the rate-limit error code that triggered the request. + * + * @return the error code, or {@code null} + */ + public String getErrorCode() { + return errorCode; + } + + /** + * Sets the rate-limit error code. + * + * @param errorCode + * the error code + * @return this instance for method chaining + */ + public AutoModeSwitchRequest setErrorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Gets the seconds until the rate limit resets, when known. + * + * @return the retry-after seconds, or {@code null} + */ + public Double getRetryAfterSeconds() { + return retryAfterSeconds; + } + + /** + * Sets the seconds until the rate limit resets. + * + * @param retryAfterSeconds + * the retry-after seconds + * @return this instance for method chaining + */ + public AutoModeSwitchRequest setRetryAfterSeconds(Double retryAfterSeconds) { + this.retryAfterSeconds = retryAfterSeconds; + return this; + } +} diff --git a/src/main/java/com/github/copilot/sdk/json/AutoModeSwitchResponse.java b/src/main/java/com/github/copilot/sdk/json/AutoModeSwitchResponse.java new file mode 100644 index 0000000000..c072b73e2b --- /dev/null +++ b/src/main/java/com/github/copilot/sdk/json/AutoModeSwitchResponse.java @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk.json; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Response to an auto-mode-switch request. + * + * @since 1.0.8 + */ +public enum AutoModeSwitchResponse { + + /** Approve the switch for this rate-limit cycle. */ + YES("yes"), + + /** Approve and remember the choice for this session. */ + YES_ALWAYS("yes_always"), + + /** Decline the switch. */ + NO("no"); + + private final String value; + + AutoModeSwitchResponse(String value) { + this.value = value; + } + + /** + * Gets the wire value of this response. + * + * @return the string value + */ + @JsonValue + public String getValue() { + return value; + } +} diff --git a/src/main/java/com/github/copilot/sdk/json/CloudSessionOptions.java b/src/main/java/com/github/copilot/sdk/json/CloudSessionOptions.java new file mode 100644 index 0000000000..897d07edaf --- /dev/null +++ b/src/main/java/com/github/copilot/sdk/json/CloudSessionOptions.java @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk.json; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Options for creating a remote session in the cloud. + * + * @since 1.5.0 + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class CloudSessionOptions { + + @JsonProperty("repository") + private CloudSessionRepository repository; + + /** + * Gets the optional GitHub repository metadata to associate with the cloud + * session. + * + * @return the repository metadata, or {@code null} if not set + */ + public CloudSessionRepository getRepository() { + return repository; + } + + /** + * Sets the optional GitHub repository metadata to associate with the cloud + * session. + * + * @param repository + * the repository metadata + * @return this instance for method chaining + */ + public CloudSessionOptions setRepository(CloudSessionRepository repository) { + this.repository = repository; + return this; + } +} diff --git a/src/main/java/com/github/copilot/sdk/json/CloudSessionRepository.java b/src/main/java/com/github/copilot/sdk/json/CloudSessionRepository.java new file mode 100644 index 0000000000..5806c22cd7 --- /dev/null +++ b/src/main/java/com/github/copilot/sdk/json/CloudSessionRepository.java @@ -0,0 +1,89 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk.json; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * GitHub repository metadata to associate with a cloud session. + * + * @since 1.5.0 + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class CloudSessionRepository { + + @JsonProperty("owner") + private String owner; + + @JsonProperty("name") + private String name; + + @JsonProperty("branch") + private String branch; + + /** + * Gets the repository owner. + * + * @return the repository owner + */ + public String getOwner() { + return owner; + } + + /** + * Sets the repository owner. + * + * @param owner + * the repository owner + * @return this instance for method chaining + */ + public CloudSessionRepository setOwner(String owner) { + this.owner = owner; + return this; + } + + /** + * Gets the repository name. + * + * @return the repository name + */ + public String getName() { + return name; + } + + /** + * Sets the repository name. + * + * @param name + * the repository name + * @return this instance for method chaining + */ + public CloudSessionRepository setName(String name) { + this.name = name; + return this; + } + + /** + * Gets the optional branch name. + * + * @return the branch name, or {@code null} if not set + */ + public String getBranch() { + return branch; + } + + /** + * Sets the optional branch name. + * + * @param branch + * the branch name + * @return this instance for method chaining + */ + public CloudSessionRepository setBranch(String branch) { + this.branch = branch; + return this; + } +} diff --git a/src/main/java/com/github/copilot/sdk/json/CopilotClientOptions.java b/src/main/java/com/github/copilot/sdk/json/CopilotClientOptions.java index 2e9a804563..e4605ffe10 100644 --- a/src/main/java/com/github/copilot/sdk/json/CopilotClientOptions.java +++ b/src/main/java/com/github/copilot/sdk/json/CopilotClientOptions.java @@ -14,6 +14,9 @@ import java.util.function.Supplier; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Optional; +import java.util.OptionalInt; /** * Configuration options for creating a @@ -44,6 +47,7 @@ public class CopilotClientOptions { private String[] cliArgs; private String cliPath; private String cliUrl; + private String copilotHome; private String cwd; private Map environment; private Executor executor; @@ -52,6 +56,9 @@ public class CopilotClientOptions { private Supplier>> onListModels; private int port; private TelemetryConfig telemetry; + private Integer sessionIdleTimeoutSeconds; + private boolean remote; + private String tcpConnectionToken; private Boolean useLoggedInUser; private boolean useStdio = true; @@ -190,6 +197,37 @@ public CopilotClientOptions setCliUrl(String cliUrl) { return this; } + /** + * Gets the base directory for Copilot data (session state, config, etc.). + * + * @return the Copilot home directory path, or {@code null} to use the CLI + * default ({@code ~/.copilot}) + */ + public String getCopilotHome() { + return copilotHome; + } + + /** + * Sets the base directory for Copilot data (session state, config, etc.). + *

+ * Sets the {@code COPILOT_HOME} environment variable on the spawned CLI + * process. When {@code null}, the {@code COPILOT_HOME} env var is not set on + * the spawned process, so the CLI falls back to its default + * ({@code ~/.copilot}). + *

+ * This option is only used when the SDK spawns the CLI process; it is ignored + * when connecting to an external server via {@link #setCliUrl(String)}. + * + * @param copilotHome + * the Copilot home directory path, or {@code null} to use the CLI + * default + * @return this options instance for method chaining + */ + public CopilotClientOptions setCopilotHome(String copilotHome) { + this.copilotHome = copilotHome; + return this; + } + /** * Gets the working directory for the CLI process. * @@ -404,6 +442,37 @@ public CopilotClientOptions setPort(int port) { return this; } + /** + * Returns whether remote session support (Mission Control integration) is + * enabled. + *

+ * When {@code true}, sessions in a GitHub repository working directory are + * accessible from GitHub web and mobile. + * + * @return {@code true} if remote sessions are enabled + */ + public boolean isRemote() { + return remote; + } + + /** + * Enables remote session support (Mission Control integration). + *

+ * When {@code true}, sessions in a GitHub repository working directory are + * accessible from GitHub web and mobile. + *

+ * This option is only used when the SDK spawns the CLI process; it is ignored + * when connecting to an external server via {@link #setCliUrl(String)}. + * + * @param remote + * {@code true} to enable remote sessions + * @return this options instance for method chaining + */ + public CopilotClientOptions setRemote(boolean remote) { + this.remote = remote; + return this; + } + /** * Gets the OpenTelemetry configuration for the CLI server. * @@ -430,14 +499,83 @@ public CopilotClientOptions setTelemetry(TelemetryConfig telemetry) { return this; } + /** + * Gets the server-wide idle timeout for sessions in seconds. + * + * @return an {@link OptionalInt} containing the session idle timeout in + * seconds, or {@link java.util.OptionalInt#empty()} if not set. Use + * {@link #clearSessionIdleTimeoutSeconds()} to revert to the default. + * @since 1.3.0 + */ + @JsonIgnore + public OptionalInt getSessionIdleTimeoutSeconds() { + return sessionIdleTimeoutSeconds == null ? OptionalInt.empty() : OptionalInt.of(sessionIdleTimeoutSeconds); + } + + /** + * Sets the server-wide idle timeout for sessions in seconds. + *

+ * Sessions without activity for this duration are automatically cleaned up. Set + * to {@code 0} to disable (sessions live indefinitely). Use + * {@link #clearSessionIdleTimeoutSeconds()} to revert to the default. + *

+ * This option is only used when the SDK spawns the CLI process; it is ignored + * when connecting to an external server via {@link #setCliUrl(String)}. + * + * @param sessionIdleTimeoutSeconds + * the idle timeout in seconds + * @return this options instance for method chaining + * @since 1.3.0 + */ + public CopilotClientOptions setSessionIdleTimeoutSeconds(int sessionIdleTimeoutSeconds) { + this.sessionIdleTimeoutSeconds = sessionIdleTimeoutSeconds; + return this; + } + + /** + * Clears the sessionIdleTimeoutSeconds setting, reverting to the default + * behavior. + * + * @return this instance for method chaining + */ + public CopilotClientOptions clearSessionIdleTimeoutSeconds() { + this.sessionIdleTimeoutSeconds = null; + return this; + } + + /** + * Gets the connection token for the headless CLI server (TCP only). + * + * @return the connection token, or {@code null} if not set + */ + public String getTcpConnectionToken() { + return tcpConnectionToken; + } + + /** + * Sets the connection token for the headless CLI server (TCP only). + *

+ * When the SDK spawns its own CLI in TCP mode and this is omitted, a UUID is + * generated automatically so the loopback listener is safe by default. Cannot + * be combined with {@link #setUseStdio(boolean)} = {@code true}. + * + * @param tcpConnectionToken + * the connection token (must not be {@code null} or empty) + * @return this options instance for method chaining + */ + public CopilotClientOptions setTcpConnectionToken(String tcpConnectionToken) { + this.tcpConnectionToken = Objects.requireNonNull(tcpConnectionToken, "tcpConnectionToken must not be null"); + return this; + } + /** * Returns whether to use the logged-in user for authentication. * - * @return {@code true} to use logged-in user auth, {@code false} to use only - * explicit tokens, or {@code null} to use default behavior + * @return an {@link Optional} containing the boolean value, or empty if not set */ - public Boolean getUseLoggedInUser() { - return useLoggedInUser; + @JsonIgnore + public Optional getUseLoggedInUser() { + return Optional.ofNullable(useLoggedInUser); } /** @@ -447,15 +585,23 @@ public Boolean getUseLoggedInUser() { * auth. When false, only explicit tokens (gitHubToken or environment variables) * are used. Default: true (but defaults to false when gitHubToken is provided). *

- * Passing {@code null} is equivalent to passing {@link Boolean#FALSE}. * * @param useLoggedInUser - * {@code true} to use logged-in user auth, {@code false} or - * {@code null} otherwise + * {@code true} to use logged-in user auth, {@code false} otherwise * @return this options instance for method chaining */ - public CopilotClientOptions setUseLoggedInUser(Boolean useLoggedInUser) { - this.useLoggedInUser = useLoggedInUser != null ? useLoggedInUser : Boolean.FALSE; + public CopilotClientOptions setUseLoggedInUser(boolean useLoggedInUser) { + this.useLoggedInUser = useLoggedInUser; + return this; + } + + /** + * Clears the useLoggedInUser setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public CopilotClientOptions clearUseLoggedInUser() { + this.useLoggedInUser = null; return this; } @@ -501,6 +647,7 @@ public CopilotClientOptions clone() { copy.cliArgs = this.cliArgs != null ? this.cliArgs.clone() : null; copy.cliPath = this.cliPath; copy.cliUrl = this.cliUrl; + copy.copilotHome = this.copilotHome; copy.cwd = this.cwd; copy.environment = this.environment != null ? new java.util.HashMap<>(this.environment) : null; copy.executor = this.executor; @@ -508,6 +655,9 @@ public CopilotClientOptions clone() { copy.logLevel = this.logLevel; copy.onListModels = this.onListModels; copy.port = this.port; + copy.remote = this.remote; + copy.sessionIdleTimeoutSeconds = this.sessionIdleTimeoutSeconds; + copy.tcpConnectionToken = this.tcpConnectionToken; copy.telemetry = this.telemetry; copy.useLoggedInUser = this.useLoggedInUser; copy.useStdio = this.useStdio; diff --git a/src/main/java/com/github/copilot/sdk/json/CreateSessionRequest.java b/src/main/java/com/github/copilot/sdk/json/CreateSessionRequest.java index 25e777d1ae..881840a736 100644 --- a/src/main/java/com/github/copilot/sdk/json/CreateSessionRequest.java +++ b/src/main/java/com/github/copilot/sdk/json/CreateSessionRequest.java @@ -52,6 +52,9 @@ public final class CreateSessionRequest { @JsonProperty("provider") private ProviderConfig provider; + @JsonProperty("enableSessionTelemetry") + private Boolean enableSessionTelemetry; + @JsonProperty("requestPermission") private Boolean requestPermission; @@ -79,6 +82,9 @@ public final class CreateSessionRequest { @JsonProperty("customAgents") private List customAgents; + @JsonProperty("defaultAgent") + private DefaultAgentConfig defaultAgent; + @JsonProperty("agent") private String agent; @@ -88,6 +94,9 @@ public final class CreateSessionRequest { @JsonProperty("skillDirectories") private List skillDirectories; + @JsonProperty("instructionDirectories") + private List instructionDirectories; + @JsonProperty("disabledSkills") private List disabledSkills; @@ -103,9 +112,24 @@ public final class CreateSessionRequest { @JsonProperty("requestElicitation") private Boolean requestElicitation; + @JsonProperty("requestExitPlanMode") + private Boolean requestExitPlanMode; + + @JsonProperty("requestAutoModeSwitch") + private Boolean requestAutoModeSwitch; + @JsonProperty("modelCapabilities") private ModelCapabilitiesOverride modelCapabilities; + @JsonProperty("gitHubToken") + private String gitHubToken; + + @JsonProperty("remoteSession") + private String remoteSession; + + @JsonProperty("cloud") + private CloudSessionOptions cloud; + /** Gets the model name. @return the model */ public String getModel() { return model; @@ -198,36 +222,76 @@ public void setProvider(ProviderConfig provider) { this.provider = provider; } + /** Gets enable session telemetry flag. @return the flag */ + public Boolean getEnableSessionTelemetry() { + return enableSessionTelemetry; + } + + /** + * Sets enable session telemetry flag. @param enableSessionTelemetry the flag + */ + public void setEnableSessionTelemetry(boolean enableSessionTelemetry) { + this.enableSessionTelemetry = enableSessionTelemetry; + } + + /** + * Clears the enableSessionTelemetry setting, reverting to the default behavior. + */ + public void clearEnableSessionTelemetry() { + this.enableSessionTelemetry = null; + } + /** Gets request permission flag. @return the flag */ public Boolean getRequestPermission() { return requestPermission; } /** Sets request permission flag. @param requestPermission the flag */ - public void setRequestPermission(Boolean requestPermission) { + public void setRequestPermission(boolean requestPermission) { this.requestPermission = requestPermission; } + /** + * Clears the requestPermission setting, reverting to the default behavior. + */ + public void clearRequestPermission() { + this.requestPermission = null; + } + /** Gets request user input flag. @return the flag */ public Boolean getRequestUserInput() { return requestUserInput; } /** Sets request user input flag. @param requestUserInput the flag */ - public void setRequestUserInput(Boolean requestUserInput) { + public void setRequestUserInput(boolean requestUserInput) { this.requestUserInput = requestUserInput; } + /** + * Clears the requestUserInput setting, reverting to the default behavior. + */ + public void clearRequestUserInput() { + this.requestUserInput = null; + } + /** Gets hooks flag. @return the flag */ public Boolean getHooks() { return hooks; } /** Sets hooks flag. @param hooks the flag */ - public void setHooks(Boolean hooks) { + public void setHooks(boolean hooks) { this.hooks = hooks; } + /** + * Clears the hooks setting, reverting to the default behavior. + */ + public void clearHooks() { + this.hooks = null; + } + /** Gets working directory. @return the working directory */ public String getWorkingDirectory() { return workingDirectory; @@ -244,10 +308,17 @@ public Boolean getStreaming() { } /** Sets streaming flag. @param streaming the flag */ - public void setStreaming(Boolean streaming) { + public void setStreaming(boolean streaming) { this.streaming = streaming; } + /** + * Clears the streaming setting, reverting to the default behavior. + */ + public void clearStreaming() { + this.streaming = null; + } + /** Gets MCP servers. @return the servers map */ public Map getMcpServers() { return mcpServers == null ? null : Collections.unmodifiableMap(mcpServers); @@ -278,6 +349,18 @@ public void setCustomAgents(List customAgents) { this.customAgents = customAgents; } + /** Gets the default agent config. @return the default agent config */ + public DefaultAgentConfig getDefaultAgent() { + return defaultAgent; + } + + /** + * Sets the default agent config. @param defaultAgent the default agent config + */ + public void setDefaultAgent(DefaultAgentConfig defaultAgent) { + this.defaultAgent = defaultAgent; + } + /** Gets the pre-selected agent name. @return the agent name */ public String getAgent() { return agent; @@ -308,6 +391,18 @@ public void setSkillDirectories(List skillDirectories) { this.skillDirectories = skillDirectories; } + /** Gets instruction directories. @return the instruction directories */ + public List getInstructionDirectories() { + return instructionDirectories == null ? null : Collections.unmodifiableList(instructionDirectories); + } + + /** + * Sets instruction directories. @param instructionDirectories the directories + */ + public void setInstructionDirectories(List instructionDirectories) { + this.instructionDirectories = instructionDirectories; + } + /** Gets disabled skills. @return the disabled skill names */ public List getDisabledSkills() { return disabledSkills == null ? null : Collections.unmodifiableList(disabledSkills); @@ -334,10 +429,17 @@ public Boolean getEnableConfigDiscovery() { } /** Sets enable config discovery flag. @param enableConfigDiscovery the flag */ - public void setEnableConfigDiscovery(Boolean enableConfigDiscovery) { + public void setEnableConfigDiscovery(boolean enableConfigDiscovery) { this.enableConfigDiscovery = enableConfigDiscovery; } + /** + * Clears the enableConfigDiscovery setting, reverting to the default behavior. + */ + public void clearEnableConfigDiscovery() { + this.enableConfigDiscovery = null; + } + /** Gets include sub-agent streaming events flag. @return the flag */ public Boolean getIncludeSubAgentStreamingEvents() { return includeSubAgentStreamingEvents; @@ -347,10 +449,18 @@ public Boolean getIncludeSubAgentStreamingEvents() { * Sets include sub-agent streaming events flag. @param * includeSubAgentStreamingEvents the flag */ - public void setIncludeSubAgentStreamingEvents(Boolean includeSubAgentStreamingEvents) { + public void setIncludeSubAgentStreamingEvents(boolean includeSubAgentStreamingEvents) { this.includeSubAgentStreamingEvents = includeSubAgentStreamingEvents; } + /** + * Clears the includeSubAgentStreamingEvents setting, reverting to the default + * behavior. + */ + public void clearIncludeSubAgentStreamingEvents() { + this.includeSubAgentStreamingEvents = null; + } + /** Gets the commands wire definitions. @return the commands */ public List getCommands() { return commands == null ? null : Collections.unmodifiableList(commands); @@ -367,10 +477,39 @@ public Boolean getRequestElicitation() { } /** Sets the requestElicitation flag. @param requestElicitation the flag */ - public void setRequestElicitation(Boolean requestElicitation) { + public void setRequestElicitation(boolean requestElicitation) { this.requestElicitation = requestElicitation; } + /** + * Clears the requestElicitation setting, reverting to the default behavior. + */ + public void clearRequestElicitation() { + this.requestElicitation = null; + } + + /** Gets the requestExitPlanMode flag. @return the flag */ + public Boolean getRequestExitPlanMode() { + return requestExitPlanMode; + } + + /** Sets the requestExitPlanMode flag. @param requestExitPlanMode the flag */ + public void setRequestExitPlanMode(Boolean requestExitPlanMode) { + this.requestExitPlanMode = requestExitPlanMode; + } + + /** Gets the requestAutoModeSwitch flag. @return the flag */ + public Boolean getRequestAutoModeSwitch() { + return requestAutoModeSwitch; + } + + /** + * Sets the requestAutoModeSwitch flag. @param requestAutoModeSwitch the flag + */ + public void setRequestAutoModeSwitch(Boolean requestAutoModeSwitch) { + this.requestAutoModeSwitch = requestAutoModeSwitch; + } + /** Gets the model capabilities override. @return the override */ public ModelCapabilitiesOverride getModelCapabilities() { return modelCapabilities; @@ -382,4 +521,39 @@ public ModelCapabilitiesOverride getModelCapabilities() { public void setModelCapabilities(ModelCapabilitiesOverride modelCapabilities) { this.modelCapabilities = modelCapabilities; } + + /** Gets the GitHub token for per-session authentication. @return the token */ + public String getGitHubToken() { + return gitHubToken; + } + + /** + * Sets the GitHub token for per-session authentication. @param gitHubToken the + * token + */ + public void setGitHubToken(String gitHubToken) { + this.gitHubToken = gitHubToken; + } + + /** Gets the remote session mode. @return the remote session mode */ + public String getRemoteSession() { + return remoteSession; + } + + /** + * Sets the remote session mode. @param remoteSession the remote session mode + */ + public void setRemoteSession(String remoteSession) { + this.remoteSession = remoteSession; + } + + /** Gets the cloud session options. @return the cloud session options */ + public CloudSessionOptions getCloud() { + return cloud; + } + + /** Sets the cloud session options. @param cloud the cloud session options */ + public void setCloud(CloudSessionOptions cloud) { + this.cloud = cloud; + } } diff --git a/src/main/java/com/github/copilot/sdk/json/CustomAgentConfig.java b/src/main/java/com/github/copilot/sdk/json/CustomAgentConfig.java index 1421db603f..cb2dbf452b 100644 --- a/src/main/java/com/github/copilot/sdk/json/CustomAgentConfig.java +++ b/src/main/java/com/github/copilot/sdk/json/CustomAgentConfig.java @@ -10,6 +10,8 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Optional; /** * Configuration for a custom agent in a Copilot session. @@ -58,6 +60,9 @@ public class CustomAgentConfig { @JsonProperty("skills") private List skills; + @JsonProperty("model") + private String model; + /** * Gets the unique identifier name for this agent. * @@ -197,10 +202,12 @@ public CustomAgentConfig setMcpServers(Map mcpServers) /** * Gets whether inference mode is enabled. * - * @return the infer flag, or {@code null} if not set + * @return an {@link java.util.Optional} containing the infer flag, or + * {@link java.util.Optional#empty()} if not set */ - public Boolean getInfer() { - return infer; + @JsonIgnore + public Optional getInfer() { + return Optional.ofNullable(infer); } /** @@ -210,11 +217,21 @@ public Boolean getInfer() { * {@code true} to enable inference mode * @return this config for method chaining */ - public CustomAgentConfig setInfer(Boolean infer) { + public CustomAgentConfig setInfer(boolean infer) { this.infer = infer; return this; } + /** + * Clears the infer setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public CustomAgentConfig clearInfer() { + this.infer = null; + return this; + } + /** * Gets the list of skill names to preload into this agent's context. * @@ -241,4 +258,28 @@ public CustomAgentConfig setSkills(List skills) { this.skills = skills; return this; } + + /** + * Gets the model identifier for this agent. + * + * @return the model identifier, or {@code null} if not set + */ + public String getModel() { + return model; + } + + /** + * Sets the model identifier for this agent. + *

+ * When set, the runtime will attempt to use this model for the agent, falling + * back to the parent session model if unavailable. + * + * @param model + * the model identifier (e.g., "claude-haiku-4.5") + * @return this config for method chaining + */ + public CustomAgentConfig setModel(String model) { + this.model = model; + return this; + } } diff --git a/src/main/java/com/github/copilot/sdk/json/DefaultAgentConfig.java b/src/main/java/com/github/copilot/sdk/json/DefaultAgentConfig.java new file mode 100644 index 0000000000..88f39ecff9 --- /dev/null +++ b/src/main/java/com/github/copilot/sdk/json/DefaultAgentConfig.java @@ -0,0 +1,59 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk.json; + +import java.util.Collections; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Configuration for the default agent (the built-in agent that handles turns + * when no custom agent is selected). + *

+ * Use {@link #setExcludedTools(List)} to hide specific tools from the default + * agent while keeping them available to custom sub-agents. + * + *

Example Usage

+ * + *
{@code
+ * var config = new SessionConfig().setTools(List.of(secretTool))
+ * 		.setDefaultAgent(new DefaultAgentConfig().setExcludedTools(List.of("secret_tool")));
+ * }
+ * + * @see SessionConfig#setDefaultAgent(DefaultAgentConfig) + * @since 1.3.0 + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class DefaultAgentConfig { + + @JsonProperty("excludedTools") + private List excludedTools; + + /** + * Gets the list of tool names excluded from the default agent. + * + * @return the list of excluded tool names, or {@code null} if not set + */ + public List getExcludedTools() { + return excludedTools == null ? null : Collections.unmodifiableList(excludedTools); + } + + /** + * Sets the list of tool names to exclude from the default agent. + *

+ * These tools remain available to custom sub-agents that reference them in + * their {@link CustomAgentConfig#setTools(List)} list. + * + * @param excludedTools + * the list of tool names to exclude from the default agent + * @return this config for method chaining + */ + public DefaultAgentConfig setExcludedTools(List excludedTools) { + this.excludedTools = excludedTools; + return this; + } +} diff --git a/src/main/java/com/github/copilot/sdk/json/ExitPlanModeHandler.java b/src/main/java/com/github/copilot/sdk/json/ExitPlanModeHandler.java new file mode 100644 index 0000000000..13ecbe075c --- /dev/null +++ b/src/main/java/com/github/copilot/sdk/json/ExitPlanModeHandler.java @@ -0,0 +1,48 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk.json; + +import java.util.concurrent.CompletableFuture; + +/** + * Handler for exit-plan-mode requests from the agent. + *

+ * Register an exit-plan-mode handler via + * {@link SessionConfig#setOnExitPlanMode(ExitPlanModeHandler)} or + * {@link ResumeSessionConfig#setOnExitPlanMode(ExitPlanModeHandler)}. When + * provided, the server routes {@code exitPlanMode.request} callbacks to this + * handler. + * + *

Example Usage

+ * + *
{@code
+ * ExitPlanModeHandler handler = (request, invocation) -> {
+ * 	// Review the plan and decide whether to approve
+ * 	return CompletableFuture
+ * 			.completedFuture(new ExitPlanModeResult().setApproved(true).setSelectedAction("interactive"));
+ * };
+ *
+ * var session = client.createSession(new SessionConfig().setOnExitPlanMode(handler)).get();
+ * }
+ * + * @see ExitPlanModeRequest + * @see ExitPlanModeResult + * @since 1.0.8 + */ +@FunctionalInterface +public interface ExitPlanModeHandler { + + /** + * Handles an exit-plan-mode request from the agent. + * + * @param request + * the exit-plan-mode request containing the summary, plan content, + * and available actions + * @param invocation + * context information about the invocation + * @return a future that resolves with the user's decision + */ + CompletableFuture handle(ExitPlanModeRequest request, ExitPlanModeInvocation invocation); +} diff --git a/src/main/java/com/github/copilot/sdk/json/ExitPlanModeInvocation.java b/src/main/java/com/github/copilot/sdk/json/ExitPlanModeInvocation.java new file mode 100644 index 0000000000..6fd0231266 --- /dev/null +++ b/src/main/java/com/github/copilot/sdk/json/ExitPlanModeInvocation.java @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk.json; + +/** + * Context for an exit-plan-mode request invocation. + * + * @since 1.0.8 + */ +public class ExitPlanModeInvocation { + + private String sessionId; + + /** + * Gets the session ID. + * + * @return the session ID + */ + public String getSessionId() { + return sessionId; + } + + /** + * Sets the session ID. + * + * @param sessionId + * the session ID + * @return this instance for method chaining + */ + public ExitPlanModeInvocation setSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } +} diff --git a/src/main/java/com/github/copilot/sdk/json/ExitPlanModeRequest.java b/src/main/java/com/github/copilot/sdk/json/ExitPlanModeRequest.java new file mode 100644 index 0000000000..be09350ef3 --- /dev/null +++ b/src/main/java/com/github/copilot/sdk/json/ExitPlanModeRequest.java @@ -0,0 +1,119 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk.json; + +import java.util.Collections; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request to exit plan mode and continue with a selected action. + *

+ * This is sent by the server when the agent wants to exit plan mode and + * requests user confirmation. + * + * @since 1.0.8 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class ExitPlanModeRequest { + + @JsonProperty("summary") + private String summary = ""; + + @JsonProperty("planContent") + private String planContent; + + @JsonProperty("actions") + private List actions; + + @JsonProperty("recommendedAction") + private String recommendedAction = "autopilot"; + + /** + * Gets the summary of the plan or proposed next step. + * + * @return the summary + */ + public String getSummary() { + return summary; + } + + /** + * Sets the summary of the plan or proposed next step. + * + * @param summary + * the summary + * @return this instance for method chaining + */ + public ExitPlanModeRequest setSummary(String summary) { + this.summary = summary; + return this; + } + + /** + * Gets the full plan content, when available. + * + * @return the plan content, or {@code null} if not available + */ + public String getPlanContent() { + return planContent; + } + + /** + * Sets the full plan content. + * + * @param planContent + * the plan content + * @return this instance for method chaining + */ + public ExitPlanModeRequest setPlanContent(String planContent) { + this.planContent = planContent; + return this; + } + + /** + * Gets the available actions the user can select. + * + * @return the list of actions, or {@code null} if not specified + */ + public List getActions() { + return actions == null ? null : Collections.unmodifiableList(actions); + } + + /** + * Sets the available actions the user can select. + * + * @param actions + * the list of actions + * @return this instance for method chaining + */ + public ExitPlanModeRequest setActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Gets the action recommended by the runtime. + * + * @return the recommended action + */ + public String getRecommendedAction() { + return recommendedAction; + } + + /** + * Sets the action recommended by the runtime. + * + * @param recommendedAction + * the recommended action + * @return this instance for method chaining + */ + public ExitPlanModeRequest setRecommendedAction(String recommendedAction) { + this.recommendedAction = recommendedAction; + return this; + } +} diff --git a/src/main/java/com/github/copilot/sdk/json/ExitPlanModeResult.java b/src/main/java/com/github/copilot/sdk/json/ExitPlanModeResult.java new file mode 100644 index 0000000000..876e750b46 --- /dev/null +++ b/src/main/java/com/github/copilot/sdk/json/ExitPlanModeResult.java @@ -0,0 +1,87 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk.json; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Response to an exit-plan-mode request. + * + * @since 1.0.8 + */ +public class ExitPlanModeResult { + + @JsonProperty("approved") + private boolean approved = true; + + @JsonProperty("selectedAction") + private String selectedAction; + + @JsonProperty("feedback") + private String feedback; + + /** + * Returns whether the user approved exiting plan mode. + * + * @return {@code true} if approved + */ + public boolean isApproved() { + return approved; + } + + /** + * Sets whether the user approved exiting plan mode. + * + * @param approved + * {@code true} if approved + * @return this instance for method chaining + */ + public ExitPlanModeResult setApproved(boolean approved) { + this.approved = approved; + return this; + } + + /** + * Gets the selected action, if the user chose one. + * + * @return the selected action, or {@code null} + */ + public String getSelectedAction() { + return selectedAction; + } + + /** + * Sets the selected action. + * + * @param selectedAction + * the selected action + * @return this instance for method chaining + */ + public ExitPlanModeResult setSelectedAction(String selectedAction) { + this.selectedAction = selectedAction; + return this; + } + + /** + * Gets optional feedback provided by the user. + * + * @return the feedback, or {@code null} + */ + public String getFeedback() { + return feedback; + } + + /** + * Sets feedback from the user. + * + * @param feedback + * the feedback text + * @return this instance for method chaining + */ + public ExitPlanModeResult setFeedback(String feedback) { + this.feedback = feedback; + return this; + } +} diff --git a/src/main/java/com/github/copilot/sdk/json/InfiniteSessionConfig.java b/src/main/java/com/github/copilot/sdk/json/InfiniteSessionConfig.java index d45851f8a1..561796ede7 100644 --- a/src/main/java/com/github/copilot/sdk/json/InfiniteSessionConfig.java +++ b/src/main/java/com/github/copilot/sdk/json/InfiniteSessionConfig.java @@ -6,6 +6,9 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Optional; +import java.util.OptionalDouble; /** * Configuration for infinite sessions with automatic context compaction and @@ -43,10 +46,12 @@ public class InfiniteSessionConfig { /** * Gets whether infinite sessions are enabled. * - * @return {@code true} if enabled, {@code null} to use default (true) + * @return an {@link Optional} containing the boolean value, or empty to use + * default (true) */ - public Boolean getEnabled() { - return enabled; + @JsonIgnore + public Optional getEnabled() { + return Optional.ofNullable(enabled); } /** @@ -58,18 +63,32 @@ public Boolean getEnabled() { * {@code true} to enable infinite sessions * @return this config instance for method chaining */ - public InfiniteSessionConfig setEnabled(Boolean enabled) { + public InfiniteSessionConfig setEnabled(boolean enabled) { this.enabled = enabled; return this; } + /** + * Clears the enabled setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public InfiniteSessionConfig clearEnabled() { + this.enabled = null; + return this; + } + /** * Gets the background compaction threshold. * - * @return the threshold (0.0-1.0), or {@code null} to use default + * @return an {@link OptionalDouble} containing the threshold (0.0-1.0), or + * empty to use default */ - public Double getBackgroundCompactionThreshold() { - return backgroundCompactionThreshold; + @JsonIgnore + public OptionalDouble getBackgroundCompactionThreshold() { + return backgroundCompactionThreshold == null + ? OptionalDouble.empty() + : OptionalDouble.of(backgroundCompactionThreshold); } /** @@ -82,18 +101,33 @@ public Double getBackgroundCompactionThreshold() { * the threshold (0.0-1.0) * @return this config instance for method chaining */ - public InfiniteSessionConfig setBackgroundCompactionThreshold(Double backgroundCompactionThreshold) { + public InfiniteSessionConfig setBackgroundCompactionThreshold(double backgroundCompactionThreshold) { this.backgroundCompactionThreshold = backgroundCompactionThreshold; return this; } + /** + * Clears the backgroundCompactionThreshold setting, reverting to the default + * behavior. + * + * @return this instance for method chaining + */ + public InfiniteSessionConfig clearBackgroundCompactionThreshold() { + this.backgroundCompactionThreshold = null; + return this; + } + /** * Gets the buffer exhaustion threshold. * - * @return the threshold (0.0-1.0), or {@code null} to use default + * @return an {@link OptionalDouble} containing the threshold (0.0-1.0), or + * empty to use default */ - public Double getBufferExhaustionThreshold() { - return bufferExhaustionThreshold; + @JsonIgnore + public OptionalDouble getBufferExhaustionThreshold() { + return bufferExhaustionThreshold == null + ? OptionalDouble.empty() + : OptionalDouble.of(bufferExhaustionThreshold); } /** @@ -107,8 +141,20 @@ public Double getBufferExhaustionThreshold() { * the threshold (0.0-1.0) * @return this config instance for method chaining */ - public InfiniteSessionConfig setBufferExhaustionThreshold(Double bufferExhaustionThreshold) { + public InfiniteSessionConfig setBufferExhaustionThreshold(double bufferExhaustionThreshold) { this.bufferExhaustionThreshold = bufferExhaustionThreshold; return this; } + + /** + * Clears the bufferExhaustionThreshold setting, reverting to the default + * behavior. + * + * @return this instance for method chaining + */ + public InfiniteSessionConfig clearBufferExhaustionThreshold() { + this.bufferExhaustionThreshold = null; + return this; + } + } diff --git a/src/main/java/com/github/copilot/sdk/json/InputOptions.java b/src/main/java/com/github/copilot/sdk/json/InputOptions.java index 9b0b6c8dd8..ca1cc5d385 100644 --- a/src/main/java/com/github/copilot/sdk/json/InputOptions.java +++ b/src/main/java/com/github/copilot/sdk/json/InputOptions.java @@ -4,17 +4,25 @@ package com.github.copilot.sdk.json; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.OptionalInt; + /** * Options for the {@link SessionUiApi#input(String, InputOptions)} convenience * method. * * @since 1.0.0 */ +@JsonInclude(JsonInclude.Include.NON_NULL) public class InputOptions { private String title; private String description; + @JsonProperty("minLength") private Integer minLength; + @JsonProperty("maxLength") private Integer maxLength; private String format; private String defaultValue; @@ -46,34 +54,66 @@ public InputOptions setDescription(String description) { return this; } - /** Gets the minimum character length. @return the min length */ - public Integer getMinLength() { - return minLength; + /** + * Gets the minimum character length. + * + * @return an {@link java.util.OptionalInt} containing the min length, or + * {@link java.util.OptionalInt#empty()} if not set + */ + @JsonIgnore + public OptionalInt getMinLength() { + return minLength == null ? OptionalInt.empty() : OptionalInt.of(minLength); } /** * Sets the minimum character length. @param minLength the min length @return * this */ - public InputOptions setMinLength(Integer minLength) { + public InputOptions setMinLength(int minLength) { this.minLength = minLength; return this; } - /** Gets the maximum character length. @return the max length */ - public Integer getMaxLength() { - return maxLength; + /** + * Clears the minLength setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public InputOptions clearMinLength() { + this.minLength = null; + return this; + } + + /** + * Gets the maximum character length. + * + * @return an {@link java.util.OptionalInt} containing the max length, or + * {@link java.util.OptionalInt#empty()} if not set + */ + @JsonIgnore + public OptionalInt getMaxLength() { + return maxLength == null ? OptionalInt.empty() : OptionalInt.of(maxLength); } /** * Sets the maximum character length. @param maxLength the max length @return * this */ - public InputOptions setMaxLength(Integer maxLength) { + public InputOptions setMaxLength(int maxLength) { this.maxLength = maxLength; return this; } + /** + * Clears the maxLength setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public InputOptions clearMaxLength() { + this.maxLength = null; + return this; + } + /** * Gets the semantic format hint (e.g., {@code "email"}, {@code "uri"}, * {@code "date"}, {@code "date-time"}). diff --git a/src/main/java/com/github/copilot/sdk/json/ModelCapabilitiesOverride.java b/src/main/java/com/github/copilot/sdk/json/ModelCapabilitiesOverride.java index 18701ad671..02727d4b5c 100644 --- a/src/main/java/com/github/copilot/sdk/json/ModelCapabilitiesOverride.java +++ b/src/main/java/com/github/copilot/sdk/json/ModelCapabilitiesOverride.java @@ -7,6 +7,9 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Optional; +import java.util.OptionalInt; /** * Per-property overrides for model capabilities, deep-merged over runtime @@ -106,48 +109,73 @@ public static class Supports { /** * Gets the vision override. * - * @return {@code true} to enable vision, {@code false} to disable, or - * {@code null} to use the runtime default + * @return an {@link java.util.Optional} containing {@code true} to enable + * vision or {@code false} to disable, or + * {@link java.util.Optional#empty()} to use the runtime default */ - public Boolean getVision() { - return vision; + @JsonIgnore + public Optional getVision() { + return Optional.ofNullable(vision); } /** - * Sets whether vision (image input) is enabled. + * Sets whether vision (image input) is enabled. Use {@link #clearVision()} to + * revert to the runtime default. * * @param vision - * {@code true} to enable, {@code false} to disable, or {@code null} - * to use the runtime default + * {@code true} to enable, {@code false} to disable * @return this instance for method chaining */ - public Supports setVision(Boolean vision) { + public Supports setVision(boolean vision) { this.vision = vision; return this; } + /** + * Clears the vision setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public Supports clearVision() { + this.vision = null; + return this; + } + /** * Gets the reasoning effort override. * - * @return {@code true} to enable reasoning effort, {@code false} to disable, or - * {@code null} to use the runtime default + * @return an {@link java.util.Optional} containing {@code true} to enable + * reasoning effort or {@code false} to disable, or + * {@link java.util.Optional#empty()} to use the runtime default */ - public Boolean getReasoningEffort() { - return reasoningEffort; + @JsonIgnore + public Optional getReasoningEffort() { + return Optional.ofNullable(reasoningEffort); } /** - * Sets whether reasoning effort configuration is enabled. + * Sets whether reasoning effort configuration is enabled. Use + * {@link #clearReasoningEffort()} to revert to the runtime default. * * @param reasoningEffort - * {@code true} to enable, {@code false} to disable, or {@code null} - * to use the runtime default + * {@code true} to enable, {@code false} to disable * @return this instance for method chaining */ - public Supports setReasoningEffort(Boolean reasoningEffort) { + public Supports setReasoningEffort(boolean reasoningEffort) { this.reasoningEffort = reasoningEffort; return this; } + + /** + * Clears the reasoningEffort setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public Supports clearReasoningEffort() { + this.reasoningEffort = null; + return this; + } + } /** @@ -174,8 +202,9 @@ public static class Limits { * * @return the override value, or {@code null} to use the runtime default */ - public Integer getMaxPromptTokens() { - return maxPromptTokens; + @JsonIgnore + public OptionalInt getMaxPromptTokens() { + return maxPromptTokens == null ? OptionalInt.empty() : OptionalInt.of(maxPromptTokens); } /** @@ -185,18 +214,29 @@ public Integer getMaxPromptTokens() { * the override value, or {@code null} to use the runtime default * @return this instance for method chaining */ - public Limits setMaxPromptTokens(Integer maxPromptTokens) { + public Limits setMaxPromptTokens(int maxPromptTokens) { this.maxPromptTokens = maxPromptTokens; return this; } + /** + * Clears the maxPromptTokens setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public Limits clearMaxPromptTokens() { + this.maxPromptTokens = null; + return this; + } + /** * Gets the maximum output tokens override. * * @return the override value, or {@code null} to use the runtime default */ - public Integer getMaxOutputTokens() { - return maxOutputTokens; + @JsonIgnore + public OptionalInt getMaxOutputTokens() { + return maxOutputTokens == null ? OptionalInt.empty() : OptionalInt.of(maxOutputTokens); } /** @@ -206,18 +246,29 @@ public Integer getMaxOutputTokens() { * the override value, or {@code null} to use the runtime default * @return this instance for method chaining */ - public Limits setMaxOutputTokens(Integer maxOutputTokens) { + public Limits setMaxOutputTokens(int maxOutputTokens) { this.maxOutputTokens = maxOutputTokens; return this; } + /** + * Clears the maxOutputTokens setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public Limits clearMaxOutputTokens() { + this.maxOutputTokens = null; + return this; + } + /** * Gets the maximum context window tokens override. * * @return the override value, or {@code null} to use the runtime default */ - public Integer getMaxContextWindowTokens() { - return maxContextWindowTokens; + @JsonIgnore + public OptionalInt getMaxContextWindowTokens() { + return maxContextWindowTokens == null ? OptionalInt.empty() : OptionalInt.of(maxContextWindowTokens); } /** @@ -227,9 +278,20 @@ public Integer getMaxContextWindowTokens() { * the override value, or {@code null} to use the runtime default * @return this instance for method chaining */ - public Limits setMaxContextWindowTokens(Integer maxContextWindowTokens) { + public Limits setMaxContextWindowTokens(int maxContextWindowTokens) { this.maxContextWindowTokens = maxContextWindowTokens; return this; } + + /** + * Clears the maxContextWindowTokens setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public Limits clearMaxContextWindowTokens() { + this.maxContextWindowTokens = null; + return this; + } + } } diff --git a/src/main/java/com/github/copilot/sdk/json/PermissionHandler.java b/src/main/java/com/github/copilot/sdk/json/PermissionHandler.java index 21b822e418..d230748fcf 100644 --- a/src/main/java/com/github/copilot/sdk/json/PermissionHandler.java +++ b/src/main/java/com/github/copilot/sdk/json/PermissionHandler.java @@ -20,11 +20,13 @@ * // Check the permission kind * if ("dangerous-action".equals(request.getKind())) { * // Deny dangerous actions - * return CompletableFuture.completedFuture(new PermissionRequestResult().setKind("user-denied")); + * return CompletableFuture + * .completedFuture(new PermissionRequestResult().setKind(PermissionRequestResultKind.REJECTED)); * } * * // Approve other requests - * return CompletableFuture.completedFuture(new PermissionRequestResult().setKind("user-approved")); + * return CompletableFuture + * .completedFuture(new PermissionRequestResult().setKind(PermissionRequestResultKind.APPROVED)); * }; * } * diff --git a/src/main/java/com/github/copilot/sdk/json/PermissionRequestResultKind.java b/src/main/java/com/github/copilot/sdk/json/PermissionRequestResultKind.java index 8f30be0929..f782fd76b6 100644 --- a/src/main/java/com/github/copilot/sdk/json/PermissionRequestResultKind.java +++ b/src/main/java/com/github/copilot/sdk/json/PermissionRequestResultKind.java @@ -19,13 +19,13 @@ * *

Well-known kinds

*
    - *
  • {@link #APPROVED} β€” the permission was approved.
  • - *
  • {@link #DENIED_BY_RULES} β€” the permission was denied by policy - * rules.
  • - *
  • {@link #DENIED_COULD_NOT_REQUEST_FROM_USER} β€” the permission was denied - * because no approval rule was found and the user could not be prompted.
  • - *
  • {@link #DENIED_INTERACTIVELY_BY_USER} β€” the permission was denied - * interactively by the user.
  • + *
  • {@link #APPROVED} β€” the permission was approved for this one + * instance.
  • + *
  • {@link #REJECTED} β€” the permission was denied interactively by the + * user.
  • + *
  • {@link #USER_NOT_AVAILABLE} β€” the permission was denied because user + * confirmation was unavailable.
  • + *
  • {@link #NO_RESULT} β€” no permission decision was made.
  • *
* * @see PermissionRequestResult @@ -33,23 +33,15 @@ */ public final class PermissionRequestResultKind { - /** The permission was approved. */ - public static final PermissionRequestResultKind APPROVED = new PermissionRequestResultKind("approved"); - - /** The permission was denied by policy rules. */ - public static final PermissionRequestResultKind DENIED_BY_RULES = new PermissionRequestResultKind( - "denied-by-rules"); - - /** - * The permission was denied because no approval rule was found and the user - * could not be prompted. - */ - public static final PermissionRequestResultKind DENIED_COULD_NOT_REQUEST_FROM_USER = new PermissionRequestResultKind( - "denied-no-approval-rule-and-could-not-request-from-user"); + /** The permission was approved for this one instance. */ + public static final PermissionRequestResultKind APPROVED = new PermissionRequestResultKind("approve-once"); /** The permission was denied interactively by the user. */ - public static final PermissionRequestResultKind DENIED_INTERACTIVELY_BY_USER = new PermissionRequestResultKind( - "denied-interactively-by-user"); + public static final PermissionRequestResultKind REJECTED = new PermissionRequestResultKind("reject"); + + /** The permission was denied because user confirmation was unavailable. */ + public static final PermissionRequestResultKind USER_NOT_AVAILABLE = new PermissionRequestResultKind( + "user-not-available"); /** * Leaves the pending permission request unanswered. @@ -66,6 +58,24 @@ public final class PermissionRequestResultKind { */ public static final PermissionRequestResultKind NO_RESULT = new PermissionRequestResultKind("no-result"); + /** + * @deprecated Use {@link #REJECTED} instead. + */ + @Deprecated + public static final PermissionRequestResultKind DENIED_INTERACTIVELY_BY_USER = REJECTED; + + /** + * @deprecated Use {@link #USER_NOT_AVAILABLE} instead. + */ + @Deprecated + public static final PermissionRequestResultKind DENIED_COULD_NOT_REQUEST_FROM_USER = USER_NOT_AVAILABLE; + + /** + * @deprecated Use {@link #USER_NOT_AVAILABLE} instead. + */ + @Deprecated + public static final PermissionRequestResultKind DENIED_BY_RULES = USER_NOT_AVAILABLE; + private final String value; /** diff --git a/src/main/java/com/github/copilot/sdk/json/PingResponse.java b/src/main/java/com/github/copilot/sdk/json/PingResponse.java index e86499b2f3..3dec2b352d 100644 --- a/src/main/java/com/github/copilot/sdk/json/PingResponse.java +++ b/src/main/java/com/github/copilot/sdk/json/PingResponse.java @@ -20,8 +20,8 @@ public record PingResponse( /** The echo message from the server. */ @JsonProperty("message") String message, - /** The server timestamp in milliseconds since epoch. */ - @JsonProperty("timestamp") long timestamp, + /** The server timestamp as an ISO 8601 string. */ + @JsonProperty("timestamp") String timestamp, /** * The SDK protocol version supported by the server. The SDK validates that this * version matches the expected version to ensure compatibility. diff --git a/src/main/java/com/github/copilot/sdk/json/PostToolUseHookInput.java b/src/main/java/com/github/copilot/sdk/json/PostToolUseHookInput.java index 18e9201b54..4ac3985064 100644 --- a/src/main/java/com/github/copilot/sdk/json/PostToolUseHookInput.java +++ b/src/main/java/com/github/copilot/sdk/json/PostToolUseHookInput.java @@ -16,6 +16,9 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class PostToolUseHookInput { + @JsonProperty("sessionId") + private String sessionId; + @JsonProperty("timestamp") private long timestamp; @@ -31,6 +34,27 @@ public class PostToolUseHookInput { @JsonProperty("toolResult") private JsonNode toolResult; + /** + * Gets the runtime session ID of the session that triggered the hook. + * + * @return the session ID + */ + public String getSessionId() { + return sessionId; + } + + /** + * Sets the runtime session ID of the session that triggered the hook. + * + * @param sessionId + * the session ID + * @return this instance for method chaining + */ + public PostToolUseHookInput setSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + /** * Gets the timestamp of the hook invocation. * diff --git a/src/main/java/com/github/copilot/sdk/json/PreMcpToolCallHandler.java b/src/main/java/com/github/copilot/sdk/json/PreMcpToolCallHandler.java new file mode 100644 index 0000000000..4ace4d8d8a --- /dev/null +++ b/src/main/java/com/github/copilot/sdk/json/PreMcpToolCallHandler.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk.json; + +import java.util.concurrent.CompletableFuture; + +/** + * Handler for pre-MCP-tool-call hooks. + *

+ * This hook is called before an MCP tool call is dispatched to an MCP server, + * allowing you to: + *

    + *
  • Inspect the tool call arguments and server name
  • + *
  • Set, replace, or remove MCP request metadata ({@code _meta})
  • + *
+ * + * @since 1.0.8 + */ +@FunctionalInterface +public interface PreMcpToolCallHandler { + + /** + * Handles a pre-MCP-tool-call hook invocation. + * + * @param input + * the hook input containing server name, tool name, and arguments + * @param invocation + * context information about the invocation + * @return a future that resolves with the hook output, or {@code null} to + * preserve existing metadata (no-op) + */ + CompletableFuture handle(PreMcpToolCallHookInput input, HookInvocation invocation); +} diff --git a/src/main/java/com/github/copilot/sdk/json/PreMcpToolCallHookInput.java b/src/main/java/com/github/copilot/sdk/json/PreMcpToolCallHookInput.java new file mode 100644 index 0000000000..17e32c02f8 --- /dev/null +++ b/src/main/java/com/github/copilot/sdk/json/PreMcpToolCallHookInput.java @@ -0,0 +1,215 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk.json; + +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; + +/** + * Input for a pre-MCP-tool-call hook. + *

+ * This hook fires before an MCP tool call is dispatched to an MCP server, + * allowing you to inspect or modify the request metadata. + * + * @since 1.0.8 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class PreMcpToolCallHookInput { + + @JsonProperty("sessionId") + private String sessionId; + + @JsonProperty("timestamp") + private long timestamp; + + @JsonProperty("cwd") + private String cwd; + + @JsonProperty("serverName") + private String serverName; + + @JsonProperty("toolName") + private String toolName; + + @JsonProperty("arguments") + private JsonNode arguments; + + @JsonProperty("toolCallId") + private String toolCallId; + + @JsonProperty("_meta") + private Map meta; + + /** + * Gets the runtime session ID of the session that triggered the hook. + * + * @return the session ID + */ + public String getSessionId() { + return sessionId; + } + + /** + * Sets the runtime session ID of the session that triggered the hook. + * + * @param sessionId + * the session ID + * @return this instance for method chaining + */ + public PreMcpToolCallHookInput setSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + + /** + * Gets the timestamp of the hook invocation. + * + * @return the timestamp in milliseconds + */ + public long getTimestamp() { + return timestamp; + } + + /** + * Sets the timestamp of the hook invocation. + * + * @param timestamp + * the timestamp in milliseconds + * @return this instance for method chaining + */ + public PreMcpToolCallHookInput setTimestamp(long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Gets the current working directory. + * + * @return the working directory path + */ + public String getCwd() { + return cwd; + } + + /** + * Sets the current working directory. + * + * @param cwd + * the working directory path + * @return this instance for method chaining + */ + public PreMcpToolCallHookInput setCwd(String cwd) { + this.cwd = cwd; + return this; + } + + /** + * Gets the name of the MCP server being called. + * + * @return the server name + */ + public String getServerName() { + return serverName; + } + + /** + * Sets the name of the MCP server being called. + * + * @param serverName + * the server name + * @return this instance for method chaining + */ + public PreMcpToolCallHookInput setServerName(String serverName) { + this.serverName = serverName; + return this; + } + + /** + * Gets the name of the MCP tool being called. + * + * @return the tool name + */ + public String getToolName() { + return toolName; + } + + /** + * Sets the name of the MCP tool being called. + * + * @param toolName + * the tool name + * @return this instance for method chaining + */ + public PreMcpToolCallHookInput setToolName(String toolName) { + this.toolName = toolName; + return this; + } + + /** + * Gets the arguments for the MCP tool call. + * + * @return the arguments as a JSON node, or {@code null} + */ + public JsonNode getArguments() { + return arguments; + } + + /** + * Sets the arguments for the MCP tool call. + * + * @param arguments + * the arguments as a JSON node + * @return this instance for method chaining + */ + public PreMcpToolCallHookInput setArguments(JsonNode arguments) { + this.arguments = arguments; + return this; + } + + /** + * Gets the tool call ID, if available. + * + * @return the tool call ID, or {@code null} + */ + public String getToolCallId() { + return toolCallId; + } + + /** + * Sets the tool call ID. + * + * @param toolCallId + * the tool call ID + * @return this instance for method chaining + */ + public PreMcpToolCallHookInput setToolCallId(String toolCallId) { + this.toolCallId = toolCallId; + return this; + } + + /** + * Gets the MCP request metadata, if present. + * + * @return the metadata map, or {@code null} + */ + public Map getMeta() { + return meta; + } + + /** + * Sets the MCP request metadata. + * + * @param meta + * the metadata map + * @return this instance for method chaining + */ + public PreMcpToolCallHookInput setMeta(Map meta) { + this.meta = meta; + return this; + } +} diff --git a/src/main/java/com/github/copilot/sdk/json/PreMcpToolCallHookOutput.java b/src/main/java/com/github/copilot/sdk/json/PreMcpToolCallHookOutput.java new file mode 100644 index 0000000000..a051113266 --- /dev/null +++ b/src/main/java/com/github/copilot/sdk/json/PreMcpToolCallHookOutput.java @@ -0,0 +1,72 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk.json; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; + +/** + * Output for a pre-MCP-tool-call hook. + *

+ * The {@link #metaToUse} property controls outgoing MCP request metadata: + *

    + *
  • Return {@code null} from the hook handler: preserve existing + * {@code _meta} (no-op).
  • + *
  • Return a {@code PreMcpToolCallHookOutput} with {@code metaToUse} left as + * {@code null}: remove {@code _meta} from the request.
  • + *
  • Return a {@code PreMcpToolCallHookOutput} with {@code metaToUse} set to a + * JSON object: replace {@code _meta} with that object.
  • + *
+ * + * @since 1.0.8 + */ +@JsonInclude(JsonInclude.Include.ALWAYS) +public class PreMcpToolCallHookOutput { + + @JsonProperty("metaToUse") + private JsonNode metaToUse; + + /** + * Gets the metadata to use for the outgoing MCP request. + * + * @return the metadata JSON node, or {@code null} to remove metadata + */ + public JsonNode getMetaToUse() { + return metaToUse; + } + + /** + * Sets the metadata to use for the outgoing MCP request. + * + * @param metaToUse + * the metadata JSON node, or {@code null} to remove metadata + * @return this instance for method chaining + */ + public PreMcpToolCallHookOutput setMetaToUse(JsonNode metaToUse) { + this.metaToUse = metaToUse; + return this; + } + + /** + * Creates a hook output that sets the given metadata on the MCP request. + * + * @param metaToUse + * the metadata JSON node to use + * @return the hook output + */ + public static PreMcpToolCallHookOutput withMeta(JsonNode metaToUse) { + return new PreMcpToolCallHookOutput().setMetaToUse(metaToUse); + } + + /** + * Creates a hook output that removes metadata from the MCP request. + * + * @return the hook output with {@code null} metaToUse + */ + public static PreMcpToolCallHookOutput removeMeta() { + return new PreMcpToolCallHookOutput(); + } +} diff --git a/src/main/java/com/github/copilot/sdk/json/PreToolUseHookInput.java b/src/main/java/com/github/copilot/sdk/json/PreToolUseHookInput.java index 63785e98d3..6cbab78b7f 100644 --- a/src/main/java/com/github/copilot/sdk/json/PreToolUseHookInput.java +++ b/src/main/java/com/github/copilot/sdk/json/PreToolUseHookInput.java @@ -16,6 +16,9 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class PreToolUseHookInput { + @JsonProperty("sessionId") + private String sessionId; + @JsonProperty("timestamp") private long timestamp; @@ -28,6 +31,27 @@ public class PreToolUseHookInput { @JsonProperty("toolArgs") private JsonNode toolArgs; + /** + * Gets the runtime session ID of the session that triggered the hook. + * + * @return the session ID + */ + public String getSessionId() { + return sessionId; + } + + /** + * Sets the runtime session ID of the session that triggered the hook. + * + * @param sessionId + * the session ID + * @return this instance for method chaining + */ + public PreToolUseHookInput setSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + /** * Gets the timestamp of the hook invocation. * diff --git a/src/main/java/com/github/copilot/sdk/json/ProviderConfig.java b/src/main/java/com/github/copilot/sdk/json/ProviderConfig.java index 3b29956814..1c5e6fcc7f 100644 --- a/src/main/java/com/github/copilot/sdk/json/ProviderConfig.java +++ b/src/main/java/com/github/copilot/sdk/json/ProviderConfig.java @@ -9,6 +9,8 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.OptionalInt; /** * Configuration for a custom API provider (BYOK - Bring Your Own Key). @@ -57,6 +59,18 @@ public class ProviderConfig { @JsonProperty("headers") private Map headers; + @JsonProperty("modelId") + private String modelId; + + @JsonProperty("wireModel") + private String wireModel; + + @JsonProperty("maxPromptTokens") + private Integer maxPromptTokens; + + @JsonProperty("maxOutputTokens") + private Integer maxOutputTokens; + /** * Gets the provider type. * @@ -225,4 +239,134 @@ public ProviderConfig setHeaders(Map headers) { this.headers = headers; return this; } + + /** + * Gets the well-known model name used by the runtime. + *

+ * Used to look up agent configuration (tools, prompts, reasoning behavior) and + * default token limits. Also used as the wire model when + * {@link #getWireModel()} is not set. + * + * @return the model ID, or {@code null} if not set + */ + public String getModelId() { + return modelId; + } + + /** + * Sets the well-known model name used by the runtime. + *

+ * Used to look up agent configuration (tools, prompts, reasoning behavior) and + * default token limits. Also used as the wire model when + * {@link #getWireModel()} is not set. Falls back to + * {@link SessionConfig#getModel()}. + * + * @param modelId + * the model ID + * @return this config for method chaining + */ + public ProviderConfig setModelId(String modelId) { + this.modelId = modelId; + return this; + } + + /** + * Gets the model name sent to the provider API for inference. + * + * @return the wire model name, or {@code null} if not set + */ + public String getWireModel() { + return wireModel; + } + + /** + * Sets the model name sent to the provider API for inference. + *

+ * Use this when the provider's model name (e.g. an Azure deployment name or a + * custom fine-tune name) differs from {@link #getModelId()}. Falls back to + * {@link #getModelId()}, then {@link SessionConfig#getModel()}. + * + * @param wireModel + * the wire model name + * @return this config for method chaining + */ + public ProviderConfig setWireModel(String wireModel) { + this.wireModel = wireModel; + return this; + } + + /** + * Gets the maximum prompt token override. + * + * @return an {@link java.util.OptionalInt} containing the max prompt tokens, or + * {@link java.util.OptionalInt#empty()} if not set + */ + @JsonIgnore + public OptionalInt getMaxPromptTokens() { + return maxPromptTokens == null ? OptionalInt.empty() : OptionalInt.of(maxPromptTokens); + } + + /** + * Sets the maximum prompt tokens override. + *

+ * Overrides the resolved model's default max prompt tokens. The runtime + * triggers conversation compaction before sending a request when the prompt + * (system message, history, tool definitions, user message) would exceed this + * limit. + * + * @param maxPromptTokens + * the max prompt tokens + * @return this config for method chaining + */ + public ProviderConfig setMaxPromptTokens(int maxPromptTokens) { + this.maxPromptTokens = maxPromptTokens; + return this; + } + + /** + * Clears the maxPromptTokens setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public ProviderConfig clearMaxPromptTokens() { + this.maxPromptTokens = null; + return this; + } + + /** + * Gets the maximum output token override. + * + * @return an {@link java.util.OptionalInt} containing the max output tokens, or + * {@link java.util.OptionalInt#empty()} if not set + */ + @JsonIgnore + public OptionalInt getMaxOutputTokens() { + return maxOutputTokens == null ? OptionalInt.empty() : OptionalInt.of(maxOutputTokens); + } + + /** + * Sets the maximum output tokens override. + *

+ * Overrides the resolved model's default max output tokens. When hit, the model + * stops generating and returns a truncated response. + * + * @param maxOutputTokens + * the max output tokens + * @return this config for method chaining + */ + public ProviderConfig setMaxOutputTokens(int maxOutputTokens) { + this.maxOutputTokens = maxOutputTokens; + return this; + } + + /** + * Clears the maxOutputTokens setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public ProviderConfig clearMaxOutputTokens() { + this.maxOutputTokens = null; + return this; + } + } diff --git a/src/main/java/com/github/copilot/sdk/json/ResumeSessionConfig.java b/src/main/java/com/github/copilot/sdk/json/ResumeSessionConfig.java index c3199c3176..72c9f6f47a 100644 --- a/src/main/java/com/github/copilot/sdk/json/ResumeSessionConfig.java +++ b/src/main/java/com/github/copilot/sdk/json/ResumeSessionConfig.java @@ -11,8 +11,10 @@ import java.util.function.Consumer; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.github.copilot.sdk.generated.SessionEvent; +import java.util.Optional; /** * Configuration for resuming an existing Copilot session. @@ -43,6 +45,7 @@ public class ResumeSessionConfig { private List availableTools; private List excludedTools; private ProviderConfig provider; + private Boolean enableSessionTelemetry; private String reasoningEffort; private ModelCapabilitiesOverride modelCapabilities; private PermissionHandler onPermissionRequest; @@ -56,13 +59,19 @@ public class ResumeSessionConfig { private Boolean includeSubAgentStreamingEvents; private Map mcpServers; private List customAgents; + private DefaultAgentConfig defaultAgent; private String agent; private List skillDirectories; + private List instructionDirectories; private List disabledSkills; private InfiniteSessionConfig infiniteSessions; private Consumer onEvent; private List commands; private ElicitationHandler onElicitationRequest; + private ExitPlanModeHandler onExitPlanMode; + private AutoModeSwitchHandler onAutoModeSwitch; + private String gitHubToken; + private String remoteSession; /** * Gets the AI model to use. @@ -226,6 +235,50 @@ public ResumeSessionConfig setProvider(ProviderConfig provider) { return this; } + /** + * Enables or disables internal session telemetry for this session. When + * {@code false}, disables session telemetry. When unset (the default) or + * {@code true}, telemetry is enabled for GitHub-authenticated sessions. When a + * custom {@link ProviderConfig} (BYOK) is configured, session telemetry is + * always disabled regardless of this setting. This is independent of + * {@link com.github.copilot.sdk.json.CopilotClientOptions#getTelemetry() + * CopilotClientOptions.TelemetryConfig}, which configures OpenTelemetry export + * for observability. + * + * @return an {@link java.util.Optional} containing whether session telemetry is + * enabled, or {@link java.util.Optional#empty()} for the default + */ + @JsonIgnore + public Optional getEnableSessionTelemetry() { + return Optional.ofNullable(enableSessionTelemetry); + } + + /** + * Enables or disables internal session telemetry for this session. When + * {@code false}, disables session telemetry. When unset (the default) or + * {@code true}, telemetry is enabled for GitHub-authenticated sessions. When a + * custom {@link ProviderConfig} (BYOK) is configured, session telemetry is + * always disabled regardless of this setting. + * + * @param enableSessionTelemetry + * whether to enable session telemetry + * @return this config for method chaining + */ + public ResumeSessionConfig setEnableSessionTelemetry(boolean enableSessionTelemetry) { + this.enableSessionTelemetry = enableSessionTelemetry; + return this; + } + + /** + * Clears the enableSessionTelemetry setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public ResumeSessionConfig clearEnableSessionTelemetry() { + this.enableSessionTelemetry = null; + return this; + } + /** * Gets the reasoning effort level. * @@ -365,8 +418,9 @@ public ResumeSessionConfig setConfigDir(String configDir) { * @return {@code true} to enable discovery, {@code false} to disable, or * {@code null} to use the runtime default */ - public Boolean getEnableConfigDiscovery() { - return enableConfigDiscovery; + @JsonIgnore + public Optional getEnableConfigDiscovery() { + return Optional.ofNullable(enableConfigDiscovery); } /** @@ -382,19 +436,30 @@ public Boolean getEnableConfigDiscovery() { * {@code null} to use the runtime default * @return this config for method chaining */ - public ResumeSessionConfig setEnableConfigDiscovery(Boolean enableConfigDiscovery) { + public ResumeSessionConfig setEnableConfigDiscovery(boolean enableConfigDiscovery) { this.enableConfigDiscovery = enableConfigDiscovery; return this; } + /** + * Clears the enableConfigDiscovery setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public ResumeSessionConfig clearEnableConfigDiscovery() { + this.enableConfigDiscovery = null; + return this; + } + /** * Gets whether sub-agent streaming events are included. * * @return {@code true} to include sub-agent streaming events, {@code false} to * suppress them, or {@code null} to use the runtime default */ - public Boolean getIncludeSubAgentStreamingEvents() { - return includeSubAgentStreamingEvents; + @JsonIgnore + public Optional getIncludeSubAgentStreamingEvents() { + return Optional.ofNullable(includeSubAgentStreamingEvents); } /** @@ -405,11 +470,22 @@ public Boolean getIncludeSubAgentStreamingEvents() { * suppress * @return this config for method chaining */ - public ResumeSessionConfig setIncludeSubAgentStreamingEvents(Boolean includeSubAgentStreamingEvents) { + public ResumeSessionConfig setIncludeSubAgentStreamingEvents(boolean includeSubAgentStreamingEvents) { this.includeSubAgentStreamingEvents = includeSubAgentStreamingEvents; return this; } + /** + * Clears the includeSubAgentStreamingEvents setting, reverting to the default + * behavior. + * + * @return this instance for method chaining + */ + public ResumeSessionConfig clearIncludeSubAgentStreamingEvents() { + this.includeSubAgentStreamingEvents = null; + return this; + } + /** * Gets the model capabilities override. * @@ -520,6 +596,31 @@ public ResumeSessionConfig setCustomAgents(List customAgents) return this; } + /** + * Gets the default agent configuration. + * + * @return the default agent configuration, or {@code null} if not set + */ + public DefaultAgentConfig getDefaultAgent() { + return defaultAgent; + } + + /** + * Sets the default agent configuration. + *

+ * Use {@link DefaultAgentConfig#setExcludedTools(List)} to hide specific tools + * from the default agent while keeping them available to custom sub-agents. + * + * @param defaultAgent + * the default agent configuration + * @return this config for method chaining + * @see DefaultAgentConfig + */ + public ResumeSessionConfig setDefaultAgent(DefaultAgentConfig defaultAgent) { + this.defaultAgent = defaultAgent; + return this; + } + /** * Gets the name of the custom agent to activate at session start. * @@ -564,6 +665,27 @@ public ResumeSessionConfig setSkillDirectories(List skillDirectories) { return this; } + /** + * Gets the additional directories to search for custom instruction files. + * + * @return the list of instruction directory paths + */ + public List getInstructionDirectories() { + return instructionDirectories == null ? null : Collections.unmodifiableList(instructionDirectories); + } + + /** + * Sets additional directories to search for custom instruction files. + * + * @param instructionDirectories + * the list of instruction directory paths + * @return this config for method chaining + */ + public ResumeSessionConfig setInstructionDirectories(List instructionDirectories) { + this.instructionDirectories = instructionDirectories; + return this; + } + /** * Gets the disabled skills. * @@ -684,6 +806,115 @@ public ResumeSessionConfig setOnElicitationRequest(ElicitationHandler onElicitat return this; } + /** + * Gets the exit-plan-mode request handler. + * + * @return the exit-plan-mode handler, or {@code null} + * @since 1.0.8 + */ + public ExitPlanModeHandler getOnExitPlanMode() { + return onExitPlanMode; + } + + /** + * Sets a handler for exit-plan-mode requests from the server. + *

+ * When provided, the server will route {@code exitPlanMode.request} callbacks + * to this handler. + * + * @param onExitPlanMode + * the exit-plan-mode handler + * @return this config for method chaining + * @see ExitPlanModeHandler + * @since 1.0.8 + */ + public ResumeSessionConfig setOnExitPlanMode(ExitPlanModeHandler onExitPlanMode) { + this.onExitPlanMode = onExitPlanMode; + return this; + } + + /** + * Gets the auto-mode-switch request handler. + * + * @return the auto-mode-switch handler, or {@code null} + * @since 1.0.8 + */ + public AutoModeSwitchHandler getOnAutoModeSwitch() { + return onAutoModeSwitch; + } + + /** + * Sets a handler for auto-mode-switch requests from the server. + *

+ * When provided, the server will route {@code autoModeSwitch.request} callbacks + * to this handler. + * + * @param onAutoModeSwitch + * the auto-mode-switch handler + * @return this config for method chaining + * @see AutoModeSwitchHandler + * @since 1.0.8 + */ + public ResumeSessionConfig setOnAutoModeSwitch(AutoModeSwitchHandler onAutoModeSwitch) { + this.onAutoModeSwitch = onAutoModeSwitch; + return this; + } + + /** + * Gets the GitHub token for per-session authentication. + * + * @return the GitHub token, or {@code null} if not set + * @since 1.3.0 + */ + public String getGitHubToken() { + return gitHubToken; + } + + /** + * Sets the GitHub token for per-session authentication. + *

+ * When provided, the runtime resolves this token into a full GitHub identity + * and stores it on the session for content exclusion, model routing, and quota + * checks. + * + * @param gitHubToken + * the GitHub token for per-session authentication + * @return this config for method chaining + * @since 1.3.0 + */ + public ResumeSessionConfig setGitHubToken(String gitHubToken) { + this.gitHubToken = gitHubToken; + return this; + } + + /** + * Gets the per-session remote behavior control. + *

+ * See {@link SessionConfig#getRemoteSession()} for details on possible values. + * + * @return the remote session mode, or {@code null} if not set + * @since 1.4.0 + */ + public String getRemoteSession() { + return remoteSession; + } + + /** + * Sets the per-session remote behavior control. + *

+ * See {@link SessionConfig#setRemoteSession(String)} for details on possible + * values. + * + * @param remoteSession + * the remote session mode + * @return this config for method chaining + * @since 1.4.0 + */ + public ResumeSessionConfig setRemoteSession(String remoteSession) { + this.remoteSession = remoteSession; + return this; + } + /** * Creates a shallow clone of this {@code ResumeSessionConfig} instance. *

@@ -705,6 +936,7 @@ public ResumeSessionConfig clone() { copy.availableTools = this.availableTools != null ? new ArrayList<>(this.availableTools) : null; copy.excludedTools = this.excludedTools != null ? new ArrayList<>(this.excludedTools) : null; copy.provider = this.provider; + copy.enableSessionTelemetry = this.enableSessionTelemetry; copy.reasoningEffort = this.reasoningEffort; copy.modelCapabilities = this.modelCapabilities; copy.onPermissionRequest = this.onPermissionRequest; @@ -718,13 +950,21 @@ public ResumeSessionConfig clone() { copy.includeSubAgentStreamingEvents = this.includeSubAgentStreamingEvents; copy.mcpServers = this.mcpServers != null ? new java.util.HashMap<>(this.mcpServers) : null; copy.customAgents = this.customAgents != null ? new ArrayList<>(this.customAgents) : null; + copy.defaultAgent = this.defaultAgent; copy.agent = this.agent; copy.skillDirectories = this.skillDirectories != null ? new ArrayList<>(this.skillDirectories) : null; + copy.instructionDirectories = this.instructionDirectories != null + ? new ArrayList<>(this.instructionDirectories) + : null; copy.disabledSkills = this.disabledSkills != null ? new ArrayList<>(this.disabledSkills) : null; copy.infiniteSessions = this.infiniteSessions; copy.onEvent = this.onEvent; copy.commands = this.commands != null ? new ArrayList<>(this.commands) : null; copy.onElicitationRequest = this.onElicitationRequest; + copy.onExitPlanMode = this.onExitPlanMode; + copy.onAutoModeSwitch = this.onAutoModeSwitch; + copy.gitHubToken = this.gitHubToken; + copy.remoteSession = this.remoteSession; return copy; } } diff --git a/src/main/java/com/github/copilot/sdk/json/ResumeSessionRequest.java b/src/main/java/com/github/copilot/sdk/json/ResumeSessionRequest.java index 77d00b24db..8aca77b7d2 100644 --- a/src/main/java/com/github/copilot/sdk/json/ResumeSessionRequest.java +++ b/src/main/java/com/github/copilot/sdk/json/ResumeSessionRequest.java @@ -53,6 +53,9 @@ public final class ResumeSessionRequest { @JsonProperty("provider") private ProviderConfig provider; + @JsonProperty("enableSessionTelemetry") + private Boolean enableSessionTelemetry; + @JsonProperty("requestPermission") private Boolean requestPermission; @@ -89,12 +92,18 @@ public final class ResumeSessionRequest { @JsonProperty("customAgents") private List customAgents; + @JsonProperty("defaultAgent") + private DefaultAgentConfig defaultAgent; + @JsonProperty("agent") private String agent; @JsonProperty("skillDirectories") private List skillDirectories; + @JsonProperty("instructionDirectories") + private List instructionDirectories; + @JsonProperty("disabledSkills") private List disabledSkills; @@ -107,9 +116,21 @@ public final class ResumeSessionRequest { @JsonProperty("requestElicitation") private Boolean requestElicitation; + @JsonProperty("requestExitPlanMode") + private Boolean requestExitPlanMode; + + @JsonProperty("requestAutoModeSwitch") + private Boolean requestAutoModeSwitch; + @JsonProperty("modelCapabilities") private ModelCapabilitiesOverride modelCapabilities; + @JsonProperty("gitHubToken") + private String gitHubToken; + + @JsonProperty("remoteSession") + private String remoteSession; + /** Gets the session ID. @return the session ID */ public String getSessionId() { return sessionId; @@ -205,36 +226,76 @@ public void setProvider(ProviderConfig provider) { this.provider = provider; } + /** Gets enable session telemetry flag. @return the flag */ + public Boolean getEnableSessionTelemetry() { + return enableSessionTelemetry; + } + + /** + * Sets enable session telemetry flag. @param enableSessionTelemetry the flag + */ + public void setEnableSessionTelemetry(boolean enableSessionTelemetry) { + this.enableSessionTelemetry = enableSessionTelemetry; + } + + /** + * Clears the enableSessionTelemetry setting, reverting to the default behavior. + */ + public void clearEnableSessionTelemetry() { + this.enableSessionTelemetry = null; + } + /** Gets request permission flag. @return the flag */ public Boolean getRequestPermission() { return requestPermission; } /** Sets request permission flag. @param requestPermission the flag */ - public void setRequestPermission(Boolean requestPermission) { + public void setRequestPermission(boolean requestPermission) { this.requestPermission = requestPermission; } + /** + * Clears the requestPermission setting, reverting to the default behavior. + */ + public void clearRequestPermission() { + this.requestPermission = null; + } + /** Gets request user input flag. @return the flag */ public Boolean getRequestUserInput() { return requestUserInput; } /** Sets request user input flag. @param requestUserInput the flag */ - public void setRequestUserInput(Boolean requestUserInput) { + public void setRequestUserInput(boolean requestUserInput) { this.requestUserInput = requestUserInput; } + /** + * Clears the requestUserInput setting, reverting to the default behavior. + */ + public void clearRequestUserInput() { + this.requestUserInput = null; + } + /** Gets hooks flag. @return the flag */ public Boolean getHooks() { return hooks; } /** Sets hooks flag. @param hooks the flag */ - public void setHooks(Boolean hooks) { + public void setHooks(boolean hooks) { this.hooks = hooks; } + /** + * Clears the hooks setting, reverting to the default behavior. + */ + public void clearHooks() { + this.hooks = null; + } + /** Gets working directory. @return the working directory */ public String getWorkingDirectory() { return workingDirectory; @@ -261,30 +322,51 @@ public Boolean getEnableConfigDiscovery() { } /** Sets enable config discovery flag. @param enableConfigDiscovery the flag */ - public void setEnableConfigDiscovery(Boolean enableConfigDiscovery) { + public void setEnableConfigDiscovery(boolean enableConfigDiscovery) { this.enableConfigDiscovery = enableConfigDiscovery; } + /** + * Clears the enableConfigDiscovery setting, reverting to the default behavior. + */ + public void clearEnableConfigDiscovery() { + this.enableConfigDiscovery = null; + } + /** Gets disable resume flag. @return the flag */ public Boolean getDisableResume() { return disableResume; } /** Sets disable resume flag. @param disableResume the flag */ - public void setDisableResume(Boolean disableResume) { + public void setDisableResume(boolean disableResume) { this.disableResume = disableResume; } + /** + * Clears the disableResume setting, reverting to the default behavior. + */ + public void clearDisableResume() { + this.disableResume = null; + } + /** Gets streaming flag. @return the flag */ public Boolean getStreaming() { return streaming; } /** Sets streaming flag. @param streaming the flag */ - public void setStreaming(Boolean streaming) { + public void setStreaming(boolean streaming) { this.streaming = streaming; } + /** + * Clears the streaming setting, reverting to the default behavior. + */ + public void clearStreaming() { + this.streaming = null; + } + /** Gets include sub-agent streaming events flag. @return the flag */ public Boolean getIncludeSubAgentStreamingEvents() { return includeSubAgentStreamingEvents; @@ -294,10 +376,18 @@ public Boolean getIncludeSubAgentStreamingEvents() { * Sets include sub-agent streaming events flag. @param * includeSubAgentStreamingEvents the flag */ - public void setIncludeSubAgentStreamingEvents(Boolean includeSubAgentStreamingEvents) { + public void setIncludeSubAgentStreamingEvents(boolean includeSubAgentStreamingEvents) { this.includeSubAgentStreamingEvents = includeSubAgentStreamingEvents; } + /** + * Clears the includeSubAgentStreamingEvents setting, reverting to the default + * behavior. + */ + public void clearIncludeSubAgentStreamingEvents() { + this.includeSubAgentStreamingEvents = null; + } + /** Gets MCP servers. @return the servers map */ public Map getMcpServers() { return mcpServers == null ? null : Collections.unmodifiableMap(mcpServers); @@ -328,6 +418,18 @@ public void setCustomAgents(List customAgents) { this.customAgents = customAgents; } + /** Gets the default agent config. @return the default agent config */ + public DefaultAgentConfig getDefaultAgent() { + return defaultAgent; + } + + /** + * Sets the default agent config. @param defaultAgent the default agent config + */ + public void setDefaultAgent(DefaultAgentConfig defaultAgent) { + this.defaultAgent = defaultAgent; + } + /** Gets the pre-selected agent name. @return the agent name */ public String getAgent() { return agent; @@ -348,6 +450,18 @@ public void setSkillDirectories(List skillDirectories) { this.skillDirectories = skillDirectories; } + /** Gets instruction directories. @return the instruction directories */ + public List getInstructionDirectories() { + return instructionDirectories == null ? null : Collections.unmodifiableList(instructionDirectories); + } + + /** + * Sets instruction directories. @param instructionDirectories the directories + */ + public void setInstructionDirectories(List instructionDirectories) { + this.instructionDirectories = instructionDirectories; + } + /** Gets disabled skills. @return the disabled skill names */ public List getDisabledSkills() { return disabledSkills == null ? null : Collections.unmodifiableList(disabledSkills); @@ -387,10 +501,39 @@ public Boolean getRequestElicitation() { } /** Sets the requestElicitation flag. @param requestElicitation the flag */ - public void setRequestElicitation(Boolean requestElicitation) { + public void setRequestElicitation(boolean requestElicitation) { this.requestElicitation = requestElicitation; } + /** + * Clears the requestElicitation setting, reverting to the default behavior. + */ + public void clearRequestElicitation() { + this.requestElicitation = null; + } + + /** Gets the requestExitPlanMode flag. @return the flag */ + public Boolean getRequestExitPlanMode() { + return requestExitPlanMode; + } + + /** Sets the requestExitPlanMode flag. @param requestExitPlanMode the flag */ + public void setRequestExitPlanMode(Boolean requestExitPlanMode) { + this.requestExitPlanMode = requestExitPlanMode; + } + + /** Gets the requestAutoModeSwitch flag. @return the flag */ + public Boolean getRequestAutoModeSwitch() { + return requestAutoModeSwitch; + } + + /** + * Sets the requestAutoModeSwitch flag. @param requestAutoModeSwitch the flag + */ + public void setRequestAutoModeSwitch(Boolean requestAutoModeSwitch) { + this.requestAutoModeSwitch = requestAutoModeSwitch; + } + /** Gets the model capabilities override. @return the override */ public ModelCapabilitiesOverride getModelCapabilities() { return modelCapabilities; @@ -402,4 +545,29 @@ public ModelCapabilitiesOverride getModelCapabilities() { public void setModelCapabilities(ModelCapabilitiesOverride modelCapabilities) { this.modelCapabilities = modelCapabilities; } + + /** Gets the GitHub token for per-session authentication. @return the token */ + public String getGitHubToken() { + return gitHubToken; + } + + /** + * Sets the GitHub token for per-session authentication. @param gitHubToken the + * token + */ + public void setGitHubToken(String gitHubToken) { + this.gitHubToken = gitHubToken; + } + + /** Gets the remote session mode. @return the remote session mode */ + public String getRemoteSession() { + return remoteSession; + } + + /** + * Sets the remote session mode. @param remoteSession the remote session mode + */ + public void setRemoteSession(String remoteSession) { + this.remoteSession = remoteSession; + } } diff --git a/src/main/java/com/github/copilot/sdk/json/SessionConfig.java b/src/main/java/com/github/copilot/sdk/json/SessionConfig.java index 997da51168..ddf06cca7f 100644 --- a/src/main/java/com/github/copilot/sdk/json/SessionConfig.java +++ b/src/main/java/com/github/copilot/sdk/json/SessionConfig.java @@ -11,8 +11,10 @@ import java.util.function.Consumer; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.github.copilot.sdk.generated.SessionEvent; +import java.util.Optional; /** * Configuration for creating a new Copilot session. @@ -45,6 +47,7 @@ public class SessionConfig { private List availableTools; private List excludedTools; private ProviderConfig provider; + private Boolean enableSessionTelemetry; private PermissionHandler onPermissionRequest; private UserInputHandler onUserInputRequest; private SessionHooks hooks; @@ -53,9 +56,11 @@ public class SessionConfig { private Boolean includeSubAgentStreamingEvents; private Map mcpServers; private List customAgents; + private DefaultAgentConfig defaultAgent; private String agent; private InfiniteSessionConfig infiniteSessions; private List skillDirectories; + private List instructionDirectories; private List disabledSkills; private String configDir; private Boolean enableConfigDiscovery; @@ -63,6 +68,11 @@ public class SessionConfig { private Consumer onEvent; private List commands; private ElicitationHandler onElicitationRequest; + private ExitPlanModeHandler onExitPlanMode; + private AutoModeSwitchHandler onAutoModeSwitch; + private String gitHubToken; + private String remoteSession; + private CloudSessionOptions cloud; /** * Gets the custom session ID. @@ -280,6 +290,50 @@ public SessionConfig setProvider(ProviderConfig provider) { return this; } + /** + * Enables or disables internal session telemetry for this session. When + * {@code false}, disables session telemetry. When unset (the default) or + * {@code true}, telemetry is enabled for GitHub-authenticated sessions. When a + * custom {@link ProviderConfig} (BYOK) is configured, session telemetry is + * always disabled regardless of this setting. This is independent of + * {@link com.github.copilot.sdk.json.CopilotClientOptions#getTelemetry() + * CopilotClientOptions.TelemetryConfig}, which configures OpenTelemetry export + * for observability. + * + * @return an {@link java.util.Optional} containing whether session telemetry is + * enabled, or {@link java.util.Optional#empty()} for the default + */ + @JsonIgnore + public Optional getEnableSessionTelemetry() { + return Optional.ofNullable(enableSessionTelemetry); + } + + /** + * Enables or disables internal session telemetry for this session. When + * {@code false}, disables session telemetry. When unset (the default) or + * {@code true}, telemetry is enabled for GitHub-authenticated sessions. When a + * custom {@link ProviderConfig} (BYOK) is configured, session telemetry is + * always disabled regardless of this setting. + * + * @param enableSessionTelemetry + * whether to enable session telemetry + * @return this config instance for method chaining + */ + public SessionConfig setEnableSessionTelemetry(boolean enableSessionTelemetry) { + this.enableSessionTelemetry = enableSessionTelemetry; + return this; + } + + /** + * Clears the enableSessionTelemetry setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public SessionConfig clearEnableSessionTelemetry() { + this.enableSessionTelemetry = null; + return this; + } + /** * Gets the permission request handler. * @@ -448,6 +502,31 @@ public SessionConfig setCustomAgents(List customAgents) { return this; } + /** + * Gets the default agent configuration. + * + * @return the default agent configuration, or {@code null} if not set + */ + public DefaultAgentConfig getDefaultAgent() { + return defaultAgent; + } + + /** + * Sets the default agent configuration. + *

+ * Use {@link DefaultAgentConfig#setExcludedTools(List)} to hide specific tools + * from the default agent while keeping them available to custom sub-agents. + * + * @param defaultAgent + * the default agent configuration + * @return this config instance for method chaining + * @see DefaultAgentConfig + */ + public SessionConfig setDefaultAgent(DefaultAgentConfig defaultAgent) { + this.defaultAgent = defaultAgent; + return this; + } + /** * Gets the name of the custom agent to activate at session start. * @@ -523,6 +602,27 @@ public SessionConfig setSkillDirectories(List skillDirectories) { return this; } + /** + * Gets the additional directories to search for custom instruction files. + * + * @return the list of instruction directory paths + */ + public List getInstructionDirectories() { + return instructionDirectories == null ? null : Collections.unmodifiableList(instructionDirectories); + } + + /** + * Sets additional directories to search for custom instruction files. + * + * @param instructionDirectories + * the list of instruction directory paths + * @return this config instance for method chaining + */ + public SessionConfig setInstructionDirectories(List instructionDirectories) { + this.instructionDirectories = instructionDirectories; + return this; + } + /** * Gets the disabled skill names. * @@ -574,11 +674,13 @@ public SessionConfig setConfigDir(String configDir) { /** * Gets whether automatic configuration discovery is enabled. * - * @return {@code true} to enable discovery, {@code false} to disable, or - * {@code null} to use the runtime default + * @return an {@link java.util.Optional} containing {@code true} to enable + * discovery or {@code false} to disable, or + * {@link java.util.Optional#empty()} to use the runtime default */ - public Boolean getEnableConfigDiscovery() { - return enableConfigDiscovery; + @JsonIgnore + public Optional getEnableConfigDiscovery() { + return Optional.ofNullable(enableConfigDiscovery); } /** @@ -592,23 +694,34 @@ public Boolean getEnableConfigDiscovery() { * name collision. * * @param enableConfigDiscovery - * {@code true} to enable discovery, {@code false} to disable, or - * {@code null} to use the runtime default + * {@code true} to enable discovery, {@code false} to disable * @return this config instance for method chaining */ - public SessionConfig setEnableConfigDiscovery(Boolean enableConfigDiscovery) { + public SessionConfig setEnableConfigDiscovery(boolean enableConfigDiscovery) { this.enableConfigDiscovery = enableConfigDiscovery; return this; } + /** + * Clears the enableConfigDiscovery setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public SessionConfig clearEnableConfigDiscovery() { + this.enableConfigDiscovery = null; + return this; + } + /** * Gets whether sub-agent streaming events are included. * - * @return {@code true} to include sub-agent streaming events, {@code false} to - * suppress them, or {@code null} to use the runtime default + * @return an {@link java.util.Optional} containing {@code true} to include + * sub-agent streaming events or {@code false} to suppress them, or + * {@link java.util.Optional#empty()} to use the runtime default */ - public Boolean getIncludeSubAgentStreamingEvents() { - return includeSubAgentStreamingEvents; + @JsonIgnore + public Optional getIncludeSubAgentStreamingEvents() { + return Optional.ofNullable(includeSubAgentStreamingEvents); } /** @@ -625,11 +738,22 @@ public Boolean getIncludeSubAgentStreamingEvents() { * suppress * @return this config instance for method chaining */ - public SessionConfig setIncludeSubAgentStreamingEvents(Boolean includeSubAgentStreamingEvents) { + public SessionConfig setIncludeSubAgentStreamingEvents(boolean includeSubAgentStreamingEvents) { this.includeSubAgentStreamingEvents = includeSubAgentStreamingEvents; return this; } + /** + * Clears the includeSubAgentStreamingEvents setting, reverting to the default + * behavior. + * + * @return this instance for method chaining + */ + public SessionConfig clearIncludeSubAgentStreamingEvents() { + this.includeSubAgentStreamingEvents = null; + return this; + } + /** * Gets the model capabilities override. * @@ -736,6 +860,155 @@ public SessionConfig setOnElicitationRequest(ElicitationHandler onElicitationReq return this; } + /** + * Gets the exit-plan-mode request handler. + * + * @return the exit-plan-mode handler, or {@code null} + * @since 1.0.8 + */ + public ExitPlanModeHandler getOnExitPlanMode() { + return onExitPlanMode; + } + + /** + * Sets a handler for exit-plan-mode requests from the server. + *

+ * When provided, the server will route {@code exitPlanMode.request} callbacks + * to this handler. + * + * @param onExitPlanMode + * the exit-plan-mode handler + * @return this config instance for method chaining + * @see ExitPlanModeHandler + * @since 1.0.8 + */ + public SessionConfig setOnExitPlanMode(ExitPlanModeHandler onExitPlanMode) { + this.onExitPlanMode = onExitPlanMode; + return this; + } + + /** + * Gets the auto-mode-switch request handler. + * + * @return the auto-mode-switch handler, or {@code null} + * @since 1.0.8 + */ + public AutoModeSwitchHandler getOnAutoModeSwitch() { + return onAutoModeSwitch; + } + + /** + * Sets a handler for auto-mode-switch requests from the server. + *

+ * When provided, the server will route {@code autoModeSwitch.request} callbacks + * to this handler. + * + * @param onAutoModeSwitch + * the auto-mode-switch handler + * @return this config instance for method chaining + * @see AutoModeSwitchHandler + * @since 1.0.8 + */ + public SessionConfig setOnAutoModeSwitch(AutoModeSwitchHandler onAutoModeSwitch) { + this.onAutoModeSwitch = onAutoModeSwitch; + return this; + } + + /** + * Gets the GitHub token for per-session authentication. + * + * @return the GitHub token, or {@code null} if not set + * @since 1.3.0 + */ + public String getGitHubToken() { + return gitHubToken; + } + + /** + * Sets the GitHub token for per-session authentication. + *

+ * When provided, the runtime resolves this token into a full GitHub identity + * and stores it on the session for content exclusion, model routing, and quota + * checks. + * + * @param gitHubToken + * the GitHub token for per-session authentication + * @return this config instance for method chaining + * @since 1.3.0 + */ + public SessionConfig setGitHubToken(String gitHubToken) { + this.gitHubToken = gitHubToken; + return this; + } + + /** + * Gets the per-session remote behavior control. + *

+ * Possible values: + *

    + *
  • {@code "off"} β€” local only, no remote export (default)
  • + *
  • {@code "export"} β€” export session events to GitHub without enabling + * remote steering
  • + *
  • {@code "on"} β€” export to GitHub AND enable remote steering
  • + *
+ * + * @return the remote session mode, or {@code null} if not set + * @since 1.4.0 + */ + public String getRemoteSession() { + return remoteSession; + } + + /** + * Sets the per-session remote behavior control. + *

+ * Possible values: + *

    + *
  • {@code "off"} β€” local only, no remote export (default)
  • + *
  • {@code "export"} β€” export session events to GitHub without enabling + * remote steering
  • + *
  • {@code "on"} β€” export to GitHub AND enable remote steering
  • + *
+ * + * @param remoteSession + * the remote session mode + * @return this config instance for method chaining + * @since 1.4.0 + */ + public SessionConfig setRemoteSession(String remoteSession) { + this.remoteSession = remoteSession; + return this; + } + + /** + * Gets the cloud session options. + *

+ * When set, creates a remote session in the cloud instead of a local session. + * The optional repository is associated with the cloud session. + * + * @return the cloud session options, or {@code null} if not set + * @since 1.5.0 + */ + public CloudSessionOptions getCloud() { + return cloud; + } + + /** + * Sets the cloud session options. + *

+ * When set, creates a remote session in the cloud instead of a local session. + * The optional repository is associated with the cloud session. + * + * @param cloud + * the cloud session options + * @return this config instance for method chaining + * @since 1.5.0 + */ + public SessionConfig setCloud(CloudSessionOptions cloud) { + this.cloud = cloud; + return this; + } + /** * Creates a shallow clone of this {@code SessionConfig} instance. *

@@ -759,6 +1032,7 @@ public SessionConfig clone() { copy.availableTools = this.availableTools != null ? new ArrayList<>(this.availableTools) : null; copy.excludedTools = this.excludedTools != null ? new ArrayList<>(this.excludedTools) : null; copy.provider = this.provider; + copy.enableSessionTelemetry = this.enableSessionTelemetry; copy.onPermissionRequest = this.onPermissionRequest; copy.onUserInputRequest = this.onUserInputRequest; copy.hooks = this.hooks; @@ -767,9 +1041,13 @@ public SessionConfig clone() { copy.includeSubAgentStreamingEvents = this.includeSubAgentStreamingEvents; copy.mcpServers = this.mcpServers != null ? new java.util.HashMap<>(this.mcpServers) : null; copy.customAgents = this.customAgents != null ? new ArrayList<>(this.customAgents) : null; + copy.defaultAgent = this.defaultAgent; copy.agent = this.agent; copy.infiniteSessions = this.infiniteSessions; copy.skillDirectories = this.skillDirectories != null ? new ArrayList<>(this.skillDirectories) : null; + copy.instructionDirectories = this.instructionDirectories != null + ? new ArrayList<>(this.instructionDirectories) + : null; copy.disabledSkills = this.disabledSkills != null ? new ArrayList<>(this.disabledSkills) : null; copy.configDir = this.configDir; copy.enableConfigDiscovery = this.enableConfigDiscovery; @@ -777,6 +1055,11 @@ public SessionConfig clone() { copy.onEvent = this.onEvent; copy.commands = this.commands != null ? new ArrayList<>(this.commands) : null; copy.onElicitationRequest = this.onElicitationRequest; + copy.onExitPlanMode = this.onExitPlanMode; + copy.onAutoModeSwitch = this.onAutoModeSwitch; + copy.gitHubToken = this.gitHubToken; + copy.remoteSession = this.remoteSession; + copy.cloud = this.cloud; return copy; } } diff --git a/src/main/java/com/github/copilot/sdk/json/SessionEndHookInput.java b/src/main/java/com/github/copilot/sdk/json/SessionEndHookInput.java index 79f63fbb93..0d3d3e2945 100644 --- a/src/main/java/com/github/copilot/sdk/json/SessionEndHookInput.java +++ b/src/main/java/com/github/copilot/sdk/json/SessionEndHookInput.java @@ -13,6 +13,8 @@ * This hook is invoked when a session ends, allowing you to perform cleanup or * logging. * + * @param sessionId + * the runtime session ID of the session that triggered the hook * @param timestamp * the timestamp in milliseconds since epoch when the session ended * @param cwd @@ -27,7 +29,8 @@ * @since 1.0.7 */ @JsonIgnoreProperties(ignoreUnknown = true) -public record SessionEndHookInput(@JsonProperty("timestamp") long timestamp, @JsonProperty("cwd") String cwd, +public record SessionEndHookInput(@JsonProperty("sessionId") String sessionId, + @JsonProperty("timestamp") long timestamp, @JsonProperty("cwd") String cwd, @JsonProperty("reason") String reason, @JsonProperty("finalMessage") String finalMessage, @JsonProperty("error") String error) { } diff --git a/src/main/java/com/github/copilot/sdk/json/SessionHooks.java b/src/main/java/com/github/copilot/sdk/json/SessionHooks.java index 8e22c3ee88..301d64cb55 100644 --- a/src/main/java/com/github/copilot/sdk/json/SessionHooks.java +++ b/src/main/java/com/github/copilot/sdk/json/SessionHooks.java @@ -38,6 +38,7 @@ public class SessionHooks { private PreToolUseHandler onPreToolUse; + private PreMcpToolCallHandler onPreMcpToolCall; private PostToolUseHandler onPostToolUse; private UserPromptSubmittedHandler onUserPromptSubmitted; private SessionStartHandler onSessionStart; @@ -64,6 +65,30 @@ public SessionHooks setOnPreToolUse(PreToolUseHandler onPreToolUse) { return this; } + /** + * Gets the pre-MCP-tool-call handler. + * + * @return the handler, or {@code null} if not set + * @since 1.0.8 + */ + public PreMcpToolCallHandler getOnPreMcpToolCall() { + return onPreMcpToolCall; + } + + /** + * Sets the handler called before an MCP tool call is dispatched to an MCP + * server. + * + * @param onPreMcpToolCall + * the handler + * @return this instance for method chaining + * @since 1.0.8 + */ + public SessionHooks setOnPreMcpToolCall(PreMcpToolCallHandler onPreMcpToolCall) { + this.onPreMcpToolCall = onPreMcpToolCall; + return this; + } + /** * Gets the post-tool-use handler. * @@ -160,7 +185,7 @@ public SessionHooks setOnSessionEnd(SessionEndHandler onSessionEnd) { * @return {@code true} if at least one hook handler is set */ public boolean hasHooks() { - return onPreToolUse != null || onPostToolUse != null || onUserPromptSubmitted != null || onSessionStart != null - || onSessionEnd != null; + return onPreToolUse != null || onPreMcpToolCall != null || onPostToolUse != null + || onUserPromptSubmitted != null || onSessionStart != null || onSessionEnd != null; } } diff --git a/src/main/java/com/github/copilot/sdk/json/SessionStartHookInput.java b/src/main/java/com/github/copilot/sdk/json/SessionStartHookInput.java index 2047175572..55bff3e262 100644 --- a/src/main/java/com/github/copilot/sdk/json/SessionStartHookInput.java +++ b/src/main/java/com/github/copilot/sdk/json/SessionStartHookInput.java @@ -13,6 +13,8 @@ * This hook is invoked when a session starts, allowing you to perform * initialization or modify the session configuration. * + * @param sessionId + * the runtime session ID of the session that triggered the hook * @param timestamp * the timestamp in milliseconds since epoch when the session started * @param cwd @@ -24,6 +26,7 @@ * @since 1.0.7 */ @JsonIgnoreProperties(ignoreUnknown = true) -public record SessionStartHookInput(@JsonProperty("timestamp") long timestamp, @JsonProperty("cwd") String cwd, +public record SessionStartHookInput(@JsonProperty("sessionId") String sessionId, + @JsonProperty("timestamp") long timestamp, @JsonProperty("cwd") String cwd, @JsonProperty("source") String source, @JsonProperty("initialPrompt") String initialPrompt) { } diff --git a/src/main/java/com/github/copilot/sdk/json/SessionUiCapabilities.java b/src/main/java/com/github/copilot/sdk/json/SessionUiCapabilities.java index 9b8e0b5872..d19d531eef 100644 --- a/src/main/java/com/github/copilot/sdk/json/SessionUiCapabilities.java +++ b/src/main/java/com/github/copilot/sdk/json/SessionUiCapabilities.java @@ -4,23 +4,31 @@ package com.github.copilot.sdk.json; +import java.util.Optional; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + /** * UI-specific capability flags for a session. * * @since 1.0.0 */ +@JsonInclude(JsonInclude.Include.NON_NULL) public class SessionUiCapabilities { + @JsonProperty("elicitation") private Boolean elicitation; /** * Returns whether the host supports interactive elicitation dialogs. * - * @return {@code true} if elicitation is supported, {@code false} or - * {@code null} otherwise + * @return an {@link Optional} containing the boolean value, or empty if not set */ - public Boolean getElicitation() { - return elicitation; + @JsonIgnore + public Optional getElicitation() { + return Optional.ofNullable(elicitation); } /** @@ -30,8 +38,19 @@ public Boolean getElicitation() { * {@code true} if elicitation is supported * @return this instance for method chaining */ - public SessionUiCapabilities setElicitation(Boolean elicitation) { + public SessionUiCapabilities setElicitation(boolean elicitation) { this.elicitation = elicitation; return this; } + + /** + * Clears the elicitation setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public SessionUiCapabilities clearElicitation() { + this.elicitation = null; + return this; + } + } diff --git a/src/main/java/com/github/copilot/sdk/json/SetForegroundSessionRequest.java b/src/main/java/com/github/copilot/sdk/json/SetForegroundSessionRequest.java new file mode 100644 index 0000000000..d3944871a0 --- /dev/null +++ b/src/main/java/com/github/copilot/sdk/json/SetForegroundSessionRequest.java @@ -0,0 +1,20 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk.json; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request body for session.setForeground RPC call. + *

+ * Using an explicit record type (rather than an ad-hoc map) ensures correct + * JSON serialization in all execution environments. + * + * @since 1.0.0 + */ +public record SetForegroundSessionRequest( + /** The session ID to bring to the foreground. */ + @JsonProperty("sessionId") String sessionId) { +} diff --git a/src/main/java/com/github/copilot/sdk/json/TelemetryConfig.java b/src/main/java/com/github/copilot/sdk/json/TelemetryConfig.java index 8407ab6098..7272c98841 100644 --- a/src/main/java/com/github/copilot/sdk/json/TelemetryConfig.java +++ b/src/main/java/com/github/copilot/sdk/json/TelemetryConfig.java @@ -4,6 +4,11 @@ package com.github.copilot.sdk.json; +import java.util.Optional; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; + /** * OpenTelemetry configuration for the Copilot CLI server. *

@@ -21,6 +26,7 @@ * @see CopilotClientOptions#setTelemetry(TelemetryConfig) * @since 1.2.0 */ +@JsonInclude(JsonInclude.Include.NON_NULL) public class TelemetryConfig { private String otlpEndpoint; @@ -128,11 +134,13 @@ public TelemetryConfig setSourceName(String sourceName) { * Maps to the {@code OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT} * environment variable. * - * @return {@code true} to capture content, {@code false} to suppress it, or - * {@code null} to use the default + * @return an {@link java.util.Optional} containing {@code true} to capture + * content or {@code false} to suppress it, or + * {@link java.util.Optional#empty()} to use the default */ - public Boolean getCaptureContent() { - return captureContent; + @JsonIgnore + public Optional getCaptureContent() { + return Optional.ofNullable(captureContent); } /** @@ -142,8 +150,19 @@ public Boolean getCaptureContent() { * {@code true} to capture content, {@code false} to suppress it * @return this config for method chaining */ - public TelemetryConfig setCaptureContent(Boolean captureContent) { + public TelemetryConfig setCaptureContent(boolean captureContent) { this.captureContent = captureContent; return this; } + + /** + * Clears the captureContent setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public TelemetryConfig clearCaptureContent() { + this.captureContent = null; + return this; + } + } diff --git a/src/main/java/com/github/copilot/sdk/json/UserInputRequest.java b/src/main/java/com/github/copilot/sdk/json/UserInputRequest.java index 9b466f866c..23b0d88123 100644 --- a/src/main/java/com/github/copilot/sdk/json/UserInputRequest.java +++ b/src/main/java/com/github/copilot/sdk/json/UserInputRequest.java @@ -8,7 +8,10 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Optional; /** * Request for user input from the agent. @@ -19,6 +22,7 @@ * @since 1.0.6 */ @JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) public class UserInputRequest { @JsonProperty("question") @@ -75,11 +79,13 @@ public UserInputRequest setChoices(List choices) { /** * Returns whether freeform text input is allowed. * - * @return {@code true} if freeform input is allowed, {@code null} if not + * @return an {@link java.util.Optional} containing {@code true} if freeform + * input is allowed, or {@link java.util.Optional#empty()} if not * specified */ - public Boolean getAllowFreeform() { - return allowFreeform; + @JsonIgnore + public Optional getAllowFreeform() { + return Optional.ofNullable(allowFreeform); } /** @@ -89,8 +95,19 @@ public Boolean getAllowFreeform() { * {@code true} to allow freeform input * @return this instance for method chaining */ - public UserInputRequest setAllowFreeform(Boolean allowFreeform) { + public UserInputRequest setAllowFreeform(boolean allowFreeform) { this.allowFreeform = allowFreeform; return this; } + + /** + * Clears the allowFreeform setting, reverting to the default behavior. + * + * @return this instance for method chaining + */ + public UserInputRequest clearAllowFreeform() { + this.allowFreeform = null; + return this; + } + } diff --git a/src/main/java/com/github/copilot/sdk/json/UserPromptSubmittedHookInput.java b/src/main/java/com/github/copilot/sdk/json/UserPromptSubmittedHookInput.java index bbfdf85bb3..2f3a0948df 100644 --- a/src/main/java/com/github/copilot/sdk/json/UserPromptSubmittedHookInput.java +++ b/src/main/java/com/github/copilot/sdk/json/UserPromptSubmittedHookInput.java @@ -13,6 +13,8 @@ * This hook is invoked when the user submits a prompt, allowing you to * intercept and modify the prompt before it is processed. * + * @param sessionId + * the runtime session ID of the session that triggered the hook * @param timestamp * the timestamp in milliseconds since epoch when the prompt was * submitted @@ -23,6 +25,7 @@ * @since 1.0.7 */ @JsonIgnoreProperties(ignoreUnknown = true) -public record UserPromptSubmittedHookInput(@JsonProperty("timestamp") long timestamp, @JsonProperty("cwd") String cwd, +public record UserPromptSubmittedHookInput(@JsonProperty("sessionId") String sessionId, + @JsonProperty("timestamp") long timestamp, @JsonProperty("cwd") String cwd, @JsonProperty("prompt") String prompt) { } diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 0000000000..d912fb420f --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,26 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +/** + * GitHub Copilot SDK for Java. + */ +module com.github.copilot.sdk.java { + requires transitive com.fasterxml.jackson.annotation; + requires com.fasterxml.jackson.core; + requires transitive com.fasterxml.jackson.databind; + requires com.fasterxml.jackson.datatype.jsr310; + requires static com.github.spotbugs.annotations; + requires static java.compiler; + requires static java.net.http; + requires java.logging; + + exports com.github.copilot.sdk; + exports com.github.copilot.sdk.generated; + exports com.github.copilot.sdk.generated.rpc; + exports com.github.copilot.sdk.json; + + opens com.github.copilot.sdk to com.fasterxml.jackson.databind; + opens com.github.copilot.sdk.generated to com.fasterxml.jackson.databind; + opens com.github.copilot.sdk.json to com.fasterxml.jackson.databind; +} diff --git a/src/site/markdown/advanced.md b/src/site/markdown/advanced.md index 1209e2578f..85694185dd 100644 --- a/src/site/markdown/advanced.md +++ b/src/site/markdown/advanced.md @@ -53,6 +53,9 @@ This guide covers advanced scenarios for extending and customizing your Copilot - [Incoming Elicitation Handler](#Incoming_Elicitation_Handler) - [Session Capabilities](#Session_Capabilities) - [Outgoing Elicitation via session.getUi()](#Outgoing_Elicitation_via_session.getUi) +- [Mode Handlers](#Mode_Handlers) + - [Exit Plan Mode](#Exit_Plan_Mode) + - [Auto Mode Switch](#Auto_Mode_Switch) - [Getting Session Metadata by ID](#Getting_Session_Metadata_by_ID) --- @@ -383,6 +386,29 @@ var session = client.createSession( > **Note:** The `bearerToken` option accepts a **static token string** only. The SDK does not refresh this token automatically. If your token expires, requests will fail and you'll need to create a new session with a fresh token. +### Model Overrides + +Use `modelId` and `wireModel` to control model resolution and the model name on the wire: + +```java +var session = client.createSession( + new SessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL) + .setProvider(new ProviderConfig() + .setType("openai") + .setBaseUrl("https://api.openai.com/v1") + .setApiKey("sk-...") + .setModelId("gpt-4o") // Runtime config lookup + .setWireModel("my-finetune-v3") // Sent to the provider API + .setMaxPromptTokens(100_000) // Override max prompt tokens + .setMaxOutputTokens(4096)) // Override max output tokens +).get(); +``` + +- **`modelId`** β€” Well-known model name used by the runtime to look up agent configuration (tools, prompts, reasoning behavior) and default token limits. Also used as the wire model when `wireModel` is not set. +- **`wireModel`** β€” Model name sent to the provider API for inference. Use when the provider's model name (e.g., an Azure deployment name or a custom fine-tune name) differs from `modelId`. +- **`maxPromptTokens`** β€” Overrides the resolved model's default max prompt tokens. The runtime triggers conversation compaction when the prompt would exceed this limit. +- **`maxOutputTokens`** β€” Overrides the resolved model's default max output tokens. + ### Microsoft Foundry Local [Microsoft Foundry Local](https://foundrylocal.ai) lets you run AI models locally on your own device with an OpenAI-compatible API. Install it via the Foundry Local CLI, then point the SDK at your local endpoint: @@ -539,6 +565,8 @@ session.send("@code-reviewer Review src/Main.java").get(); | `tools` | List<String> | Tool names available to this agent | | `mcpServers` | Map | MCP servers available to this agent | | `infer` | Boolean | Whether the agent can be auto-selected based on context | +| `skills` | List<String> | Skill names to preload into the agent's context | +| `model` | String | Model identifier for this agent (e.g., "claude-haiku-4.5"); falls back to the parent session model if unavailable | ### Multiple Agents @@ -626,6 +654,31 @@ var session = client.createSession( --- +## Instruction Directories + +Provide additional directories containing custom instruction files. These instructions are automatically included in the system message for all conversations in the session. + +```java +var session = client.createSession( + new SessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL) + .setInstructionDirectories(List.of("/path/to/instructions")) +).get(); +``` + +Instruction files are discovered from `.github/instructions/` subdirectories within each specified path and should use the `.instructions.md` extension. + +This is also supported on session resume: + +```java +var session = client.resumeSession(sessionId, + new ResumeSessionConfig() + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL) + .setInstructionDirectories(List.of("/path/to/instructions")) +); +``` + +--- + ## Custom Configuration Directory Use a custom configuration directory for session settings: @@ -753,10 +806,10 @@ The `PermissionRequestResultKind` class provides well-known constants for common | Constant | Value | Meaning | |---|---|---| -| `PermissionRequestResultKind.APPROVED` | `"approved"` | The permission was approved | -| `PermissionRequestResultKind.DENIED_BY_RULES` | `"denied-by-rules"` | Denied by policy rules | -| `PermissionRequestResultKind.DENIED_COULD_NOT_REQUEST_FROM_USER` | `"denied-no-approval-rule-and-could-not-request-from-user"` | No rule and user could not be prompted | -| `PermissionRequestResultKind.DENIED_INTERACTIVELY_BY_USER` | `"denied-interactively-by-user"` | User denied interactively | +| `PermissionRequestResultKind.APPROVED` | `"approve-once"` | The permission was approved for this one instance | +| `PermissionRequestResultKind.REJECTED` | `"reject"` | The permission was denied interactively by the user | +| `PermissionRequestResultKind.USER_NOT_AVAILABLE` | `"user-not-available"` | Denied because user confirmation was unavailable | +| `PermissionRequestResultKind.NO_RESULT` | `"no-result"` | No permission decision was made (protocol v3 only) | You can also pass a raw string to `setKind(String)` for custom or extension values. Use [`PermissionHandler.APPROVE_ALL`](apidocs/com/github/copilot/sdk/json/PermissionHandler.html) to approve all @@ -774,6 +827,12 @@ var hooks = new SessionHooks() System.out.println("Tool: " + input.getToolName()); return CompletableFuture.completedFuture(PreToolUseHookOutput.allow()); }) + .setOnPreMcpToolCall((input, invocation) -> { + System.out.println("MCP Tool: " + input.getServerName() + "/" + input.getToolName()); + // Set metadata on the MCP request + JsonNode meta = mapper.valueToTree(Map.of("source", "my-app")); + return CompletableFuture.completedFuture(PreMcpToolCallHookOutput.withMeta(meta)); + }) .setOnPostToolUse((input, invocation) -> { System.out.println("Result: " + input.getToolResult()); return CompletableFuture.completedFuture(null); @@ -784,7 +843,7 @@ var session = client.createSession( ).get(); ``` -πŸ“– **[Full Session Hooks documentation β†’](hooks.html)** for all 5 hook types, inputs/outputs, and examples. +πŸ“– **[Full Session Hooks documentation β†’](hooks.html)** for all 6 hook types, inputs/outputs, and examples. --- @@ -1219,6 +1278,66 @@ All `getUi()` methods throw `IllegalStateException` if the host does not support --- +## Mode Handlers + +Mode handlers let your application respond to mode transitions requested by the Copilot CLI. + +### Exit Plan Mode + +When the model finishes creating a plan and wants to transition out of plan mode, it invokes the `exitPlanMode` handler. Register the handler via `SessionConfig.setOnExitPlanMode()`: + +```java +var session = client.createSession(new SessionConfig() + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL) + .setOnExitPlanMode((request, invocation) -> { + System.out.println("Plan summary: " + request.getSummary()); + System.out.println("Available actions: " + request.getActions()); + System.out.println("Recommended: " + request.getRecommendedAction()); + + return CompletableFuture.completedFuture( + new ExitPlanModeResult() + .setApproved(true) + .setSelectedAction("interactive") + .setFeedback("Looks good, proceed!")); + })).get(); +``` + +When no handler is registered, the SDK automatically approves the plan (`approved=true`). The handler receives an `ExitPlanModeRequest` with: + +| Field | Description | +|---------------------|-------------------------------------------------| +| `summary` | Summary of the plan that was created | +| `planContent` | Full content of the plan file | +| `actions` | Available actions (e.g., interactive, autopilot) | +| `recommendedAction` | The recommended action for the user | + +### Auto Mode Switch + +When the model encounters a rate limit or similar constraint, it may request to switch modes automatically. Register the handler via `SessionConfig.setOnAutoModeSwitch()`: + +```java +var session = client.createSession(new SessionConfig() + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL) + .setOnAutoModeSwitch((request, invocation) -> { + System.out.println("Error: " + request.getErrorCode()); + System.out.println("Retry after: " + request.getRetryAfterSeconds() + "s"); + + return CompletableFuture.completedFuture(AutoModeSwitchResponse.YES); + })).get(); +``` + +When no handler is registered, the SDK returns `NO` (declining the mode switch). The response options are: + +| Response | Description | +|---------------------------------|------------------------------------------| +| `AutoModeSwitchResponse.YES` | Allow the mode switch this time | +| `AutoModeSwitchResponse.YES_ALWAYS`| Always allow automatic mode switches | +| `AutoModeSwitchResponse.NO` | Decline the mode switch | + +Both handlers are also available on `ResumeSessionConfig` for resumed sessions. + +--- + ## Getting Session Metadata by ID Retrieve metadata for a specific session without listing all sessions: @@ -1237,10 +1356,63 @@ This is more efficient than `listSessions()` when you already know the session I --- +## Remote Sessions + +Remote sessions enable Mission Control integration, making sessions accessible from GitHub web and mobile. When enabled, sessions in a GitHub repository working directory receive a remote URL. + +### Enabling Remote Sessions + +Set `remote(true)` on the client options to enable remote session support for all sessions: + +```java +var options = new CopilotClientOptions() + .setRemote(true) + .setCwd("/path/to/github-repo"); + +try (var client = new CopilotClient(options)) { + var session = client.createSession( + new SessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL) + ).get(); + + // Listen for the remote URL info event + session.on(SessionInfoEvent.class, event -> { + System.out.println("Remote URL: " + event.getData()); + }); +} +``` + +### Prerequisites + +- The user must be authenticated (GitHub token or logged-in user) +- The session's working directory must be a GitHub repository +- This option is only used when the SDK spawns the CLI process; it is ignored when connecting to an external server via `setCliUrl()` + +### Cloud Sessions + +Cloud sessions create a remote session in the cloud instead of a local session. Optionally associate repository metadata with the cloud session: + +```java +var cloudOptions = new CloudSessionOptions() + .setRepository(new CloudSessionRepository() + .setOwner("my-org") + .setName("my-repo") + .setBranch("main")); + +var session = client.createSession( + new SessionConfig() + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL) + .setCloud(cloudOptions) +).get(); +``` + +See [CloudSessionOptions](apidocs/com/github/copilot/sdk/json/CloudSessionOptions.html) and [CloudSessionRepository](apidocs/com/github/copilot/sdk/json/CloudSessionRepository.html) Javadoc for details. + +--- + ## Next Steps - πŸ“– **[Documentation](documentation.html)** - Core concepts, events, streaming, models, tool filtering, reasoning effort -- πŸ“– **[Session Hooks](hooks.html)** - All 5 hook types with inputs, outputs, and examples +- πŸ“– **[Session Hooks](hooks.html)** - All 6 hook types with inputs, outputs, and examples - πŸ“– **[MCP Servers](mcp.html)** - Local and remote MCP server integration - πŸ“– **[Setup & Deployment](setup.html)** - OAuth, backend services, scaling, configuration reference - πŸ“– **[API Javadoc](apidocs/index.html)** - Complete API reference diff --git a/src/site/markdown/cookbook/error-handling.md b/src/site/markdown/cookbook/error-handling.md index 5272b44b87..963b8b0933 100644 --- a/src/site/markdown/cookbook/error-handling.md +++ b/src/site/markdown/cookbook/error-handling.md @@ -30,7 +30,7 @@ jbang BasicErrorHandling.java **Code:** ```java -//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0 +//DEPS com.github:copilot-sdk-java:1.0.0-beta-java.4 import com.github.copilot.sdk.CopilotClient; import com.github.copilot.sdk.generated.AssistantMessageEvent; import com.github.copilot.sdk.json.MessageOptions; @@ -64,7 +64,7 @@ public class BasicErrorHandling { ## Handling specific error types ```java -//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0 +//DEPS com.github:copilot-sdk-java:1.0.0-beta-java.4 import com.github.copilot.sdk.CopilotClient; import java.util.concurrent.ExecutionException; @@ -99,7 +99,7 @@ public class SpecificErrorHandling { ## Timeout handling ```java -//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0 +//DEPS com.github:copilot-sdk-java:1.0.0-beta-java.4 import com.github.copilot.sdk.CopilotSession; import com.github.copilot.sdk.generated.AssistantMessageEvent; import com.github.copilot.sdk.json.MessageOptions; @@ -130,7 +130,7 @@ public class TimeoutHandling { ## Aborting a request ```java -//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0 +//DEPS com.github:copilot-sdk-java:1.0.0-beta-java.4 import com.github.copilot.sdk.CopilotSession; import com.github.copilot.sdk.json.MessageOptions; import java.util.concurrent.Executors; @@ -162,7 +162,7 @@ public class AbortRequest { ## Graceful shutdown ```java -//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0 +//DEPS com.github:copilot-sdk-java:1.0.0-beta-java.4 import com.github.copilot.sdk.CopilotClient; public class GracefulShutdown { @@ -192,7 +192,7 @@ public class GracefulShutdown { ## Try-with-resources pattern ```java -//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0 +//DEPS com.github:copilot-sdk-java:1.0.0-beta-java.4 import com.github.copilot.sdk.CopilotClient; import com.github.copilot.sdk.generated.AssistantMessageEvent; import com.github.copilot.sdk.json.MessageOptions; @@ -224,7 +224,7 @@ public class TryWithResources { ## Handling tool errors ```java -//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0 +//DEPS com.github:copilot-sdk-java:1.0.0-beta-java.4 import com.github.copilot.sdk.CopilotClient; import com.github.copilot.sdk.generated.AssistantMessageEvent; import com.github.copilot.sdk.json.MessageOptions; diff --git a/src/site/markdown/cookbook/managing-local-files.md b/src/site/markdown/cookbook/managing-local-files.md index 1deb78a51a..2a7b5540f9 100644 --- a/src/site/markdown/cookbook/managing-local-files.md +++ b/src/site/markdown/cookbook/managing-local-files.md @@ -34,7 +34,7 @@ jbang ManagingLocalFiles.java **Code:** ```java -//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0 +//DEPS com.github:copilot-sdk-java:1.0.0-beta-java.4 import com.github.copilot.sdk.CopilotClient; import com.github.copilot.sdk.generated.AssistantMessageEvent; import com.github.copilot.sdk.generated.SessionIdleEvent; @@ -161,7 +161,7 @@ session.send(new MessageOptions().setPrompt(prompt)); ## Interactive file organization ```java -//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0 +//DEPS com.github:copilot-sdk-java:1.0.0-beta-java.4 import java.io.BufferedReader; import java.io.InputStreamReader; diff --git a/src/site/markdown/cookbook/multiple-sessions.md b/src/site/markdown/cookbook/multiple-sessions.md index 8c95660d2b..84da5a2556 100644 --- a/src/site/markdown/cookbook/multiple-sessions.md +++ b/src/site/markdown/cookbook/multiple-sessions.md @@ -30,7 +30,7 @@ jbang MultipleSessions.java **Code:** ```java -//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0 +//DEPS com.github:copilot-sdk-java:1.0.0-beta-java.4 import com.github.copilot.sdk.CopilotClient; import com.github.copilot.sdk.generated.AssistantMessageEvent; import com.github.copilot.sdk.json.MessageOptions; @@ -123,7 +123,7 @@ try { ## Managing session lifecycle with CompletableFuture ```java -//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0 +//DEPS com.github:copilot-sdk-java:1.0.0-beta-java.4 import java.util.concurrent.CompletableFuture; import java.util.List; diff --git a/src/site/markdown/cookbook/persisting-sessions.md b/src/site/markdown/cookbook/persisting-sessions.md index fb00e7f510..ef80fd3d09 100644 --- a/src/site/markdown/cookbook/persisting-sessions.md +++ b/src/site/markdown/cookbook/persisting-sessions.md @@ -30,7 +30,7 @@ jbang PersistingSessions.java **Code:** ```java -//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0 +//DEPS com.github:copilot-sdk-java:1.0.0-beta-java.4 import com.github.copilot.sdk.CopilotClient; import com.github.copilot.sdk.generated.AssistantMessageEvent; import com.github.copilot.sdk.json.MessageOptions; @@ -127,7 +127,7 @@ public class DeleteSession { ## Getting session history ```java -//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0 +//DEPS com.github:copilot-sdk-java:1.0.0-beta-java.4 import com.github.copilot.sdk.CopilotClient; import com.github.copilot.sdk.generated.AssistantMessageEvent; import com.github.copilot.sdk.generated.UserMessageEvent; @@ -162,7 +162,7 @@ public class SessionHistory { ## Complete example with session management ```java -//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0 +//DEPS com.github:copilot-sdk-java:1.0.0-beta-java.4 import java.util.Scanner; public class SessionManager { diff --git a/src/site/markdown/cookbook/pr-visualization.md b/src/site/markdown/cookbook/pr-visualization.md index c0923e2262..1036bb0f7d 100644 --- a/src/site/markdown/cookbook/pr-visualization.md +++ b/src/site/markdown/cookbook/pr-visualization.md @@ -34,7 +34,7 @@ jbang PRVisualization.java github/copilot-sdk ## Full example: PRVisualization.java ```java -//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0 +//DEPS com.github:copilot-sdk-java:1.0.0-beta-java.4 import com.github.copilot.sdk.CopilotClient; import com.github.copilot.sdk.generated.AssistantMessageEvent; import com.github.copilot.sdk.generated.ToolExecutionStartEvent; diff --git a/src/site/markdown/hooks.md b/src/site/markdown/hooks.md index 97c7468915..cb978ef8b0 100644 --- a/src/site/markdown/hooks.md +++ b/src/site/markdown/hooks.md @@ -9,6 +9,7 @@ Session hooks allow you to intercept and modify tool execution, user prompts, an | Hook | When It's Called | Can Modify | |------|------------------|------------| | [Pre-Tool Use](#Pre-Tool_Use_Hook) | Before a tool executes | Tool arguments, permission decision | +| [Pre-MCP-Tool-Call](#Pre-MCP-Tool-Call_Hook) | Before an MCP tool call is dispatched | MCP request metadata (`_meta`) | | [Post-Tool Use](#Post-Tool_Use_Hook) | After a tool executes | Tool result, additional context | | [User Prompt Submitted](#User_Prompt_Submitted_Hook) | When user sends a message | Nothing (observation only) | | [Session Start](#Session_Start_Hook) | When session begins | Nothing (observation only) | @@ -53,6 +54,7 @@ Called **before** a tool executes. Use this to: | Field | Type | Description | |-------|------|-------------| +| `getSessionId()` | `String` | Runtime session ID of the session that triggered the hook | | `getToolName()` | `String` | Name of the tool being called | | `getToolArgs()` | `JsonNode` | Arguments passed to the tool | | `getCwd()` | `String` | Current working directory | @@ -118,6 +120,53 @@ var hooks = new SessionHooks() --- +## Pre-MCP-Tool-Call Hook + +Called **before** an MCP tool call is dispatched to an MCP server. Use this to: +- Inspect or log MCP tool calls +- Set, replace, or remove MCP request metadata (`_meta`) + +### Input + +| Field | Type | Description | +|-------|------|-------------| +| `getSessionId()` | `String` | Runtime session ID of the session that triggered the hook | +| `getTimestamp()` | `long` | Unix timestamp in milliseconds | +| `getCwd()` | `String` | Current working directory | +| `getServerName()` | `String` | Name of the MCP server being called | +| `getToolName()` | `String` | Name of the MCP tool being called | +| `getArguments()` | `JsonNode` | Arguments for the MCP tool call | +| `getToolCallId()` | `String` | Tool call ID (may be null) | +| `getMeta()` | `Map` | Existing MCP request metadata (may be null) | + +### Output + +Return `null` from the handler to preserve existing `_meta` (no-op). Otherwise, return a `PreMcpToolCallHookOutput`: + +| Factory Method | Effect | +|----------------|--------| +| `PreMcpToolCallHookOutput.withMeta(jsonNode)` | Replace `_meta` with the given JSON object | +| `PreMcpToolCallHookOutput.removeMeta()` | Remove `_meta` from the request | + +### Example: Inject metadata into MCP requests + +```java +var hooks = new SessionHooks() + .setOnPreMcpToolCall((input, invocation) -> { + System.out.println("MCP call: " + input.getServerName() + "/" + input.getToolName()); + + // Inject custom metadata into the MCP request + var mapper = new ObjectMapper(); + JsonNode meta = mapper.valueToTree(Map.of( + "source", "my-application", + "requestId", UUID.randomUUID().toString() + )); + return CompletableFuture.completedFuture(PreMcpToolCallHookOutput.withMeta(meta)); + }); +``` + +--- + ## Post-Tool Use Hook Called **after** a tool executes. Use this to: @@ -130,6 +179,7 @@ Called **after** a tool executes. Use this to: | Field | Type | Description | |-------|------|-------------| +| `getSessionId()` | `String` | Runtime session ID of the session that triggered the hook | | `getToolName()` | `String` | Name of the tool that was called | | `getToolArgs()` | `JsonNode` | Arguments that were passed | | `getToolResult()` | `JsonNode` | Result from the tool | @@ -187,8 +237,9 @@ Called when the user submits a prompt, before the LLM processes it. This is an o | Field | Type | Description | |-------|------|-------------| +| `sessionId()` | `String` | Runtime session ID of the session that triggered the hook | | `prompt()` | `String` | The user's prompt text | -| `getTimestamp()` | `long` | Timestamp in milliseconds | +| `timestamp()` | `long` | Timestamp in milliseconds | ### Output @@ -221,8 +272,9 @@ Called when a session starts (either new or resumed). | Field | Type | Description | |-------|------|-------------| +| `sessionId()` | `String` | Runtime session ID of the session that triggered the hook | | `source()` | `String` | `"startup"`, `"resume"`, or `"new"` | -| `getTimestamp()` | `long` | Timestamp in milliseconds | +| `timestamp()` | `long` | Timestamp in milliseconds | ### Output @@ -253,8 +305,9 @@ Called when a session ends. | Field | Type | Description | |-------|------|-------------| +| `sessionId()` | `String` | Runtime session ID of the session that triggered the hook | | `reason()` | `String` | Why the session ended | -| `getTimestamp()` | `long` | Timestamp in milliseconds | +| `timestamp()` | `long` | Timestamp in milliseconds | ### Output diff --git a/src/site/markdown/setup.md b/src/site/markdown/setup.md index 10c1cb3d80..224fc1948c 100644 --- a/src/site/markdown/setup.md +++ b/src/site/markdown/setup.md @@ -157,12 +157,28 @@ try (var client = new CopilotClient(options)) { Multiple application instances can share a single CLI server: ```java -// In different parts of your application or different containers -var client1 = new CopilotClient(new CopilotClientOptions().setCliUrl("cli-server:4321")); -var client2 = new CopilotClient(new CopilotClientOptions().setCliUrl("cli-server:4321")); +// Use an explicit connection token so all clients can authenticate +var token = "my-shared-secret"; +var client1 = new CopilotClient(new CopilotClientOptions() + .setCliUrl("cli-server:4321").setTcpConnectionToken(token)); +var client2 = new CopilotClient(new CopilotClientOptions() + .setCliUrl("cli-server:4321").setTcpConnectionToken(token)); // Both connect to the same CLI server ``` +### Connection Token (TCP Security) + +When the SDK spawns the CLI in TCP mode, a random connection token is generated automatically +to protect the loopback listener. You can also provide an explicit token: + +```java +var options = new CopilotClientOptions() + .setUseStdio(false) + .setTcpConnectionToken("my-secret-token"); +``` + +> **Note:** `tcpConnectionToken` cannot be used with `useStdio = true`. + ### Deployment Patterns **Container deployment:** @@ -340,10 +356,12 @@ Complete list of `CopilotClientOptions` settings: | `cliPath` | String | Path to CLI executable | `"copilot"` from PATH | | `cliUrl` | String | External CLI server URL | `null` (spawn process) | | `cliArgs` | String[] | Extra CLI arguments | `null` | +| `copilotHome` | String | Base directory for Copilot data | `null` (~/.copilot) | | `gitHubToken` | String | GitHub OAuth token | `null` | | `useLoggedInUser` | Boolean | Use system credentials | `true` | | `useStdio` | boolean | Use stdio transport | `true` | | `port` | int | TCP port for CLI | `0` (random) | +| `tcpConnectionToken` | String | Connection token for TCP mode | `null` (auto-generated) | | `autoStart` | boolean | Auto-start server | `true` | | `autoRestart` | boolean | Auto-restart on crash | `true` | | `logLevel` | String | CLI log level | `"info"` | diff --git a/src/test/java/com/github/copilot/sdk/CapiProxy.java b/src/test/java/com/github/copilot/sdk/CapiProxy.java index bcd064d949..09c4e20161 100644 --- a/src/test/java/com/github/copilot/sdk/CapiProxy.java +++ b/src/test/java/com/github/copilot/sdk/CapiProxy.java @@ -56,10 +56,12 @@ public class CapiProxy implements AutoCloseable { private static final ObjectMapper MAPPER = new ObjectMapper(); - private static final Pattern LISTENING_PATTERN = Pattern.compile("Listening: (http://[^\\s]+)"); + private static final Pattern LISTENING_PATTERN = Pattern.compile("Listening: (http://[^\\s]+)(?:\\s+(\\{.*\\}))?$"); private Process process; private String proxyUrl; + private String connectProxyUrl; + private String caFilePath; private final HttpClient httpClient; private BufferedReader stdoutReader; @@ -96,6 +98,10 @@ public String start() throws IOException, InterruptedException { : new ProcessBuilder("npx", "tsx", "server.ts"); pb.directory(harnessDir.toFile()); pb.redirectErrorStream(false); + // Tell the replaying proxy to fail fast on unmatched requests rather than + // forwarding them to the real API. Without this, unmatched requests hit the + // live API with a fake token and crash the proxy's JSON parser. + pb.environment().put("GITHUB_ACTIONS", "true"); process = pb.start(); @@ -137,7 +143,24 @@ public String start() throws IOException, InterruptedException { throw new IOException("Unexpected proxy output: " + line); } - proxyUrl = matcher.group(1); + String url = matcher.group(1); + + // Parse optional metadata (CONNECT proxy details) + String metadata = matcher.group(2); + if (metadata != null && !metadata.isEmpty()) { + try { + Map meta = MAPPER.readValue(metadata, new TypeReference>() { + }); + connectProxyUrl = meta.get("connectProxyUrl"); + caFilePath = meta.get("caFilePath"); + } catch (Exception e) { + process.destroyForcibly(); + throw new IOException("Failed to parse proxy startup metadata: " + metadata, e); + } + } + + // Only set proxyUrl after all parsing succeeds to avoid inconsistent state + proxyUrl = url; return proxyUrl; } @@ -219,6 +242,54 @@ public List> getExchanges() throws IOException, InterruptedE }); } + /** + * Configures the proxy to return a specific Copilot user response for a given + * token. Used for per-session authentication tests. + * + * @param token + * the GitHub token to configure + * @param login + * the user login to return + * @param copilotPlan + * the Copilot plan to return + * @param apiUrl + * the API URL for the user endpoints + * @param telemetryUrl + * the telemetry URL for the user endpoints + * @param analyticsTrackingId + * the analytics tracking ID for the user + * @throws IOException + * if the request fails + * @throws InterruptedException + * if the request is interrupted + */ + public void setCopilotUserByToken(String token, String login, String copilotPlan, String apiUrl, + String telemetryUrl, String analyticsTrackingId) throws IOException, InterruptedException { + if (proxyUrl == null) { + throw new IllegalStateException("Proxy not started"); + } + + Map payload = new java.util.HashMap<>(); + payload.put("token", token); + Map responseMap = new java.util.HashMap<>(); + responseMap.put("login", login); + responseMap.put("copilotPlan", copilotPlan); + responseMap.put("endpoints", Map.of("api", apiUrl, "telemetry", telemetryUrl)); + responseMap.put("analyticsTrackingId", analyticsTrackingId); + payload.put("response", responseMap); + + String body = MAPPER.writeValueAsString(payload); + + HttpRequest request = HttpRequest.newBuilder().uri(URI.create(proxyUrl + "/copilot-user-config")) + .header("Content-Type", "application/json").POST(HttpRequest.BodyPublishers.ofString(body)).build(); + + HttpResponse response = httpClient.send(request, HttpResponse.BodyHandlers.ofString()); + if (response.statusCode() != 200) { + throw new IOException( + "Failed to set copilot user config: " + response.statusCode() + ": " + response.body()); + } + } + /** * Stops the proxy server gracefully. * @@ -281,6 +352,8 @@ public void stop(boolean skipWritingCache) throws IOException, InterruptedExcept process = null; proxyUrl = null; + connectProxyUrl = null; + caFilePath = null; } /** @@ -292,6 +365,24 @@ public String getProxyUrl() { return proxyUrl; } + /** + * Gets the CONNECT proxy URL for HTTPS interception. + * + * @return the CONNECT proxy URL, or null if not available + */ + public String getConnectProxyUrl() { + return connectProxyUrl; + } + + /** + * Gets the CA file path for trusting the CONNECT proxy's certificate. + * + * @return the CA file path, or null if not available + */ + public String getCaFilePath() { + return caFilePath; + } + /** * Checks if the proxy process is still alive and responsive. This does both a * process alive check AND an HTTP health check. diff --git a/src/test/java/com/github/copilot/sdk/CliServerManagerTest.java b/src/test/java/com/github/copilot/sdk/CliServerManagerTest.java index e556839cce..90e6dcc3c3 100644 --- a/src/test/java/com/github/copilot/sdk/CliServerManagerTest.java +++ b/src/test/java/com/github/copilot/sdk/CliServerManagerTest.java @@ -250,4 +250,26 @@ void startCliServerWithTelemetryCaptureContentFalse() throws Exception { var ex = assertThrows(IOException.class, () -> manager.startCliServer()); assertNotNull(ex); } + + @Test + void startCliServerWithSessionIdleTimeout() throws Exception { + // Test that --session-idle-timeout flag is included when option is set + var options = new CopilotClientOptions().setCliPath(NONEXISTENT_CLI).setSessionIdleTimeoutSeconds(600) + .setUseStdio(true); + var manager = new CliServerManager(options); + + var ex = assertThrows(IOException.class, () -> manager.startCliServer()); + assertNotNull(ex); + } + + @Test + void startCliServerWithZeroSessionIdleTimeout() throws Exception { + // Zero timeout should not add the flag (treated as disabled) + var options = new CopilotClientOptions().setCliPath(NONEXISTENT_CLI).setSessionIdleTimeoutSeconds(0) + .setUseStdio(true); + var manager = new CliServerManager(options); + + var ex = assertThrows(IOException.class, () -> manager.startCliServer()); + assertNotNull(ex); + } } diff --git a/src/test/java/com/github/copilot/sdk/CompactionTest.java b/src/test/java/com/github/copilot/sdk/CompactionTest.java index da24dabd15..306eeb6c72 100644 --- a/src/test/java/com/github/copilot/sdk/CompactionTest.java +++ b/src/test/java/com/github/copilot/sdk/CompactionTest.java @@ -12,6 +12,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; @@ -52,10 +53,17 @@ static void teardown() throws Exception { /** * Verifies that compaction is triggered with low threshold and emits events. * + *

+ * Disabled due to flakiness β€” compaction timing is non-deterministic and the + * snapshot cannot reliably match across platforms. The reference implementation + * (nodejs) also skips this test. See copilot-sdk#1227. + * * @see Snapshot: * compaction/should_trigger_compaction_with_low_threshold_and_emit_events */ @Test + @Disabled("Flaky: compaction timing varies by platform β€” see https://github.com/github/copilot-sdk/issues/1227") @Timeout(value = 300, unit = TimeUnit.SECONDS) void testShouldTriggerCompactionWithLowThresholdAndEmitEvents() throws Exception { ctx.configureForTest("compaction", "should_trigger_compaction_with_low_threshold_and_emit_events"); diff --git a/src/test/java/com/github/copilot/sdk/ConfigCloneTest.java b/src/test/java/com/github/copilot/sdk/ConfigCloneTest.java index 89f03de2de..09bd3ee385 100644 --- a/src/test/java/com/github/copilot/sdk/ConfigCloneTest.java +++ b/src/test/java/com/github/copilot/sdk/ConfigCloneTest.java @@ -16,7 +16,10 @@ import org.junit.jupiter.api.Test; import com.github.copilot.sdk.generated.SessionEvent; +import com.github.copilot.sdk.json.AutoModeSwitchResponse; import com.github.copilot.sdk.json.CopilotClientOptions; +import com.github.copilot.sdk.json.DefaultAgentConfig; +import com.github.copilot.sdk.json.ExitPlanModeResult; import com.github.copilot.sdk.json.InfiniteSessionConfig; import com.github.copilot.sdk.json.MessageOptions; import com.github.copilot.sdk.json.ModelInfo; @@ -35,6 +38,11 @@ void copilotClientOptionsCloneBasic() { original.setPort(9000); original.setGitHubToken("ghp_test"); original.setUseLoggedInUser(false); + original.setCopilotHome("/custom/copilot/home"); + original.setRemote(true); + original.setSessionIdleTimeoutSeconds(600); + original.setUseStdio(false); + original.setTcpConnectionToken("my-token-123"); CopilotClientOptions cloned = original.clone(); @@ -43,6 +51,10 @@ void copilotClientOptionsCloneBasic() { assertEquals(original.getPort(), cloned.getPort()); assertEquals(original.getGitHubToken(), cloned.getGitHubToken()); assertEquals(original.getUseLoggedInUser(), cloned.getUseLoggedInUser()); + assertEquals(original.getCopilotHome(), cloned.getCopilotHome()); + assertEquals(original.isRemote(), cloned.isRemote()); + assertEquals(original.getSessionIdleTimeoutSeconds(), cloned.getSessionIdleTimeoutSeconds()); + assertEquals(original.getTcpConnectionToken(), cloned.getTcpConnectionToken()); } @Test @@ -119,6 +131,7 @@ void sessionConfigListIndependence() { toolList.add("grep"); toolList.add("bash"); original.setAvailableTools(toolList); + original.setInstructionDirectories(new ArrayList<>(List.of("/path/a", "/path/b"))); SessionConfig cloned = original.clone(); @@ -128,6 +141,7 @@ void sessionConfigListIndependence() { // The cloned config should be unaffected by mutations to the original list assertEquals(2, cloned.getAvailableTools().size()); assertEquals(3, original.getAvailableTools().size()); + assertEquals(List.of("/path/a", "/path/b"), cloned.getInstructionDirectories()); } @Test @@ -182,6 +196,44 @@ void messageOptionsCloneBasic() { assertEquals(original.getMode(), cloned.getMode()); } + @Test + void sessionConfigEnableSessionTelemetryCopied() { + SessionConfig original = new SessionConfig(); + original.setEnableSessionTelemetry(false); + + SessionConfig cloned = original.clone(); + + assertFalse(cloned.getEnableSessionTelemetry().orElse(true)); + } + + @Test + void sessionConfigEnableSessionTelemetryDefaultIsNull() { + SessionConfig original = new SessionConfig(); + + SessionConfig cloned = original.clone(); + + assertTrue(cloned.getEnableSessionTelemetry().isEmpty()); + } + + @Test + void resumeSessionConfigEnableSessionTelemetryCopied() { + ResumeSessionConfig original = new ResumeSessionConfig(); + original.setEnableSessionTelemetry(false); + + ResumeSessionConfig cloned = original.clone(); + + assertFalse(cloned.getEnableSessionTelemetry().orElse(true)); + } + + @Test + void resumeSessionConfigEnableSessionTelemetryDefaultIsNull() { + ResumeSessionConfig original = new ResumeSessionConfig(); + + ResumeSessionConfig cloned = original.clone(); + + assertTrue(cloned.getEnableSessionTelemetry().isEmpty()); + } + @Test void clonePreservesNullFields() { CopilotClientOptions opts = new CopilotClientOptions(); @@ -249,11 +301,11 @@ void copilotClientOptionsSetTelemetry() { } @Test - void copilotClientOptionsSetUseLoggedInUserNull() { + void copilotClientOptionsClearUseLoggedInUser() { var opts = new CopilotClientOptions(); - opts.setUseLoggedInUser(null); - // null β†’ Boolean.FALSE - assertEquals(Boolean.FALSE, opts.getUseLoggedInUser()); + opts.setUseLoggedInUser(true); + opts.clearUseLoggedInUser(); + assertTrue(opts.getUseLoggedInUser().isEmpty()); } @Test @@ -289,4 +341,68 @@ void resumeSessionConfigAllSetters() { config.setInfiniteSessions(infiniteConfig); assertSame(infiniteConfig, config.getInfiniteSessions()); } + + @Test + void sessionConfigNewFieldsCloned() { + SessionConfig original = new SessionConfig(); + original.setGitHubToken("ghp_per_session_token"); + DefaultAgentConfig defaultAgent = new DefaultAgentConfig().setExcludedTools(List.of("secret_tool")); + original.setDefaultAgent(defaultAgent); + + SessionConfig cloned = original.clone(); + + assertEquals("ghp_per_session_token", cloned.getGitHubToken()); + assertSame(defaultAgent, cloned.getDefaultAgent()); + } + + @Test + void resumeSessionConfigNewFieldsCloned() { + ResumeSessionConfig original = new ResumeSessionConfig(); + original.setGitHubToken("ghp_per_session_token"); + DefaultAgentConfig defaultAgent = new DefaultAgentConfig().setExcludedTools(List.of("secret_tool")); + original.setDefaultAgent(defaultAgent); + + ResumeSessionConfig cloned = original.clone(); + + assertEquals("ghp_per_session_token", cloned.getGitHubToken()); + assertSame(defaultAgent, cloned.getDefaultAgent()); + } + + @Test + void copilotClientOptionsSessionIdleTimeoutCloned() { + CopilotClientOptions original = new CopilotClientOptions(); + original.setSessionIdleTimeoutSeconds(600); + + CopilotClientOptions cloned = original.clone(); + + assertEquals(600, cloned.getSessionIdleTimeoutSeconds().getAsInt()); + } + + @Test + void sessionConfigCloneCopiesModeSwitchHandlers() { + SessionConfig original = new SessionConfig(); + original.setOnExitPlanMode( + (request, invocation) -> CompletableFuture.completedFuture(new ExitPlanModeResult())); + original.setOnAutoModeSwitch( + (request, invocation) -> CompletableFuture.completedFuture(AutoModeSwitchResponse.NO)); + + SessionConfig cloned = original.clone(); + + assertSame(original.getOnExitPlanMode(), cloned.getOnExitPlanMode()); + assertSame(original.getOnAutoModeSwitch(), cloned.getOnAutoModeSwitch()); + } + + @Test + void resumeSessionConfigCloneCopiesModeSwitchHandlers() { + ResumeSessionConfig original = new ResumeSessionConfig(); + original.setOnExitPlanMode( + (request, invocation) -> CompletableFuture.completedFuture(new ExitPlanModeResult())); + original.setOnAutoModeSwitch( + (request, invocation) -> CompletableFuture.completedFuture(AutoModeSwitchResponse.NO)); + + ResumeSessionConfig cloned = original.clone(); + + assertSame(original.getOnExitPlanMode(), cloned.getOnExitPlanMode()); + assertSame(original.getOnAutoModeSwitch(), cloned.getOnAutoModeSwitch()); + } } diff --git a/src/test/java/com/github/copilot/sdk/CopilotClientTest.java b/src/test/java/com/github/copilot/sdk/CopilotClientTest.java index d69f6cf746..137ad360ba 100644 --- a/src/test/java/com/github/copilot/sdk/CopilotClientTest.java +++ b/src/test/java/com/github/copilot/sdk/CopilotClientTest.java @@ -20,6 +20,7 @@ import java.util.concurrent.ExecutionException; import static org.junit.jupiter.api.Assertions.*; +import java.util.Optional; /** * Tests for CopilotClient. @@ -91,7 +92,7 @@ void testStartAndConnectUsingStdio() throws Exception { PingResponse pong = client.ping("test message").get(); assertEquals("pong: test message", pong.message()); - assertTrue(pong.timestamp() >= 0); + assertNotNull(pong.timestamp()); client.stop().get(); assertEquals(ConnectionState.DISCONNECTED, client.getState()); @@ -153,14 +154,14 @@ void testGitHubTokenOptionAccepted() { void testUseLoggedInUserDefaultsToNull() { var options = new CopilotClientOptions().setCliPath("/path/to/cli"); - assertNull(options.getUseLoggedInUser()); + assertTrue(options.getUseLoggedInUser().isEmpty()); } @Test void testExplicitUseLoggedInUserFalse() { var options = new CopilotClientOptions().setCliPath("/path/to/cli").setUseLoggedInUser(false); - assertEquals(false, options.getUseLoggedInUser()); + assertEquals(Optional.of(false), options.getUseLoggedInUser()); } @Test @@ -168,7 +169,7 @@ void testExplicitUseLoggedInUserTrueWithGitHubToken() { var options = new CopilotClientOptions().setCliPath("/path/to/cli").setGitHubToken("gho_test_token") .setUseLoggedInUser(true); - assertEquals(true, options.getUseLoggedInUser()); + assertEquals(Optional.of(true), options.getUseLoggedInUser()); } @Test @@ -185,6 +186,44 @@ void testUseLoggedInUserWithCliUrlThrows() { assertThrows(IllegalArgumentException.class, () -> new CopilotClient(options)); } + @Test + void testSessionIdleTimeoutSecondsDefaultsToNull() { + var options = new CopilotClientOptions(); + + assertTrue(options.getSessionIdleTimeoutSeconds().isEmpty()); + } + + @Test + void testSessionIdleTimeoutSecondsOptionAccepted() { + var options = new CopilotClientOptions().setSessionIdleTimeoutSeconds(600); + + assertEquals(600, options.getSessionIdleTimeoutSeconds().getAsInt()); + } + + @Test + void testTcpConnectionTokenWithUseStdioThrows() { + var options = new CopilotClientOptions().setUseStdio(true).setTcpConnectionToken("my-token"); + + assertThrows(IllegalArgumentException.class, () -> new CopilotClient(options)); + } + + @Test + void testTcpConnectionTokenAcceptedInTcpMode() { + var options = new CopilotClientOptions().setUseStdio(false).setTcpConnectionToken("my-token"); + + // Should not throw + try (var client = new CopilotClient(options)) { + assertNotNull(client); + } + } + + @Test + void testCopilotHomeOptionSetOnOptions() { + var options = new CopilotClientOptions().setCopilotHome("/custom/home"); + + assertEquals("/custom/home", options.getCopilotHome()); + } + // ===== onLifecycle tests ===== /** diff --git a/src/test/java/com/github/copilot/sdk/CopilotSessionTest.java b/src/test/java/com/github/copilot/sdk/CopilotSessionTest.java index 0a5cfcaed3..6a2f758096 100644 --- a/src/test/java/com/github/copilot/sdk/CopilotSessionTest.java +++ b/src/test/java/com/github/copilot/sdk/CopilotSessionTest.java @@ -20,6 +20,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import com.github.copilot.sdk.generated.SessionEvent; @@ -34,6 +35,7 @@ import com.github.copilot.sdk.json.PermissionHandler; import com.github.copilot.sdk.json.ResumeSessionConfig; import com.github.copilot.sdk.json.SessionConfig; +import com.github.copilot.sdk.json.DefaultAgentConfig; import com.github.copilot.sdk.json.SystemMessageConfig; import com.github.copilot.sdk.json.ToolDefinition; @@ -305,6 +307,7 @@ void testShouldResumeSessionUsingTheSameClient() throws Exception { * @see Snapshot: session/should_resume_a_session_using_a_new_client */ @Test + @Tag("isolated-resume") void testShouldResumeSessionUsingNewClient() throws Exception { ctx.configureForTest("session", "should_resume_a_session_using_a_new_client"); @@ -757,12 +760,30 @@ void testShouldGetLastSessionId() throws Exception { .createSession(new SessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get(); session.sendAndWait(new MessageOptions().setPrompt("Say hello")).get(60, TimeUnit.SECONDS); + String sessionId = session.getSessionId(); + session.close(); - String lastId = client.getLastSessionId().get(30, TimeUnit.SECONDS); + // Poll until getLastSessionId returns the expected value. + // Session state is persisted asynchronously; polling keeps fast + // machines fast and slow CI safe (mirrors Node.js/.NET patterns). + String lastId = null; + long deadline = System.currentTimeMillis() + 10_000; + while (System.currentTimeMillis() < deadline) { + long remaining = Math.max(1, deadline - System.currentTimeMillis()); + long iterationTimeout = Math.min(remaining, 500); + try { + lastId = client.getLastSessionId().get(iterationTimeout, TimeUnit.MILLISECONDS); + } catch (java.util.concurrent.TimeoutException ignored) { + // RPC call took longer than the per-iteration cap; retry + continue; + } + if (sessionId.equals(lastId)) { + break; + } + Thread.sleep(50); + } assertNotNull(lastId, "Last session ID should not be null"); - assertEquals(session.getSessionId(), lastId, "Last session ID should match the current session ID"); - - session.close(); + assertEquals(sessionId, lastId, "Last session ID should match the current session ID"); } } @@ -837,11 +858,31 @@ void testShouldGetSessionMetadataById() throws Exception { var session = client .createSession(new SessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get(); + // Send a message to persist the session to disk session.sendAndWait(new MessageOptions().setPrompt("Say hello")).get(60, TimeUnit.SECONDS); - var metadata = client.getSessionMetadata(session.getSessionId()).get(30, TimeUnit.SECONDS); - assertNotNull(metadata, "Metadata should not be null for known session"); - assertEquals(session.getSessionId(), metadata.getSessionId(), "Metadata session ID should match"); + // Poll until metadata becomes available; the CLI persists session + // state asynchronously so it may not be queryable immediately + // (mirrors .NET WaitForConditionAsync pattern). + var sessionId = session.getSessionId(); + com.github.copilot.sdk.json.SessionMetadata metadata = null; + long deadline = System.currentTimeMillis() + 10_000; + while (System.currentTimeMillis() < deadline) { + long remaining = Math.max(1, deadline - System.currentTimeMillis()); + long iterationTimeout = Math.min(remaining, 500); + try { + metadata = client.getSessionMetadata(sessionId).get(iterationTimeout, TimeUnit.MILLISECONDS); + } catch (java.util.concurrent.TimeoutException ignored) { + // RPC call took longer than the per-iteration cap; retry + continue; + } + if (metadata != null) { + break; + } + Thread.sleep(50); + } + assertNotNull(metadata, "Timed out waiting for getSessionMetadata() to return the persisted session"); + assertEquals(sessionId, metadata.getSessionId(), "Metadata session ID should match"); // A non-existent session should return null var notFound = client.getSessionMetadata("non-existent-session-id").get(30, TimeUnit.SECONDS); @@ -876,4 +917,39 @@ void testGetRpcReturnsSessionRpcWithCorrectSessionId() throws Exception { session.close(); } } + + /** + * Verifies that sessions can be created with defaultAgent.excludedTools + * configuration. + * + * @see Snapshot: + * session/should_create_a_session_with_defaultagent_excludedtools + */ + @Test + void testShouldCreateSessionWithDefaultAgentExcludedTools() throws Exception { + ctx.configureForTest("session", "should_create_a_session_with_defaultagent_excludedtools"); + + Map parameters = new java.util.HashMap<>(); + parameters.put("type", "object"); + parameters.put("properties", new java.util.HashMap<>()); + + ToolDefinition secretTool = ToolDefinition.create("secret_tool", "A secret tool hidden from the default agent", + parameters, (invocation) -> CompletableFuture.completedFuture("SECRET")); + + try (CopilotClient client = ctx.createClient()) { + SessionConfig config = new SessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL) + .setTools(List.of(secretTool)) + .setDefaultAgent(new DefaultAgentConfig().setExcludedTools(List.of("secret_tool"))); + + CopilotSession session = client.createSession(config).get(); + + assertNotNull(session.getSessionId()); + + AssistantMessageEvent response = session.sendAndWait(new MessageOptions().setPrompt("What is 1+1?")).get(60, + TimeUnit.SECONDS); + + assertNotNull(response); + session.close(); + } + } } diff --git a/src/test/java/com/github/copilot/sdk/DataObjectCoverageTest.java b/src/test/java/com/github/copilot/sdk/DataObjectCoverageTest.java index 203f5faed6..3c83b8286d 100644 --- a/src/test/java/com/github/copilot/sdk/DataObjectCoverageTest.java +++ b/src/test/java/com/github/copilot/sdk/DataObjectCoverageTest.java @@ -10,7 +10,11 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; +import com.github.copilot.sdk.json.CustomAgentConfig; import com.github.copilot.sdk.json.GetForegroundSessionResponse; +import com.github.copilot.sdk.json.McpHttpServerConfig; +import com.github.copilot.sdk.json.McpStdioServerConfig; +import com.github.copilot.sdk.json.ModelCapabilitiesOverride; import com.github.copilot.sdk.json.PermissionRequest; import com.github.copilot.sdk.json.PermissionRequestResult; import com.github.copilot.sdk.json.PostToolUseHookInput; @@ -18,6 +22,7 @@ import com.github.copilot.sdk.json.PreToolUseHookInput; import com.github.copilot.sdk.json.PreToolUseHookOutput; import com.github.copilot.sdk.json.SectionOverride; +import com.github.copilot.sdk.json.SetForegroundSessionRequest; import com.github.copilot.sdk.json.SetForegroundSessionResponse; import com.github.copilot.sdk.json.ToolBinaryResult; import com.github.copilot.sdk.json.ToolResultObject; @@ -86,6 +91,14 @@ void getForegroundSessionResponseRecord() { assertEquals("/home/user/project", response.workspacePath()); } + // ===== SetForegroundSessionRequest record ===== + + @Test + void setForegroundSessionRequestRecord() { + var request = new SetForegroundSessionRequest("session-123"); + assertEquals("session-123", request.sessionId()); + } + // ===== SetForegroundSessionResponse record ===== @Test @@ -144,6 +157,14 @@ void preToolUseHookInputGetters() { assertEquals(0L, input.getTimestamp()); assertNull(input.getCwd()); assertNull(input.getToolArgs()); + assertNull(input.getSessionId()); + } + + @Test + void preToolUseHookInputSessionIdRoundTrip() { + var input = new PreToolUseHookInput(); + input.setSessionId("session-abc"); + assertEquals("session-abc", input.getSessionId()); } // ===== PostToolUseHookInput getters ===== @@ -155,6 +176,55 @@ void postToolUseHookInputGetters() { assertEquals(0L, input.getTimestamp()); assertNull(input.getCwd()); assertNull(input.getToolArgs()); + assertNull(input.getSessionId()); + } + + @Test + void postToolUseHookInputSessionIdRoundTrip() { + var input = new PostToolUseHookInput(); + input.setSessionId("session-xyz"); + assertEquals("session-xyz", input.getSessionId()); + } + + // ===== CustomAgentConfig model field ===== + + @Test + void customAgentConfigModelGetterAndSetter() { + var cfg = new CustomAgentConfig(); + assertNull(cfg.getModel()); + + cfg.setModel("claude-haiku-4.5"); + assertEquals("claude-haiku-4.5", cfg.getModel()); + } + + @Test + void customAgentConfigModelFluentChaining() { + var cfg = new CustomAgentConfig().setName("reviewer").setModel("gpt-5").setDescription("Code reviewer"); + assertEquals("reviewer", cfg.getName()); + assertEquals("gpt-5", cfg.getModel()); + assertEquals("Code reviewer", cfg.getDescription()); + } + + @Test + void customAgentConfigModelSerializationRoundTrip() throws Exception { + var mapper = JsonRpcClient.getObjectMapper(); + var cfg = new CustomAgentConfig().setName("my-agent").setModel("claude-haiku-4.5"); + + var json = mapper.writeValueAsString(cfg); + assertTrue(json.contains("\"model\":\"claude-haiku-4.5\"")); + + var deserialized = mapper.readValue(json, CustomAgentConfig.class); + assertEquals("my-agent", deserialized.getName()); + assertEquals("claude-haiku-4.5", deserialized.getModel()); + } + + @Test + void customAgentConfigModelOmittedWhenNull() throws Exception { + var mapper = JsonRpcClient.getObjectMapper(); + var cfg = new CustomAgentConfig().setName("no-model-agent"); + + var json = mapper.writeValueAsString(cfg); + assertFalse(json.contains("\"model\"")); } // ===== PermissionRequestResult setRules ===== @@ -169,4 +239,52 @@ void permissionRequestResultSetRules() { assertEquals(2, result.getRules().size()); assertEquals("bash:read", result.getRules().get(0)); } + + @Test + void mcpHttpServerConfigCoversGettersAndFluentSetters() { + var headers = java.util.Map.of("Authorization", "Bearer token"); + var tools = java.util.List.of("*", "search"); + + var cfg = new McpHttpServerConfig().setUrl("https://mcp.example.com/sse").setHeaders(headers).setTools(tools) + .setTimeout(45); + + assertEquals("http", cfg.getType()); + assertEquals("https://mcp.example.com/sse", cfg.getUrl()); + assertEquals("Bearer token", cfg.getHeaders().get("Authorization")); + assertEquals(tools, cfg.getTools()); + assertEquals(45, cfg.getTimeout()); + } + + @Test + void mcpStdioServerConfigCoversGettersAndFluentSetters() { + var args = java.util.List.of("-y", "@modelcontextprotocol/server-filesystem"); + var env = java.util.Map.of("DEBUG", "1"); + var tools = java.util.List.of("*"); + + var cfg = new McpStdioServerConfig().setCommand("npx").setArgs(args).setEnv(env).setWorkingDirectory("/tmp") + .setTools(tools).setTimeout(30); + + assertEquals("stdio", cfg.getType()); + assertEquals("npx", cfg.getCommand()); + assertEquals(args, cfg.getArgs()); + assertEquals("1", cfg.getEnv().get("DEBUG")); + assertEquals("/tmp", cfg.getWorkingDirectory()); + assertEquals(tools, cfg.getTools()); + assertEquals(30, cfg.getTimeout()); + } + + @Test + void modelCapabilitiesOverrideCoversNestedSupportsAndLimits() { + var supports = new ModelCapabilitiesOverride.Supports().setVision(true).setReasoningEffort(false); + var limits = new ModelCapabilitiesOverride.Limits().setMaxPromptTokens(2048).setMaxOutputTokens(512) + .setMaxContextWindowTokens(8192); + + var override = new ModelCapabilitiesOverride().setSupports(supports).setLimits(limits); + + assertTrue(override.getSupports().getVision().orElse(false)); + assertFalse(override.getSupports().getReasoningEffort().orElse(true)); + assertEquals(2048, override.getLimits().getMaxPromptTokens().getAsInt()); + assertEquals(512, override.getLimits().getMaxOutputTokens().getAsInt()); + assertEquals(8192, override.getLimits().getMaxContextWindowTokens().getAsInt()); + } } diff --git a/src/test/java/com/github/copilot/sdk/E2ETestContext.java b/src/test/java/com/github/copilot/sdk/E2ETestContext.java index 74c65245b6..9680148ff6 100644 --- a/src/test/java/com/github/copilot/sdk/E2ETestContext.java +++ b/src/test/java/com/github/copilot/sdk/E2ETestContext.java @@ -249,8 +249,33 @@ public List> getExchanges() throws IOException, InterruptedE public Map getEnvironment() { Map env = new HashMap<>(System.getenv()); env.put("COPILOT_API_URL", proxyUrl); + env.put("COPILOT_HOME", homeDir.toString()); + env.put("GH_CONFIG_DIR", homeDir.toString()); env.put("XDG_CONFIG_HOME", homeDir.toString()); env.put("XDG_STATE_HOME", homeDir.toString()); + + // Configure CONNECT proxy for HTTPS interception if available + String connectUrl = proxy.getConnectProxyUrl(); + String caFile = proxy.getCaFilePath(); + if (connectUrl != null && !connectUrl.isEmpty() && caFile != null && !caFile.isEmpty()) { + String noProxy = "127.0.0.1,localhost,::1"; + env.put("HTTP_PROXY", connectUrl); + env.put("HTTPS_PROXY", connectUrl); + env.put("http_proxy", connectUrl); + env.put("https_proxy", connectUrl); + env.put("NO_PROXY", noProxy); + env.put("no_proxy", noProxy); + env.put("NODE_EXTRA_CA_CERTS", caFile); + env.put("SSL_CERT_FILE", caFile); + env.put("REQUESTS_CA_BUNDLE", caFile); + env.put("CURL_CA_BUNDLE", caFile); + env.put("GIT_SSL_CAINFO", caFile); + env.put("GH_TOKEN", "fake-token-for-e2e-tests"); + env.put("GITHUB_TOKEN", "fake-token-for-e2e-tests"); + env.put("GH_ENTERPRISE_TOKEN", ""); + env.put("GITHUB_ENTERPRISE_TOKEN", ""); + } + return env; } @@ -261,17 +286,91 @@ public Map getEnvironment() { */ public CopilotClient createClient() { CopilotClientOptions options = new CopilotClientOptions().setCliPath(cliPath).setCwd(workDir.toString()) - .setEnvironment(getEnvironment()); + .setEnvironment(getEnvironment()).setGitHubToken("fake-token-for-e2e-tests"); - // In CI (GitHub Actions), use a fake token to avoid auth issues - String ci = System.getenv("GITHUB_ACTIONS"); - if (ci != null && !ci.isEmpty()) { + return new CopilotClient(options); + } + + /** + * Creates a CopilotClient with the given options, applied on top of the default + * options for this test context. + * + * @param options + * options to apply; environment and cliPath will be set from the + * context if not already set + * @return a new CopilotClient + */ + public CopilotClient createClient(CopilotClientOptions options) { + if (options.getCliPath() == null) { + options.setCliPath(cliPath); + } + if (options.getCwd() == null) { + options.setCwd(workDir.toString()); + } + if (options.getEnvironment() == null || options.getEnvironment().isEmpty()) { + options.setEnvironment(getEnvironment()); + } + if (options.getGitHubToken() == null) { options.setGitHubToken("fake-token-for-e2e-tests"); } return new CopilotClient(options); } + /** + * Configures the proxy to return a specific Copilot user response for a given + * token. Used for per-session authentication tests. + * + * @param token + * the GitHub token + * @param login + * the user login + * @param copilotPlan + * the Copilot plan + * @param apiUrl + * the API URL for the user endpoints + * @param telemetryUrl + * the telemetry URL + * @param analyticsTrackingId + * the analytics tracking ID + * @throws IOException + * if the request fails + * @throws InterruptedException + * if the request is interrupted + */ + public void setCopilotUserByToken(String token, String login, String copilotPlan, String apiUrl, + String telemetryUrl, String analyticsTrackingId) throws IOException, InterruptedException { + ensureProxyAlive(); + proxy.setCopilotUserByToken(token, login, copilotPlan, apiUrl, telemetryUrl, analyticsTrackingId); + } + + /** + * Initializes the proxy state without loading a snapshot. + *

+ * Use this for tests that need the proxy to be active (e.g., for per-session + * auth token resolution via {@code /copilot_internal/user}) but do not make AI + * completion requests and therefore have no snapshot to load. + *

+ *

+ * The proxy requires its internal {@code state} to be initialized before it can + * handle most endpoints. Without this call the proxy throws an error and + * returns HTTP 500 for any request that arrives before a {@code /config} POST + * has been made. + *

+ * + * @throws IOException + * if the proxy configuration request fails + * @throws InterruptedException + * if the request is interrupted + */ + public void initializeProxy() throws IOException, InterruptedException { + ensureProxyAlive(); + // Pass a non-existent snapshot path. The proxy initializes its state even when + // the file is absent (storedData simply remains undefined), which is fine for + // tests that never make AI chat-completion requests. + proxy.configure(workDir.resolve("no-snapshot.yaml").toString(), workDir.toString()); + } + @Override public void close() throws Exception { proxy.stop(); diff --git a/src/test/java/com/github/copilot/sdk/ElicitationTest.java b/src/test/java/com/github/copilot/sdk/ElicitationTest.java index 6b748b4cc2..1f62451276 100644 --- a/src/test/java/com/github/copilot/sdk/ElicitationTest.java +++ b/src/test/java/com/github/copilot/sdk/ElicitationTest.java @@ -40,7 +40,7 @@ void sessionCapabilitiesTypesAreProperlyStructured() { var capabilities = new SessionCapabilities().setUi(new SessionUiCapabilities().setElicitation(true)); assertNotNull(capabilities.getUi()); - assertTrue(capabilities.getUi().getElicitation()); + assertTrue(capabilities.getUi().getElicitation().get()); // Test with null UI var emptyCapabilities = new SessionCapabilities(); @@ -119,8 +119,8 @@ void inputOptionsHasAllFields() { assertEquals("My Title", opts.getTitle()); assertEquals("My Desc", opts.getDescription()); - assertEquals(1, opts.getMinLength()); - assertEquals(100, opts.getMaxLength()); + assertEquals(1, opts.getMinLength().getAsInt()); + assertEquals(100, opts.getMaxLength().getAsInt()); assertEquals("email", opts.getFormat()); assertEquals("default@example.com", opts.getDefaultValue()); } @@ -164,7 +164,7 @@ void buildCreateRequestSetsRequestElicitationWhenHandlerPresent() { var request = SessionRequestBuilder.buildCreateRequest(config); - assertTrue(Boolean.TRUE.equals(request.getRequestElicitation())); + assertEquals(Boolean.TRUE, request.getRequestElicitation()); } @Test @@ -186,6 +186,6 @@ void buildResumeRequestSetsRequestElicitationWhenHandlerPresent() { var request = SessionRequestBuilder.buildResumeRequest("session-1", config); - assertTrue(Boolean.TRUE.equals(request.getRequestElicitation())); + assertEquals(Boolean.TRUE, request.getRequestElicitation()); } } diff --git a/src/test/java/com/github/copilot/sdk/EventFidelityTest.java b/src/test/java/com/github/copilot/sdk/EventFidelityTest.java new file mode 100644 index 0000000000..60b8e13275 --- /dev/null +++ b/src/test/java/com/github/copilot/sdk/EventFidelityTest.java @@ -0,0 +1,111 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk; + +import static org.junit.jupiter.api.Assertions.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import com.github.copilot.sdk.generated.AssistantUsageEvent; +import com.github.copilot.sdk.generated.SessionEvent; +import com.github.copilot.sdk.generated.SessionUsageInfoEvent; +import com.github.copilot.sdk.json.MessageOptions; +import com.github.copilot.sdk.json.PermissionHandler; +import com.github.copilot.sdk.json.SessionConfig; + +/** + * E2E tests for event fidelity β€” verifying the shape, ordering, and presence of + * key events emitted from the runtime. + * + *

+ * Snapshots are stored in {@code test/snapshots/event_fidelity/}. + *

+ */ +public class EventFidelityTest { + + private static E2ETestContext ctx; + + @BeforeAll + static void setup() throws Exception { + ctx = E2ETestContext.create(); + } + + @AfterAll + static void teardown() throws Exception { + if (ctx != null) { + ctx.close(); + } + } + + /** + * Verifies that an {@code assistant.usage} event is emitted after the model + * processes a prompt. + * + * @see Snapshot: + * event_fidelity/should_emit_assistant_usage_event_after_model_call + */ + @Test + void testShouldEmitAssistantUsageEventAfterModelCall() throws Exception { + ctx.configureForTest("event_fidelity", "should_emit_assistant_usage_event_after_model_call"); + + try (CopilotClient client = ctx.createClient()) { + CopilotSession session = client + .createSession(new SessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get(); + + List events = new ArrayList<>(); + session.on(events::add); + + session.sendAndWait(new MessageOptions().setPrompt("What is 5+5? Reply with just the number.")).get(60, + TimeUnit.SECONDS); + + List usageEvents = events.stream().filter(e -> e instanceof AssistantUsageEvent) + .map(e -> (AssistantUsageEvent) e).toList(); + + assertFalse(usageEvents.isEmpty(), "Should have received an assistant.usage event after model call"); + + AssistantUsageEvent lastUsage = usageEvents.get(usageEvents.size() - 1); + assertNotNull(lastUsage.getData().model(), "Usage event should have a model field"); + assertFalse(lastUsage.getData().model().isEmpty(), "Model field should not be empty"); + + session.close(); + } + } + + /** + * Verifies that a {@code session.usage_info} event is emitted after the model + * processes a prompt. + * + * @see Snapshot: + * event_fidelity/should_emit_session_usage_info_event_after_model_call + */ + @Test + void testShouldEmitSessionUsageInfoEventAfterModelCall() throws Exception { + ctx.configureForTest("event_fidelity", "should_emit_session_usage_info_event_after_model_call"); + + try (CopilotClient client = ctx.createClient()) { + CopilotSession session = client + .createSession(new SessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get(); + + List events = new ArrayList<>(); + session.on(events::add); + + session.sendAndWait(new MessageOptions().setPrompt("What is 5+5? Reply with just the number.")).get(60, + TimeUnit.SECONDS); + + List usageInfoEvents = events.stream() + .filter(e -> e instanceof SessionUsageInfoEvent).map(e -> (SessionUsageInfoEvent) e).toList(); + + assertFalse(usageInfoEvents.isEmpty(), "Should have received a session.usage_info event after model call"); + + session.close(); + } + } +} diff --git a/src/test/java/com/github/copilot/sdk/ExecutorWiringTest.java b/src/test/java/com/github/copilot/sdk/ExecutorWiringTest.java index bda67bbc9f..a5eb3a62dc 100644 --- a/src/test/java/com/github/copilot/sdk/ExecutorWiringTest.java +++ b/src/test/java/com/github/copilot/sdk/ExecutorWiringTest.java @@ -26,6 +26,7 @@ import com.github.copilot.sdk.json.MessageOptions; import com.github.copilot.sdk.json.PermissionHandler; import com.github.copilot.sdk.json.PermissionRequestResult; +import com.github.copilot.sdk.json.PermissionRequestResultKind; import com.github.copilot.sdk.json.PreToolUseHookOutput; import com.github.copilot.sdk.json.SessionConfig; import com.github.copilot.sdk.json.SessionHooks; @@ -86,12 +87,8 @@ int getTaskCount() { private CopilotClientOptions createOptionsWithExecutor(TrackingExecutor executor) { CopilotClientOptions options = new CopilotClientOptions().setCliPath(ctx.getCliPath()) - .setCwd(ctx.getWorkDir().toString()).setEnvironment(ctx.getEnvironment()).setExecutor(executor); - - String ci = System.getenv("GITHUB_ACTIONS"); - if (ci != null && !ci.isEmpty()) { - options.setGitHubToken("fake-token-for-e2e-tests"); - } + .setCwd(ctx.getWorkDir().toString()).setEnvironment(ctx.getEnvironment()).setExecutor(executor) + .setGitHubToken("fake-token-for-e2e-tests"); return options; } @@ -199,7 +196,7 @@ void testPermissionDispatchUsesProvidedExecutor() throws Exception { TrackingExecutor trackingExecutor = new TrackingExecutor(ForkJoinPool.commonPool()); var config = new SessionConfig().setOnPermissionRequest((request, invocation) -> CompletableFuture - .completedFuture(new PermissionRequestResult().setKind("approved"))); + .completedFuture(new PermissionRequestResult().setKind(PermissionRequestResultKind.APPROVED))); try (CopilotClient client = new CopilotClient(createOptionsWithExecutor(trackingExecutor))) { CopilotSession session = client.createSession(config).get(); diff --git a/src/test/java/com/github/copilot/sdk/JsonIncludeNonNullTest.java b/src/test/java/com/github/copilot/sdk/JsonIncludeNonNullTest.java new file mode 100644 index 0000000000..7465507f50 --- /dev/null +++ b/src/test/java/com/github/copilot/sdk/JsonIncludeNonNullTest.java @@ -0,0 +1,159 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk; + +import static org.junit.jupiter.api.Assertions.*; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.junit.jupiter.api.Test; + +import com.github.copilot.sdk.json.CopilotClientOptions; +import com.github.copilot.sdk.json.CustomAgentConfig; +import com.github.copilot.sdk.json.InfiniteSessionConfig; +import com.github.copilot.sdk.json.InputOptions; +import com.github.copilot.sdk.json.ModelCapabilitiesOverride; +import com.github.copilot.sdk.json.ProviderConfig; +import com.github.copilot.sdk.json.ResumeSessionConfig; +import com.github.copilot.sdk.json.SessionConfig; +import com.github.copilot.sdk.json.SessionUiCapabilities; +import com.github.copilot.sdk.json.TelemetryConfig; +import com.github.copilot.sdk.json.UserInputRequest; + +/** + * Verifies that public DTO classes in the {@code com.github.copilot.sdk.json} + * package are annotated with {@code @JsonInclude(JsonInclude.Include.NON_NULL)} + * so that null-valued fields are omitted during JSON serialization. + */ +class JsonIncludeNonNullTest { + + private static final ObjectMapper MAPPER = new ObjectMapper(); + + // --- Annotation presence checks --- + + @Test + void copilotClientOptionsHasNonNullAnnotation() { + assertHasNonNullInclude(CopilotClientOptions.class); + } + + @Test + void sessionConfigHasNonNullAnnotation() { + assertHasNonNullInclude(SessionConfig.class); + } + + @Test + void resumeSessionConfigHasNonNullAnnotation() { + assertHasNonNullInclude(ResumeSessionConfig.class); + } + + @Test + void infiniteSessionConfigHasNonNullAnnotation() { + assertHasNonNullInclude(InfiniteSessionConfig.class); + } + + @Test + void inputOptionsHasNonNullAnnotation() { + assertHasNonNullInclude(InputOptions.class); + } + + @Test + void modelCapabilitiesOverrideHasNonNullAnnotation() { + assertHasNonNullInclude(ModelCapabilitiesOverride.class); + } + + @Test + void providerConfigHasNonNullAnnotation() { + assertHasNonNullInclude(ProviderConfig.class); + } + + @Test + void telemetryConfigHasNonNullAnnotation() { + assertHasNonNullInclude(TelemetryConfig.class); + } + + @Test + void sessionUiCapabilitiesHasNonNullAnnotation() { + assertHasNonNullInclude(SessionUiCapabilities.class); + } + + @Test + void customAgentConfigHasNonNullAnnotation() { + assertHasNonNullInclude(CustomAgentConfig.class); + } + + @Test + void userInputRequestHasNonNullAnnotation() { + assertHasNonNullInclude(UserInputRequest.class); + } + + // --- Serialization tests: null fields are omitted --- + + @Test + void inputOptionsOmitsNullFieldsInJson() throws JsonProcessingException { + var opts = new InputOptions(); + String json = MAPPER.writeValueAsString(opts); + assertEquals("{}", json, "All-null InputOptions should serialize to empty JSON"); + } + + @Test + void telemetryConfigOmitsNullFieldsInJson() throws JsonProcessingException { + var config = new TelemetryConfig(); + String json = MAPPER.writeValueAsString(config); + assertEquals("{}", json, "All-null TelemetryConfig should serialize to empty JSON"); + } + + @Test + void sessionUiCapabilitiesOmitsNullFieldsInJson() throws JsonProcessingException { + var caps = new SessionUiCapabilities(); + String json = MAPPER.writeValueAsString(caps); + assertEquals("{}", json, "All-null SessionUiCapabilities should serialize to empty JSON"); + } + + @Test + void userInputRequestOmitsNullFieldsInJson() throws JsonProcessingException { + var req = new UserInputRequest(); + String json = MAPPER.writeValueAsString(req); + assertFalse(json.contains("null"), "UserInputRequest with no fields set should not contain 'null' values"); + } + + @Test + void inputOptionsIncludesSetFieldsInJson() throws JsonProcessingException { + var opts = new InputOptions(); + opts.setMinLength(5); + opts.setMaxLength(100); + String json = MAPPER.writeValueAsString(opts); + assertTrue(json.contains("\"minLength\":5"), "Set minLength should appear in JSON"); + assertTrue(json.contains("\"maxLength\":100"), "Set maxLength should appear in JSON"); + assertFalse(json.contains("\"title\""), "Unset title should be omitted from JSON"); + } + + @Test + void telemetryConfigIncludesSetFieldsInJson() throws JsonProcessingException { + var config = new TelemetryConfig(); + config.setOtlpEndpoint("http://localhost:4318"); + String json = MAPPER.writeValueAsString(config); + assertTrue(json.contains("\"otlpEndpoint\":\"http://localhost:4318\""), + "Set otlpEndpoint should appear in JSON"); + assertFalse(json.contains("\"filePath\""), "Unset filePath should be omitted from JSON"); + } + + @Test + void sessionUiCapabilitiesIncludesSetFieldsInJson() throws JsonProcessingException { + var caps = new SessionUiCapabilities(); + caps.setElicitation(true); + String json = MAPPER.writeValueAsString(caps); + assertTrue(json.contains("\"elicitation\":true"), "Set elicitation should appear in JSON"); + } + + private void assertHasNonNullInclude(Class clazz) { + JsonInclude annotation = clazz.getAnnotation(JsonInclude.class); + assertNotNull(annotation, clazz.getSimpleName() + " should be annotated with @JsonInclude"); + assertEquals(JsonInclude.Include.NON_NULL, annotation.value(), + clazz.getSimpleName() + " @JsonInclude should use Include.NON_NULL"); + } + +} diff --git a/src/test/java/com/github/copilot/sdk/McpAndAgentsTest.java b/src/test/java/com/github/copilot/sdk/McpAndAgentsTest.java index 2c91dadfed..03f989f5b9 100644 --- a/src/test/java/com/github/copilot/sdk/McpAndAgentsTest.java +++ b/src/test/java/com/github/copilot/sdk/McpAndAgentsTest.java @@ -8,6 +8,8 @@ import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; import org.junit.jupiter.api.AfterAll; @@ -16,12 +18,14 @@ import com.github.copilot.sdk.generated.AssistantMessageEvent; import com.github.copilot.sdk.json.CustomAgentConfig; +import com.github.copilot.sdk.json.DefaultAgentConfig; import com.github.copilot.sdk.json.McpServerConfig; import com.github.copilot.sdk.json.McpStdioServerConfig; import com.github.copilot.sdk.json.MessageOptions; import com.github.copilot.sdk.json.PermissionHandler; import com.github.copilot.sdk.json.ResumeSessionConfig; import com.github.copilot.sdk.json.SessionConfig; +import com.github.copilot.sdk.json.ToolDefinition; /** * Tests for MCP Servers and Custom Agents functionality. @@ -151,6 +155,41 @@ void testShouldHandleMultipleMcpServers() throws Exception { // ============ Custom Agent Tests ============ + /** + * Verifies that MCP server configuration is accepted without args. + * + * @see Snapshot: + * mcp_and_agents/should_accept_mcp_server_configuration_on_session_create + */ + @Test + void testAcceptMcpServerConfigWithoutArgs() throws Exception { + // Reuse existing snapshot - this test validates that args can be omitted + ctx.configureForTest("mcp_and_agents", "should_accept_mcp_server_configuration_on_session_create"); + + var mcpServers = new HashMap(); + // Create MCP server config without specifying args + mcpServers.put("test-server", new McpStdioServerConfig().setCommand("echo").setTools(List.of("*"))); + + try (CopilotClient client = ctx.createClient()) { + CopilotSession session = client.createSession( + new SessionConfig().setMcpServers(mcpServers).setOnPermissionRequest(PermissionHandler.APPROVE_ALL)) + .get(); + + assertNotNull(session.getSessionId()); + + AssistantMessageEvent response = session.sendAndWait(new MessageOptions().setPrompt("What is 2+2?")).get(60, + TimeUnit.SECONDS); + + assertNotNull(response); + assertTrue(response.getData().content().contains("4"), + "Response should contain 4: " + response.getData().content()); + + session.close(); + } + } + + // ============ Custom Agent Tests ============ + /** * Verifies that custom agent configuration is accepted on session create. * @@ -334,4 +373,85 @@ void testShouldAcceptBothMcpServersAndCustomAgents() throws Exception { session.close(); } } + + // ============ DefaultAgent Tests ============ + + /** + * Verifies that sessions can be created with defaultAgent configuration and + * excludedTools hides tools from the default agent. + * + * @see Snapshot: mcp_and_agents/should_hide_excluded_tools_from_default_agent + */ + @Test + void testShouldHideExcludedToolsFromDefaultAgent() throws Exception { + ctx.configureForTest("mcp_and_agents", "should_hide_excluded_tools_from_default_agent"); + + try (CopilotClient client = ctx.createClient()) { + // Register a secret_tool and exclude it from the default agent β€” the LLM + // should report it has no access to the tool. + Map parameters = new HashMap<>(); + parameters.put("type", "object"); + parameters.put("properties", Map.of("input", Map.of("type", "string"))); + parameters.put("required", List.of("input")); + + ToolDefinition secretTool = ToolDefinition.create("secret_tool", + "A secret tool hidden from the default agent", parameters, + invocation -> CompletableFuture.completedFuture("SECRET")); + + SessionConfig config = new SessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL) + .setTools(List.of(secretTool)) + .setDefaultAgent(new DefaultAgentConfig().setExcludedTools(List.of("secret_tool"))); + + CopilotSession session = client.createSession(config).get(); + + assertNotNull(session.getSessionId()); + + AssistantMessageEvent response = session + .sendAndWait(new MessageOptions() + .setPrompt("Do you have access to a tool called secret_tool? Answer yes or no.")) + .get(60, TimeUnit.SECONDS); + + assertNotNull(response); + assertTrue(response.getData().content().toLowerCase().contains("no"), + "Response should indicate that secret_tool is not accessible: " + response.getData().content()); + session.close(); + } + } + + /** + * Verifies that defaultAgent configuration is accepted on session resume. + * + * @see Snapshot: + * mcp_and_agents/should_accept_defaultagent_configuration_on_session_resume + */ + @Test + void testShouldAcceptDefaultAgentConfigurationOnSessionResume() throws Exception { + ctx.configureForTest("mcp_and_agents", "should_accept_defaultagent_configuration_on_session_resume"); + + try (CopilotClient client = ctx.createClient()) { + CopilotSession session = client + .createSession(new SessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get(); + + assertNotNull(session.getSessionId()); + String sessionId = session.getSessionId(); + // Do not call session.close() here β€” that invokes session.destroy on the + // server, + // which removes the session and causes the subsequent resumeSession to fail + // with "Session not found". The session handle is simply abandoned and the + // server-side session remains alive for the resume call below. + + CopilotSession resumedSession = client.resumeSession(sessionId, + new ResumeSessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL) + .setDefaultAgent(new DefaultAgentConfig().setExcludedTools(List.of("view")))) + .get(); + + assertNotNull(resumedSession.getSessionId()); + + AssistantMessageEvent response = resumedSession.sendAndWait(new MessageOptions().setPrompt("What is 3+3?")) + .get(60, TimeUnit.SECONDS); + + assertNotNull(response); + resumedSession.close(); + } + } } diff --git a/src/test/java/com/github/copilot/sdk/ModeHandlersTest.java b/src/test/java/com/github/copilot/sdk/ModeHandlersTest.java new file mode 100644 index 0000000000..965d431e02 --- /dev/null +++ b/src/test/java/com/github/copilot/sdk/ModeHandlersTest.java @@ -0,0 +1,151 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk; + +import static org.junit.jupiter.api.Assertions.*; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.TimeUnit; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import com.github.copilot.sdk.generated.ExitPlanModeAction; +import com.github.copilot.sdk.generated.ExitPlanModeCompletedEvent; +import com.github.copilot.sdk.generated.ExitPlanModeRequestedEvent; +import com.github.copilot.sdk.json.AutoModeSwitchRequest; +import com.github.copilot.sdk.json.AutoModeSwitchResponse; +import com.github.copilot.sdk.json.CopilotClientOptions; +import com.github.copilot.sdk.json.ExitPlanModeRequest; +import com.github.copilot.sdk.json.ExitPlanModeResult; +import com.github.copilot.sdk.json.MessageOptions; +import com.github.copilot.sdk.json.PermissionHandler; +import com.github.copilot.sdk.json.SessionConfig; + +/** + * E2E tests for exit-plan-mode and auto-mode-switch handler APIs. + * + *

+ * Ported from {@code ModeHandlersE2ETests.cs} in the reference implementation + * dotnet SDK. + *

+ */ +public class ModeHandlersTest { + + private static final String TOKEN = "mode-handler-token"; + + private static E2ETestContext ctx; + + @BeforeAll + static void setup() throws Exception { + ctx = E2ETestContext.create(); + } + + @AfterAll + static void teardown() throws Exception { + if (ctx != null) { + ctx.close(); + } + } + + private CopilotClient createAuthenticatedClient() { + Map env = new HashMap<>(ctx.getEnvironment()); + env.put("COPILOT_DEBUG_GITHUB_API_URL", ctx.getProxyUrl()); + + return ctx.createClient(new CopilotClientOptions().setEnvironment(env)); + } + + private void configureAuthenticatedUser(String testName) throws Exception { + ctx.configureForTest("mode_handlers", testName); + ctx.setCopilotUserByToken(TOKEN, "mode-handler-user", "individual_pro", ctx.getProxyUrl(), + "https://localhost:1/telemetry", "mode-handler-tracking-id"); + } + + @Test + void shouldInvokeExitPlanModeHandlerWhenModelUsesTool() throws Exception { + final String summary = "Greeting file implementation plan"; + configureAuthenticatedUser("should_invoke_exit_plan_mode_handler_when_model_uses_tool"); + + var handlerCalled = new CompletableFuture(); + + try (var client = createAuthenticatedClient()) { + var session = client.createSession(new SessionConfig().setGitHubToken(TOKEN) + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL).setOnExitPlanMode((request, invocation) -> { + handlerCalled.complete(request); + return CompletableFuture.completedFuture(new ExitPlanModeResult().setApproved(true) + .setSelectedAction("interactive").setFeedback("Approved by the Java E2E test")); + })).get(30, TimeUnit.SECONDS); + + var requestedEvent = new CompletableFuture(); + var completedEvent = new CompletableFuture(); + + session.on(event -> { + if (event instanceof ExitPlanModeRequestedEvent requested + && summary.equals(requested.getData().summary())) { + requestedEvent.complete(requested); + } else if (event instanceof ExitPlanModeCompletedEvent completed + && Boolean.TRUE.equals(completed.getData().approved()) + && ExitPlanModeAction.INTERACTIVE == completed.getData().selectedAction()) { + completedEvent.complete(completed); + } + }); + + var response = session.sendAndWait(new MessageOptions().setPrompt( + "Create a brief implementation plan for adding a greeting.txt file, then request approval with exit_plan_mode.") + .setMode("plan")).get(120, TimeUnit.SECONDS); + + var request = handlerCalled.get(10, TimeUnit.SECONDS); + assertEquals(summary, request.getSummary()); + assertNotNull(request.getActions()); + assertTrue(request.getActions().contains("interactive")); + assertNotNull(request.getPlanContent()); + + var reqEvent = requestedEvent.get(10, TimeUnit.SECONDS); + assertEquals(request.getSummary(), reqEvent.getData().summary()); + + var compEvent = completedEvent.get(10, TimeUnit.SECONDS); + assertTrue(compEvent.getData().approved()); + assertEquals(ExitPlanModeAction.INTERACTIVE, compEvent.getData().selectedAction()); + + assertNotNull(response); + + session.close(); + } + } + + @Test + void shouldInvokeAutoModeSwitchHandlerWhenRateLimited() throws Exception { + configureAuthenticatedUser("should_invoke_auto_mode_switch_handler_when_rate_limited"); + + var handlerCalled = new CompletableFuture(); + + try (var client = createAuthenticatedClient()) { + var session = client.createSession( + new SessionConfig().setGitHubToken(TOKEN).setOnPermissionRequest(PermissionHandler.APPROVE_ALL) + .setOnAutoModeSwitch((request, invocation) -> { + handlerCalled.complete(request); + return CompletableFuture.completedFuture(AutoModeSwitchResponse.YES); + })) + .get(30, TimeUnit.SECONDS); + + var messageId = session + .send(new MessageOptions() + .setPrompt("Explain that auto mode recovered from a rate limit in one short sentence.")) + .get(30, TimeUnit.SECONDS); + + assertNotNull(messageId); + assertFalse(messageId.isEmpty()); + + var request = handlerCalled.get(30, TimeUnit.SECONDS); + assertEquals("user_weekly_rate_limited", request.getErrorCode()); + assertEquals(1.0, request.getRetryAfterSeconds()); + + session.close(); + } + } +} diff --git a/src/test/java/com/github/copilot/sdk/ModuleDescriptorTest.java b/src/test/java/com/github/copilot/sdk/ModuleDescriptorTest.java new file mode 100644 index 0000000000..36be137345 --- /dev/null +++ b/src/test/java/com/github/copilot/sdk/ModuleDescriptorTest.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.lang.module.ModuleDescriptor; +import org.junit.jupiter.api.Test; + +class ModuleDescriptorTest { + + @Test + void sdkHasExplicitModuleDescriptor() { + Module module = CopilotClient.class.getModule(); + assertTrue(module.isNamed()); + assertEquals("com.github.copilot.sdk.java", module.getName()); + + ModuleDescriptor descriptor = module.getDescriptor(); + assertTrue(descriptor.exports().stream().anyMatch(export -> export.source().equals("com.github.copilot.sdk"))); + assertTrue(descriptor.exports().stream() + .anyMatch(export -> export.source().equals("com.github.copilot.sdk.json"))); + assertTrue(descriptor.requires().stream() + .anyMatch(require -> require.name().equals("com.fasterxml.jackson.databind"))); + } +} diff --git a/src/test/java/com/github/copilot/sdk/OptionalApiAndJacksonTest.java b/src/test/java/com/github/copilot/sdk/OptionalApiAndJacksonTest.java new file mode 100644 index 0000000000..2a9770e2e2 --- /dev/null +++ b/src/test/java/com/github/copilot/sdk/OptionalApiAndJacksonTest.java @@ -0,0 +1,635 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk; + +import static org.junit.jupiter.api.Assertions.*; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.copilot.sdk.json.CopilotClientOptions; +import com.github.copilot.sdk.json.CustomAgentConfig; +import com.github.copilot.sdk.json.InfiniteSessionConfig; +import com.github.copilot.sdk.json.InputOptions; +import com.github.copilot.sdk.json.ModelCapabilitiesOverride; +import com.github.copilot.sdk.json.ProviderConfig; +import com.github.copilot.sdk.json.ResumeSessionConfig; +import com.github.copilot.sdk.json.SessionConfig; +import com.github.copilot.sdk.json.SessionUiCapabilities; +import com.github.copilot.sdk.json.TelemetryConfig; +import com.github.copilot.sdk.json.UserInputRequest; +import org.junit.jupiter.api.Test; + +/** + * Validates that every {@code clearXxx()} method resets its field to absent, + * that Optional-returning getters report the correct state, and that Jackson + * omits cleared fields from serialized output. + */ +class OptionalApiAndJacksonTest { + + private static final ObjectMapper MAPPER = JsonRpcClient.getObjectMapper(); + + // ── CopilotClientOptions ────────────────────────────────────────── + + @Test + void copilotClientOptions_clearSessionIdleTimeoutSeconds() { + var opts = new CopilotClientOptions(); + opts.setSessionIdleTimeoutSeconds(120); + assertFalse(opts.getSessionIdleTimeoutSeconds().isEmpty()); + + opts.clearSessionIdleTimeoutSeconds(); + assertTrue(opts.getSessionIdleTimeoutSeconds().isEmpty()); + } + + @Test + void copilotClientOptions_clearUseLoggedInUser() { + var opts = new CopilotClientOptions(); + opts.setUseLoggedInUser(true); + assertTrue(opts.getUseLoggedInUser().isPresent()); + + opts.clearUseLoggedInUser(); + assertTrue(opts.getUseLoggedInUser().isEmpty()); + } + + // ── SessionConfig ───────────────────────────────────────────────── + + @Test + void sessionConfig_clearEnableSessionTelemetry() { + var cfg = new SessionConfig(); + cfg.setEnableSessionTelemetry(true); + assertTrue(cfg.getEnableSessionTelemetry().isPresent()); + + cfg.clearEnableSessionTelemetry(); + assertTrue(cfg.getEnableSessionTelemetry().isEmpty()); + } + + @Test + void sessionConfig_clearEnableConfigDiscovery() { + var cfg = new SessionConfig(); + cfg.setEnableConfigDiscovery(false); + assertTrue(cfg.getEnableConfigDiscovery().isPresent()); + + cfg.clearEnableConfigDiscovery(); + assertTrue(cfg.getEnableConfigDiscovery().isEmpty()); + } + + @Test + void sessionConfig_clearIncludeSubAgentStreamingEvents() { + var cfg = new SessionConfig(); + cfg.setIncludeSubAgentStreamingEvents(true); + assertTrue(cfg.getIncludeSubAgentStreamingEvents().isPresent()); + + cfg.clearIncludeSubAgentStreamingEvents(); + assertTrue(cfg.getIncludeSubAgentStreamingEvents().isEmpty()); + } + + // ── ResumeSessionConfig ─────────────────────────────────────────── + + @Test + void resumeSessionConfig_clearEnableSessionTelemetry() { + var cfg = new ResumeSessionConfig(); + cfg.setEnableSessionTelemetry(false); + assertTrue(cfg.getEnableSessionTelemetry().isPresent()); + + cfg.clearEnableSessionTelemetry(); + assertTrue(cfg.getEnableSessionTelemetry().isEmpty()); + } + + @Test + void resumeSessionConfig_clearEnableConfigDiscovery() { + var cfg = new ResumeSessionConfig(); + cfg.setEnableConfigDiscovery(true); + assertTrue(cfg.getEnableConfigDiscovery().isPresent()); + + cfg.clearEnableConfigDiscovery(); + assertTrue(cfg.getEnableConfigDiscovery().isEmpty()); + } + + @Test + void resumeSessionConfig_clearIncludeSubAgentStreamingEvents() { + var cfg = new ResumeSessionConfig(); + cfg.setIncludeSubAgentStreamingEvents(false); + assertTrue(cfg.getIncludeSubAgentStreamingEvents().isPresent()); + + cfg.clearIncludeSubAgentStreamingEvents(); + assertTrue(cfg.getIncludeSubAgentStreamingEvents().isEmpty()); + } + + // ── InfiniteSessionConfig ───────────────────────────────────────── + + @Test + void infiniteSessionConfig_clearEnabled() { + var cfg = new InfiniteSessionConfig(); + cfg.setEnabled(true); + assertTrue(cfg.getEnabled().isPresent()); + + cfg.clearEnabled(); + assertTrue(cfg.getEnabled().isEmpty()); + } + + @Test + void infiniteSessionConfig_clearBackgroundCompactionThreshold() { + var cfg = new InfiniteSessionConfig(); + cfg.setBackgroundCompactionThreshold(0.75); + assertFalse(cfg.getBackgroundCompactionThreshold().isEmpty()); + + cfg.clearBackgroundCompactionThreshold(); + assertTrue(cfg.getBackgroundCompactionThreshold().isEmpty()); + } + + @Test + void infiniteSessionConfig_clearBufferExhaustionThreshold() { + var cfg = new InfiniteSessionConfig(); + cfg.setBufferExhaustionThreshold(0.9); + assertFalse(cfg.getBufferExhaustionThreshold().isEmpty()); + + cfg.clearBufferExhaustionThreshold(); + assertTrue(cfg.getBufferExhaustionThreshold().isEmpty()); + } + + // ── InputOptions ────────────────────────────────────────────────── + + @Test + void inputOptions_clearMinLength() { + var opts = new InputOptions(); + opts.setMinLength(5); + assertFalse(opts.getMinLength().isEmpty()); + + opts.clearMinLength(); + assertTrue(opts.getMinLength().isEmpty()); + } + + @Test + void inputOptions_clearMaxLength() { + var opts = new InputOptions(); + opts.setMaxLength(100); + assertFalse(opts.getMaxLength().isEmpty()); + + opts.clearMaxLength(); + assertTrue(opts.getMaxLength().isEmpty()); + } + + // ── ModelCapabilitiesOverride.Supports ───────────────────────────── + + @Test + void supports_clearVision() { + var s = new ModelCapabilitiesOverride.Supports(); + s.setVision(true); + assertTrue(s.getVision().isPresent()); + + s.clearVision(); + assertTrue(s.getVision().isEmpty()); + } + + @Test + void supports_clearReasoningEffort() { + var s = new ModelCapabilitiesOverride.Supports(); + s.setReasoningEffort(false); + assertTrue(s.getReasoningEffort().isPresent()); + + s.clearReasoningEffort(); + assertTrue(s.getReasoningEffort().isEmpty()); + } + + // ── ModelCapabilitiesOverride.Limits ─────────────────────────────── + + @Test + void limits_clearMaxPromptTokens() { + var l = new ModelCapabilitiesOverride.Limits(); + l.setMaxPromptTokens(4096); + assertFalse(l.getMaxPromptTokens().isEmpty()); + + l.clearMaxPromptTokens(); + assertTrue(l.getMaxPromptTokens().isEmpty()); + } + + @Test + void limits_clearMaxOutputTokens() { + var l = new ModelCapabilitiesOverride.Limits(); + l.setMaxOutputTokens(1024); + assertFalse(l.getMaxOutputTokens().isEmpty()); + + l.clearMaxOutputTokens(); + assertTrue(l.getMaxOutputTokens().isEmpty()); + } + + @Test + void limits_clearMaxContextWindowTokens() { + var l = new ModelCapabilitiesOverride.Limits(); + l.setMaxContextWindowTokens(16384); + assertFalse(l.getMaxContextWindowTokens().isEmpty()); + + l.clearMaxContextWindowTokens(); + assertTrue(l.getMaxContextWindowTokens().isEmpty()); + } + + // ── ProviderConfig ──────────────────────────────────────────────── + + @Test + void providerConfig_clearMaxPromptTokens() { + var cfg = new ProviderConfig(); + cfg.setMaxPromptTokens(2048); + assertFalse(cfg.getMaxPromptTokens().isEmpty()); + + cfg.clearMaxPromptTokens(); + assertTrue(cfg.getMaxPromptTokens().isEmpty()); + } + + @Test + void providerConfig_clearMaxOutputTokens() { + var cfg = new ProviderConfig(); + cfg.setMaxOutputTokens(512); + assertFalse(cfg.getMaxOutputTokens().isEmpty()); + + cfg.clearMaxOutputTokens(); + assertTrue(cfg.getMaxOutputTokens().isEmpty()); + } + + // ── TelemetryConfig ─────────────────────────────────────────────── + + @Test + void telemetryConfig_clearCaptureContent() { + var cfg = new TelemetryConfig(); + cfg.setCaptureContent(true); + assertTrue(cfg.getCaptureContent().isPresent()); + + cfg.clearCaptureContent(); + assertTrue(cfg.getCaptureContent().isEmpty()); + } + + // ── SessionUiCapabilities ───────────────────────────────────────── + + @Test + void sessionUiCapabilities_clearElicitation() { + var caps = new SessionUiCapabilities(); + caps.setElicitation(true); + assertTrue(caps.getElicitation().isPresent()); + + caps.clearElicitation(); + assertTrue(caps.getElicitation().isEmpty()); + } + + // ── CustomAgentConfig ───────────────────────────────────────────── + + @Test + void customAgentConfig_clearInfer() { + var cfg = new CustomAgentConfig(); + cfg.setInfer(true); + assertTrue(cfg.getInfer().isPresent()); + + cfg.clearInfer(); + assertTrue(cfg.getInfer().isEmpty()); + } + + // ── UserInputRequest ────────────────────────────────────────────── + + @Test + void userInputRequest_clearAllowFreeform() { + var req = new UserInputRequest(); + req.setAllowFreeform(false); + assertTrue(req.getAllowFreeform().isPresent()); + + req.clearAllowFreeform(); + assertTrue(req.getAllowFreeform().isEmpty()); + } + + // ── Value retrieval through Optional getters ──────────────────────── + + @Test + void copilotClientOptions_sessionIdleTimeoutSecondsValue() { + var opts = new CopilotClientOptions(); + assertTrue(opts.getSessionIdleTimeoutSeconds().isEmpty()); + + opts.setSessionIdleTimeoutSeconds(300); + assertEquals(300, opts.getSessionIdleTimeoutSeconds().getAsInt()); + + opts.setSessionIdleTimeoutSeconds(0); + assertTrue(opts.getSessionIdleTimeoutSeconds().isPresent()); + assertEquals(0, opts.getSessionIdleTimeoutSeconds().getAsInt()); + } + + @Test + void copilotClientOptions_useLoggedInUserValue() { + var opts = new CopilotClientOptions(); + assertTrue(opts.getUseLoggedInUser().isEmpty()); + + opts.setUseLoggedInUser(true); + assertEquals(Boolean.TRUE, opts.getUseLoggedInUser().get()); + + opts.setUseLoggedInUser(false); + assertEquals(Boolean.FALSE, opts.getUseLoggedInUser().get()); + } + + @Test + void sessionConfig_enableSessionTelemetryValue() { + var cfg = new SessionConfig(); + assertFalse(cfg.getEnableSessionTelemetry().orElse(false)); + + cfg.setEnableSessionTelemetry(true); + assertTrue(cfg.getEnableSessionTelemetry().orElse(false)); + + cfg.setEnableSessionTelemetry(false); + assertFalse(cfg.getEnableSessionTelemetry().orElse(true)); + } + + @Test + void sessionConfig_enableConfigDiscoveryValue() { + var cfg = new SessionConfig(); + assertTrue(cfg.getEnableConfigDiscovery().isEmpty()); + + cfg.setEnableConfigDiscovery(true); + assertTrue(cfg.getEnableConfigDiscovery().get()); + + cfg.setEnableConfigDiscovery(false); + assertFalse(cfg.getEnableConfigDiscovery().get()); + } + + @Test + void sessionConfig_includeSubAgentStreamingEventsValue() { + var cfg = new SessionConfig(); + assertTrue(cfg.getIncludeSubAgentStreamingEvents().isEmpty()); + + cfg.setIncludeSubAgentStreamingEvents(true); + assertTrue(cfg.getIncludeSubAgentStreamingEvents().get()); + } + + @Test + void resumeSessionConfig_enableSessionTelemetryValue() { + var cfg = new ResumeSessionConfig(); + assertTrue(cfg.getEnableSessionTelemetry().isEmpty()); + + cfg.setEnableSessionTelemetry(true); + assertTrue(cfg.getEnableSessionTelemetry().get()); + + cfg.setEnableSessionTelemetry(false); + assertFalse(cfg.getEnableSessionTelemetry().get()); + } + + @Test + void resumeSessionConfig_enableConfigDiscoveryValue() { + var cfg = new ResumeSessionConfig(); + assertTrue(cfg.getEnableConfigDiscovery().isEmpty()); + + cfg.setEnableConfigDiscovery(true); + assertTrue(cfg.getEnableConfigDiscovery().get()); + } + + @Test + void resumeSessionConfig_includeSubAgentStreamingEventsValue() { + var cfg = new ResumeSessionConfig(); + assertTrue(cfg.getIncludeSubAgentStreamingEvents().isEmpty()); + + cfg.setIncludeSubAgentStreamingEvents(false); + assertFalse(cfg.getIncludeSubAgentStreamingEvents().get()); + } + + @Test + void infiniteSessionConfig_thresholdValues() { + var cfg = new InfiniteSessionConfig(); + assertTrue(cfg.getBackgroundCompactionThreshold().isEmpty()); + assertTrue(cfg.getBufferExhaustionThreshold().isEmpty()); + + cfg.setBackgroundCompactionThreshold(0.6); + cfg.setBufferExhaustionThreshold(0.85); + assertEquals(0.6, cfg.getBackgroundCompactionThreshold().getAsDouble(), 0.001); + assertEquals(0.85, cfg.getBufferExhaustionThreshold().getAsDouble(), 0.001); + } + + @Test + void infiniteSessionConfig_enabledValue() { + var cfg = new InfiniteSessionConfig(); + assertTrue(cfg.getEnabled().isEmpty()); + + cfg.setEnabled(true); + assertTrue(cfg.getEnabled().get()); + + cfg.setEnabled(false); + assertFalse(cfg.getEnabled().get()); + } + + @Test + void inputOptions_minAndMaxLengthValues() { + var opts = new InputOptions(); + assertTrue(opts.getMinLength().isEmpty()); + assertTrue(opts.getMaxLength().isEmpty()); + + opts.setMinLength(1); + opts.setMaxLength(255); + assertEquals(1, opts.getMinLength().getAsInt()); + assertEquals(255, opts.getMaxLength().getAsInt()); + } + + @Test + void supports_visionAndReasoningEffortValues() { + var s = new ModelCapabilitiesOverride.Supports(); + assertTrue(s.getVision().isEmpty()); + assertTrue(s.getReasoningEffort().isEmpty()); + + s.setVision(true); + s.setReasoningEffort(false); + assertTrue(s.getVision().get()); + assertFalse(s.getReasoningEffort().get()); + } + + @Test + void limits_tokenValues() { + var l = new ModelCapabilitiesOverride.Limits(); + assertTrue(l.getMaxPromptTokens().isEmpty()); + assertTrue(l.getMaxOutputTokens().isEmpty()); + assertTrue(l.getMaxContextWindowTokens().isEmpty()); + + l.setMaxPromptTokens(4096); + l.setMaxOutputTokens(1024); + l.setMaxContextWindowTokens(16384); + assertEquals(4096, l.getMaxPromptTokens().getAsInt()); + assertEquals(1024, l.getMaxOutputTokens().getAsInt()); + assertEquals(16384, l.getMaxContextWindowTokens().getAsInt()); + } + + @Test + void providerConfig_tokenValues() { + var cfg = new ProviderConfig(); + assertTrue(cfg.getMaxPromptTokens().isEmpty()); + assertTrue(cfg.getMaxOutputTokens().isEmpty()); + + cfg.setMaxPromptTokens(8192); + cfg.setMaxOutputTokens(2048); + assertEquals(8192, cfg.getMaxPromptTokens().getAsInt()); + assertEquals(2048, cfg.getMaxOutputTokens().getAsInt()); + } + + @Test + void telemetryConfig_captureContentValue() { + var cfg = new TelemetryConfig(); + assertTrue(cfg.getCaptureContent().isEmpty()); + + cfg.setCaptureContent(true); + assertTrue(cfg.getCaptureContent().get()); + + cfg.setCaptureContent(false); + assertFalse(cfg.getCaptureContent().get()); + } + + @Test + void sessionUiCapabilities_elicitationValue() { + var caps = new SessionUiCapabilities(); + assertTrue(caps.getElicitation().isEmpty()); + assertFalse(caps.getElicitation().orElse(false)); + + caps.setElicitation(true); + assertTrue(caps.getElicitation().orElse(false)); + } + + @Test + void customAgentConfig_inferValue() { + var cfg = new CustomAgentConfig(); + assertTrue(cfg.getInfer().isEmpty()); + + cfg.setInfer(true); + assertTrue(cfg.getInfer().get()); + + cfg.setInfer(false); + assertFalse(cfg.getInfer().get()); + } + + @Test + void userInputRequest_allowFreeformValue() { + var req = new UserInputRequest(); + assertTrue(req.getAllowFreeform().isEmpty()); + + req.setAllowFreeform(true); + assertTrue(req.getAllowFreeform().get()); + + req.setAllowFreeform(false); + assertFalse(req.getAllowFreeform().get()); + } + + // ── JSON deserialization into Optional-returning classes ─────────── + + @Test + void jackson_deserializeSupportsWithFields() throws Exception { + String json = "{\"vision\":true,\"reasoningEffort\":false}"; + var supports = MAPPER.readValue(json, ModelCapabilitiesOverride.Supports.class); + assertTrue(supports.getVision().get()); + assertFalse(supports.getReasoningEffort().get()); + } + + @Test + void jackson_deserializeSupportsEmpty() throws Exception { + String json = "{}"; + var supports = MAPPER.readValue(json, ModelCapabilitiesOverride.Supports.class); + assertTrue(supports.getVision().isEmpty()); + assertTrue(supports.getReasoningEffort().isEmpty()); + } + + @Test + void jackson_deserializeLimitsWithFields() throws Exception { + String json = "{\"max_prompt_tokens\":4096,\"max_output_tokens\":1024,\"max_context_window_tokens\":16384}"; + var limits = MAPPER.readValue(json, ModelCapabilitiesOverride.Limits.class); + assertEquals(4096, limits.getMaxPromptTokens().getAsInt()); + assertEquals(1024, limits.getMaxOutputTokens().getAsInt()); + assertEquals(16384, limits.getMaxContextWindowTokens().getAsInt()); + } + + @Test + void jackson_deserializeLimitsEmpty() throws Exception { + String json = "{}"; + var limits = MAPPER.readValue(json, ModelCapabilitiesOverride.Limits.class); + assertTrue(limits.getMaxPromptTokens().isEmpty()); + assertTrue(limits.getMaxOutputTokens().isEmpty()); + assertTrue(limits.getMaxContextWindowTokens().isEmpty()); + } + + @Test + void jackson_deserializeInfiniteSessionConfigWithFields() throws Exception { + String json = "{\"enabled\":true,\"backgroundCompactionThreshold\":0.7,\"bufferExhaustionThreshold\":0.9}"; + var cfg = MAPPER.readValue(json, InfiniteSessionConfig.class); + assertTrue(cfg.getEnabled().get()); + assertEquals(0.7, cfg.getBackgroundCompactionThreshold().getAsDouble(), 0.001); + assertEquals(0.9, cfg.getBufferExhaustionThreshold().getAsDouble(), 0.001); + } + + @Test + void jackson_deserializeInfiniteSessionConfigEmpty() throws Exception { + String json = "{}"; + var cfg = MAPPER.readValue(json, InfiniteSessionConfig.class); + assertTrue(cfg.getEnabled().isEmpty()); + assertTrue(cfg.getBackgroundCompactionThreshold().isEmpty()); + assertTrue(cfg.getBufferExhaustionThreshold().isEmpty()); + } + + // ── Jackson serialization roundtrip ─────────────────────────────── + // + // Classes whose fields carry @JsonProperty (InfiniteSessionConfig, + // ModelCapabilitiesOverride inner classes) are serialized via field + // access: Jackson writes the field when set and omits it when cleared. + // + // Classes without @JsonProperty on fields (SessionConfig, + // CopilotClientOptions, TelemetryConfig, ProviderConfig) are not + // directly serialized β€” their values are copied to wire DTOs by + // SessionRequestBuilder. The @JsonIgnore on their Optional-returning + // getters prevents Jackson from attempting to serialize Optional + // wrappers if the class is ever processed. + + @Test + void jackson_infiniteSessionConfigClearedFieldsOmitted() throws Exception { + var cfg = new InfiniteSessionConfig(); + cfg.setEnabled(true); + cfg.setBackgroundCompactionThreshold(0.75); + cfg.setBufferExhaustionThreshold(0.9); + + String withFields = MAPPER.writeValueAsString(cfg); + assertTrue(withFields.contains("enabled")); + assertTrue(withFields.contains("backgroundCompactionThreshold")); + assertTrue(withFields.contains("bufferExhaustionThreshold")); + + cfg.clearEnabled(); + cfg.clearBackgroundCompactionThreshold(); + cfg.clearBufferExhaustionThreshold(); + + String cleared = MAPPER.writeValueAsString(cfg); + assertFalse(cleared.contains("enabled")); + assertFalse(cleared.contains("backgroundCompactionThreshold")); + assertFalse(cleared.contains("bufferExhaustionThreshold")); + } + + @Test + void jackson_modelCapabilitiesOverrideSupportsClearedFieldsOmitted() throws Exception { + var supports = new ModelCapabilitiesOverride.Supports(); + supports.setVision(true); + supports.setReasoningEffort(false); + + String withFields = MAPPER.writeValueAsString(supports); + assertTrue(withFields.contains("vision")); + assertTrue(withFields.contains("reasoningEffort")); + + supports.clearVision(); + supports.clearReasoningEffort(); + + String cleared = MAPPER.writeValueAsString(supports); + assertFalse(cleared.contains("vision")); + assertFalse(cleared.contains("reasoningEffort")); + } + + @Test + void jackson_modelCapabilitiesOverrideLimitsClearedFieldsOmitted() throws Exception { + var limits = new ModelCapabilitiesOverride.Limits(); + limits.setMaxPromptTokens(2048); + limits.setMaxOutputTokens(512); + limits.setMaxContextWindowTokens(16384); + + String withFields = MAPPER.writeValueAsString(limits); + assertTrue(withFields.contains("max_prompt_tokens")); + assertTrue(withFields.contains("max_output_tokens")); + assertTrue(withFields.contains("max_context_window_tokens")); + + limits.clearMaxPromptTokens(); + limits.clearMaxOutputTokens(); + limits.clearMaxContextWindowTokens(); + + String cleared = MAPPER.writeValueAsString(limits); + assertFalse(cleared.contains("max_prompt_tokens")); + assertFalse(cleared.contains("max_output_tokens")); + assertFalse(cleared.contains("max_context_window_tokens")); + } +} diff --git a/src/test/java/com/github/copilot/sdk/PerSessionAuthTest.java b/src/test/java/com/github/copilot/sdk/PerSessionAuthTest.java new file mode 100644 index 0000000000..dd5de81b83 --- /dev/null +++ b/src/test/java/com/github/copilot/sdk/PerSessionAuthTest.java @@ -0,0 +1,145 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk; + +import static org.junit.jupiter.api.Assertions.*; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import com.github.copilot.sdk.generated.rpc.SessionAuthGetStatusResult; +import com.github.copilot.sdk.json.CopilotClientOptions; +import com.github.copilot.sdk.json.PermissionHandler; +import com.github.copilot.sdk.json.SessionConfig; + +/** + * Tests for per-session GitHub authentication. + * + *

+ * These tests verify that a per-session GitHub token is resolved into a full + * identity by the CLI runtime and that sessions with different tokens are + * isolated from each other. + *

+ */ +public class PerSessionAuthTest { + + private static E2ETestContext ctx; + + @BeforeAll + static void setup() throws Exception { + ctx = E2ETestContext.create(); + } + + @AfterAll + static void teardown() throws Exception { + if (ctx != null) { + ctx.close(); + } + } + + /** + * Creates a CopilotClient with the GitHub API URL redirected to the proxy so + * that per-session auth token resolution (fetchCopilotUser) is intercepted. + */ + private CopilotClient createAuthTestClient() { + Map env = new HashMap<>(ctx.getEnvironment()); + env.put("COPILOT_DEBUG_GITHUB_API_URL", ctx.getProxyUrl()); + return ctx.createClient(new CopilotClientOptions().setEnvironment(env)); + } + + private void setupCopilotUsers() throws Exception { + // Initialize proxy state before registering tokens β€” the proxy requires its + // internal state to be initialized (via /config) before it can handle the + // /copilot_internal/user endpoint used for per-session auth resolution. + ctx.initializeProxy(); + ctx.setCopilotUserByToken("token-alice", "alice", "individual_pro", ctx.getProxyUrl(), + "https://localhost:1/telemetry", "alice-tracking-id"); + ctx.setCopilotUserByToken("token-bob", "bob", "business", ctx.getProxyUrl(), "https://localhost:1/telemetry", + "bob-tracking-id"); + } + + @Test + void shouldAuthenticateWithGitHubToken() throws Exception { + setupCopilotUsers(); + + try (CopilotClient client = createAuthTestClient()) { + CopilotSession session = client.createSession(new SessionConfig().setGitHubToken("token-alice") + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get(); + + try { + SessionAuthGetStatusResult authStatus = session.getRpc().auth.getStatus().get(); + + assertTrue(authStatus.isAuthenticated(), "Expected session to be authenticated"); + assertEquals("alice", authStatus.login()); + } finally { + session.close(); + } + } + } + + @Test + void shouldIsolateAuthBetweenSessions() throws Exception { + setupCopilotUsers(); + + try (CopilotClient client = createAuthTestClient()) { + CopilotSession sessionA = client.createSession(new SessionConfig().setGitHubToken("token-alice") + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get(); + CopilotSession sessionB = client.createSession(new SessionConfig().setGitHubToken("token-bob") + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get(); + + try { + SessionAuthGetStatusResult statusA = sessionA.getRpc().auth.getStatus().get(); + SessionAuthGetStatusResult statusB = sessionB.getRpc().auth.getStatus().get(); + + assertTrue(statusA.isAuthenticated(), "Expected session A to be authenticated"); + assertEquals("alice", statusA.login()); + + assertTrue(statusB.isAuthenticated(), "Expected session B to be authenticated"); + assertEquals("bob", statusB.login()); + } finally { + sessionA.close(); + sessionB.close(); + } + } + } + + @Test + void shouldBeUnauthenticatedWithoutToken() throws Exception { + try (CopilotClient client = createAuthTestClient()) { + CopilotSession session = client + .createSession(new SessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get(); + + try { + SessionAuthGetStatusResult authStatus = session.getRpc().auth.getStatus().get(); + + // Without a per-session token, there is no per-session identity. + // In CI the process-level fake token may still authenticate globally, + // so we check login rather than isAuthenticated. + assertNull(authStatus.login(), "Expected no login without per-session token"); + } finally { + session.close(); + } + } + } + + @Test + void shouldFailWithInvalidToken() throws Exception { + setupCopilotUsers(); + + try (CopilotClient client = createAuthTestClient()) { + Exception ex = assertThrows(Exception.class, () -> { + CopilotSession session = client.createSession(new SessionConfig().setGitHubToken("invalid-token") + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get(); + session.close(); + }); + + assertNotNull(ex); + } + } +} diff --git a/src/test/java/com/github/copilot/sdk/PermissionRequestResultKindTest.java b/src/test/java/com/github/copilot/sdk/PermissionRequestResultKindTest.java index 5d68a560e5..ab81966dc9 100644 --- a/src/test/java/com/github/copilot/sdk/PermissionRequestResultKindTest.java +++ b/src/test/java/com/github/copilot/sdk/PermissionRequestResultKindTest.java @@ -22,43 +22,46 @@ public class PermissionRequestResultKindTest { @Test void wellKnownKinds_haveExpectedValues() { - assertEquals("approved", PermissionRequestResultKind.APPROVED.getValue()); - assertEquals("denied-by-rules", PermissionRequestResultKind.DENIED_BY_RULES.getValue()); - assertEquals("denied-no-approval-rule-and-could-not-request-from-user", - PermissionRequestResultKind.DENIED_COULD_NOT_REQUEST_FROM_USER.getValue()); - assertEquals("denied-interactively-by-user", - PermissionRequestResultKind.DENIED_INTERACTIVELY_BY_USER.getValue()); + assertEquals("approve-once", PermissionRequestResultKind.APPROVED.getValue()); + assertEquals("reject", PermissionRequestResultKind.REJECTED.getValue()); + assertEquals("user-not-available", PermissionRequestResultKind.USER_NOT_AVAILABLE.getValue()); assertEquals("no-result", PermissionRequestResultKind.NO_RESULT.getValue()); + + // Deprecated aliases still resolve + assertEquals(PermissionRequestResultKind.REJECTED, PermissionRequestResultKind.DENIED_INTERACTIVELY_BY_USER); + assertEquals(PermissionRequestResultKind.USER_NOT_AVAILABLE, + PermissionRequestResultKind.DENIED_COULD_NOT_REQUEST_FROM_USER); + assertEquals(PermissionRequestResultKind.USER_NOT_AVAILABLE, PermissionRequestResultKind.DENIED_BY_RULES); } @Test void equals_sameValue_returnsTrue() { - var a = new PermissionRequestResultKind("approved"); + var a = new PermissionRequestResultKind("approve-once"); assertEquals(PermissionRequestResultKind.APPROVED, a); assertEquals(a, PermissionRequestResultKind.APPROVED); } @Test void equals_differentValue_returnsFalse() { - assertNotEquals(PermissionRequestResultKind.APPROVED, PermissionRequestResultKind.DENIED_BY_RULES); + assertNotEquals(PermissionRequestResultKind.APPROVED, PermissionRequestResultKind.REJECTED); } @Test void equals_isCaseInsensitive() { - var upper = new PermissionRequestResultKind("APPROVED"); + var upper = new PermissionRequestResultKind("APPROVE-ONCE"); assertEquals(PermissionRequestResultKind.APPROVED, upper); } @Test void hashCode_isCaseInsensitive() { - var upper = new PermissionRequestResultKind("APPROVED"); + var upper = new PermissionRequestResultKind("APPROVE-ONCE"); assertEquals(PermissionRequestResultKind.APPROVED.hashCode(), upper.hashCode()); } @Test void toString_returnsValue() { - assertEquals("approved", PermissionRequestResultKind.APPROVED.toString()); - assertEquals("denied-by-rules", PermissionRequestResultKind.DENIED_BY_RULES.toString()); + assertEquals("approve-once", PermissionRequestResultKind.APPROVED.toString()); + assertEquals("reject", PermissionRequestResultKind.REJECTED.toString()); } @Test @@ -77,7 +80,7 @@ void constructor_nullValue_treatedAsEmpty() { @Test void equals_nonKindObject_returnsFalse() { - assertNotEquals(PermissionRequestResultKind.APPROVED, "approved"); + assertNotEquals(PermissionRequestResultKind.APPROVED, "approve-once"); } @Test @@ -85,36 +88,35 @@ void jsonSerialize_writesStringValue() throws Exception { ObjectMapper mapper = new ObjectMapper(); var result = new PermissionRequestResult().setKind(PermissionRequestResultKind.APPROVED); String json = mapper.writeValueAsString(result); - assertTrue(json.contains("\"kind\":\"approved\""), "Expected kind to be serialized as string: " + json); + assertTrue(json.contains("\"kind\":\"approve-once\""), "Expected kind to be serialized as string: " + json); } @Test void jsonDeserialize_readsStringValue() throws Exception { ObjectMapper mapper = new ObjectMapper(); - String json = "{\"kind\":\"denied-by-rules\"}"; + String json = "{\"kind\":\"reject\"}"; var result = mapper.readValue(json, PermissionRequestResult.class); - assertEquals("denied-by-rules", result.getKind()); + assertEquals("reject", result.getKind()); } @Test void permissionRequestResult_setKindWithKindType() { var result = new PermissionRequestResult().setKind(PermissionRequestResultKind.APPROVED); - assertEquals("approved", result.getKind()); + assertEquals("approve-once", result.getKind()); } @Test void permissionRequestResult_setKindWithString_backwardCompatible() { - var result = new PermissionRequestResult().setKind("approved"); - assertEquals("approved", result.getKind()); + var result = new PermissionRequestResult().setKind("approve-once"); + assertEquals("approve-once", result.getKind()); } @Test void jsonRoundTrip_allWellKnownKinds() throws Exception { ObjectMapper mapper = new ObjectMapper(); PermissionRequestResultKind[] kinds = {PermissionRequestResultKind.APPROVED, - PermissionRequestResultKind.DENIED_BY_RULES, - PermissionRequestResultKind.DENIED_COULD_NOT_REQUEST_FROM_USER, - PermissionRequestResultKind.DENIED_INTERACTIVELY_BY_USER, PermissionRequestResultKind.NO_RESULT,}; + PermissionRequestResultKind.REJECTED, PermissionRequestResultKind.USER_NOT_AVAILABLE, + PermissionRequestResultKind.NO_RESULT,}; for (PermissionRequestResultKind kind : kinds) { var result = new PermissionRequestResult().setKind(kind); String json = mapper.writeValueAsString(result); diff --git a/src/test/java/com/github/copilot/sdk/PermissionsTest.java b/src/test/java/com/github/copilot/sdk/PermissionsTest.java index 75f73ddbaf..6cc8eaa301 100644 --- a/src/test/java/com/github/copilot/sdk/PermissionsTest.java +++ b/src/test/java/com/github/copilot/sdk/PermissionsTest.java @@ -22,6 +22,7 @@ import com.github.copilot.sdk.json.PermissionHandler; import com.github.copilot.sdk.json.PermissionRequest; import com.github.copilot.sdk.json.PermissionRequestResult; +import com.github.copilot.sdk.json.PermissionRequestResultKind; import com.github.copilot.sdk.json.SessionConfig; import com.github.copilot.sdk.json.ResumeSessionConfig; import com.github.copilot.sdk.json.MessageOptions; @@ -67,7 +68,8 @@ void testPermissionHandlerForWriteOperations(TestInfo testInfo) throws Exception permissionRequests.add(request); assertEquals(sessionIdHolder[0], invocation.getSessionId()); // Approve the permission - return CompletableFuture.completedFuture(new PermissionRequestResult().setKind("approved")); + return CompletableFuture + .completedFuture(new PermissionRequestResult().setKind(PermissionRequestResultKind.APPROVED)); }); try (CopilotClient client = ctx.createClient()) { @@ -104,7 +106,7 @@ void testDenyPermission(TestInfo testInfo) throws Exception { var config = new SessionConfig().setOnPermissionRequest((request, invocation) -> { // Deny all permissions return CompletableFuture - .completedFuture(new PermissionRequestResult().setKind("denied-interactively-by-user")); + .completedFuture(new PermissionRequestResult().setKind(PermissionRequestResultKind.REJECTED)); }); try (CopilotClient client = ctx.createClient()) { @@ -171,7 +173,7 @@ void testAsyncPermissionHandler(TestInfo testInfo) throws Exception { } catch (InterruptedException e) { Thread.currentThread().interrupt(); } - return new PermissionRequestResult().setKind("approved"); + return new PermissionRequestResult().setKind(PermissionRequestResultKind.APPROVED); }); }); @@ -209,7 +211,8 @@ void testResumeSessionWithPermissionHandler(TestInfo testInfo) throws Exception // Resume with permission handler var resumeConfig = new ResumeSessionConfig().setOnPermissionRequest((request, invocation) -> { permissionRequests.add(request); - return CompletableFuture.completedFuture(new PermissionRequestResult().setKind("approved")); + return CompletableFuture + .completedFuture(new PermissionRequestResult().setKind(PermissionRequestResultKind.APPROVED)); }); CopilotSession session2 = client.resumeSession(sessionId, resumeConfig).get(); @@ -241,7 +244,8 @@ void testToolCallIdInPermissionRequests(TestInfo testInfo) throws Exception { receivedToolCallId[0] = true; assertFalse(request.getToolCallId().isEmpty(), "Tool call ID should not be empty"); } - return CompletableFuture.completedFuture(new PermissionRequestResult().setKind("approved")); + return CompletableFuture + .completedFuture(new PermissionRequestResult().setKind(PermissionRequestResultKind.APPROVED)); }); try (CopilotClient client = ctx.createClient()) { @@ -301,11 +305,9 @@ void testShouldDenyToolOperationsWhenHandlerExplicitlyDenies(TestInfo testInfo) ctx.configureForTest("permissions", "should_deny_tool_operations_when_handler_explicitly_denies"); try (CopilotClient client = ctx.createClient()) { - CopilotSession session = client - .createSession( - new SessionConfig().setOnPermissionRequest((request, - invocation) -> CompletableFuture.completedFuture(new PermissionRequestResult() - .setKind("denied-no-approval-rule-and-could-not-request-from-user")))) + CopilotSession session = client.createSession(new SessionConfig() + .setOnPermissionRequest((request, invocation) -> CompletableFuture.completedFuture( + new PermissionRequestResult().setKind(PermissionRequestResultKind.USER_NOT_AVAILABLE)))) .get(); final boolean[] permissionDenied = {false}; @@ -341,11 +343,9 @@ void testShouldDenyToolOperationsWhenHandlerExplicitlyDeniesAfterResume(TestInfo String sessionId = session1.getSessionId(); session1.sendAndWait(new MessageOptions().setPrompt("What is 1+1?")).get(60, TimeUnit.SECONDS); - CopilotSession session2 = client - .resumeSession(sessionId, - new ResumeSessionConfig().setOnPermissionRequest((request, - invocation) -> CompletableFuture.completedFuture(new PermissionRequestResult() - .setKind("denied-no-approval-rule-and-could-not-request-from-user")))) + CopilotSession session2 = client.resumeSession(sessionId, new ResumeSessionConfig() + .setOnPermissionRequest((request, invocation) -> CompletableFuture.completedFuture( + new PermissionRequestResult().setKind(PermissionRequestResultKind.USER_NOT_AVAILABLE)))) .get(); final boolean[] permissionDenied = {false}; @@ -363,4 +363,115 @@ void testShouldDenyToolOperationsWhenHandlerExplicitlyDeniesAfterResume(TestInfo session2.close(); } } + + /** + * Verifies that a permission handler returning {@code noResult} is handled + * correctly β€” the handler is called, and the session can be aborted afterward. + * + * @see Snapshot: permissions/should_deny_permission_with_noresult_kind + */ + @Test + void testShouldDenyPermissionWithNoResultKind() throws Exception { + ctx.configureForTest("permissions", "should_deny_permission_with_noresult_kind"); + + var permissionCalled = new CompletableFuture(); + + try (CopilotClient client = ctx.createClient()) { + CopilotSession session = client + .createSession(new SessionConfig().setOnPermissionRequest((request, invocation) -> { + permissionCalled.complete(true); + return CompletableFuture.completedFuture( + new PermissionRequestResult().setKind(PermissionRequestResultKind.NO_RESULT)); + })).get(); + + session.send(new MessageOptions().setPrompt("Run 'node --version'")); + + assertTrue(permissionCalled.get(30, TimeUnit.SECONDS), + "Expected the no-result permission handler to be called."); + + session.abort().get(10, TimeUnit.SECONDS); + session.close(); + } + } + + /** + * Verifies that the runtime short-circuits the permission handler when + * {@code session.permissions.setApproveAll(true)} has been called. + * + * @see Snapshot: + * permissions/should_short_circuit_permission_handler_when_set_approve_all_enabled + */ + @Test + void testShouldShortCircuitPermissionHandlerWhenSetApproveAllEnabled() throws Exception { + ctx.configureForTest("permissions", "should_short_circuit_permission_handler_when_set_approve_all_enabled"); + + var handlerCallCount = new int[]{0}; + + try (CopilotClient client = ctx.createClient()) { + CopilotSession session = client + .createSession(new SessionConfig().setOnPermissionRequest((request, invocation) -> { + handlerCallCount[0]++; + return CompletableFuture.completedFuture( + new PermissionRequestResult().setKind(PermissionRequestResultKind.APPROVED)); + })).get(); + + // Set approve-all so the runtime short-circuits + var setResult = session.getRpc().permissions + .setApproveAll(new com.github.copilot.sdk.generated.rpc.SessionPermissionsSetApproveAllParams( + session.getSessionId(), true, null)) + .get(10, TimeUnit.SECONDS); + assertTrue(setResult.success(), "setApproveAll should succeed"); + + AssistantMessageEvent response = session + .sendAndWait(new MessageOptions().setPrompt("Run 'echo test' and tell me what happens")) + .get(60, TimeUnit.SECONDS); + assertNotNull(response); + + // Handler should not have been called since runtime approves all + assertEquals(0, handlerCallCount[0], + "Permission handler should not be called when setApproveAll is enabled"); + + session.close(); + } + } + + /** + * Verifies that the SDK correctly waits for a slow permission handler before + * completing tool execution. + * + * @see Snapshot: permissions/should_wait_for_slow_permission_handler + */ + @Test + void testShouldWaitForSlowPermissionHandler() throws Exception { + ctx.configureForTest("permissions", "should_wait_for_slow_permission_handler"); + + var handlerEntered = new CompletableFuture(); + var releaseHandler = new CompletableFuture(); + + try (CopilotClient client = ctx.createClient()) { + CopilotSession session = client + .createSession(new SessionConfig().setOnPermissionRequest((request, invocation) -> { + handlerEntered.complete(null); + return releaseHandler.thenApply( + v -> new PermissionRequestResult().setKind(PermissionRequestResultKind.APPROVED)); + })).get(); + + // Capture the sendAndWait future before awaiting it so we can interact with the + // handler + CompletableFuture responseFuture = session + .sendAndWait(new MessageOptions().setPrompt("Run 'echo slow_handler_test'")); + + // Wait for permission handler to be entered + handlerEntered.get(30, TimeUnit.SECONDS); + + // Release the handler + releaseHandler.complete(null); + + // Session should complete successfully + AssistantMessageEvent message = responseFuture.get(60, TimeUnit.SECONDS); + assertNotNull(message); + + session.close(); + } + } } diff --git a/src/test/java/com/github/copilot/sdk/PreMcpToolCallHookTest.java b/src/test/java/com/github/copilot/sdk/PreMcpToolCallHookTest.java new file mode 100644 index 0000000000..37db10c17e --- /dev/null +++ b/src/test/java/com/github/copilot/sdk/PreMcpToolCallHookTest.java @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk; + +import static org.junit.jupiter.api.Assertions.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.TimeUnit; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.copilot.sdk.generated.AssistantMessageEvent; +import com.github.copilot.sdk.json.McpServerConfig; +import com.github.copilot.sdk.json.McpStdioServerConfig; +import com.github.copilot.sdk.json.MessageOptions; +import com.github.copilot.sdk.json.PermissionHandler; +import com.github.copilot.sdk.json.PreMcpToolCallHookInput; +import com.github.copilot.sdk.json.PreMcpToolCallHookOutput; +import com.github.copilot.sdk.json.SessionConfig; +import com.github.copilot.sdk.json.SessionHooks; + +/** + * Tests for preMcpToolCall hook functionality. + * + *

+ * These tests use the shared CapiProxy infrastructure for deterministic API + * response replay. Snapshots are stored in + * test/snapshots/pre_mcp_tool_call_hook/. + *

+ */ +public class PreMcpToolCallHookTest { + + private static final ObjectMapper MAPPER = JsonRpcClient.getObjectMapper(); + private static E2ETestContext ctx; + + @BeforeAll + static void setup() throws Exception { + ctx = E2ETestContext.create(); + } + + @AfterAll + static void teardown() throws Exception { + if (ctx != null) { + ctx.close(); + } + } + + /** + * Verifies that preMcpToolCall hook can set metadata on the MCP request. + * + * @see Snapshot: pre_mcp_tool_call_hook/should_set_meta_via_premcptoolcall_hook + */ + @Disabled("Requires snapshot: pre_mcp_tool_call_hook/should_set_meta_via_premcptoolcall_hook") + @Test + void testShouldSetMetaViaPreMcpToolCallHook() throws Exception { + ctx.configureForTest("pre_mcp_tool_call_hook", "should_set_meta_via_premcptoolcall_hook"); + + var hookInputs = new java.util.ArrayList(); + + var mcpServers = new HashMap(); + mcpServers.put("meta-echo", new McpStdioServerConfig().setCommand("npx").setArgs(List.of("-y", "mcp-meta-echo")) + .setTools(List.of("*")).setWorkingDirectory(ctx.getWorkDir().toString())); + + var hooks = new SessionHooks().setOnPreMcpToolCall((input, invocation) -> { + hookInputs.add(input); + JsonNode metaNode = MAPPER.valueToTree(Map.of("injected", "by-hook", "source", "test")); + return CompletableFuture.completedFuture(PreMcpToolCallHookOutput.withMeta(metaNode)); + }); + + try (CopilotClient client = ctx.createClient()) { + CopilotSession session = client.createSession(new SessionConfig().setMcpServers(mcpServers).setHooks(hooks) + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get(); + + AssistantMessageEvent response = session.sendAndWait(new MessageOptions().setPrompt( + "Use the meta-echo/echo_meta tool with value 'test-set'. Reply with just the raw tool result.")) + .get(60, TimeUnit.SECONDS); + + assertNotNull(response); + assertFalse(hookInputs.isEmpty(), "Should have received preMcpToolCall hook calls"); + + // Verify hook input fields + PreMcpToolCallHookInput hookInput = hookInputs.get(0); + assertEquals("meta-echo", hookInput.getServerName()); + assertNotNull(hookInput.getToolName()); + assertNotNull(hookInput.getCwd()); + assertTrue(hookInput.getTimestamp() > 0); + + // Verify the response contains the injected metadata + String content = response.getData().content(); + assertTrue(content.contains("by-hook"), "Response should contain injected metadata: " + content); + + session.close(); + } + } + + /** + * Verifies that preMcpToolCall hook can replace existing metadata. + * + * @see Snapshot: + * pre_mcp_tool_call_hook/should_replace_meta_via_premcptoolcall_hook + */ + @Disabled("Requires snapshot: pre_mcp_tool_call_hook/should_replace_meta_via_premcptoolcall_hook") + @Test + void testShouldReplaceMetaViaPreMcpToolCallHook() throws Exception { + ctx.configureForTest("pre_mcp_tool_call_hook", "should_replace_meta_via_premcptoolcall_hook"); + + var mcpServers = new HashMap(); + mcpServers.put("meta-echo", new McpStdioServerConfig().setCommand("npx").setArgs(List.of("-y", "mcp-meta-echo")) + .setTools(List.of("*")).setWorkingDirectory(ctx.getWorkDir().toString())); + + var hooks = new SessionHooks().setOnPreMcpToolCall((input, invocation) -> { + JsonNode metaNode = MAPPER.valueToTree(Map.of("replaced", "true", "original", "gone")); + return CompletableFuture.completedFuture(PreMcpToolCallHookOutput.withMeta(metaNode)); + }); + + try (CopilotClient client = ctx.createClient()) { + CopilotSession session = client.createSession(new SessionConfig().setMcpServers(mcpServers).setHooks(hooks) + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get(); + + AssistantMessageEvent response = session.sendAndWait(new MessageOptions().setPrompt( + "Use the meta-echo/echo_meta tool with value 'test-replace'. Reply with just the raw tool result.")) + .get(60, TimeUnit.SECONDS); + + assertNotNull(response); + + // Verify the response contains the replaced metadata + String content = response.getData().content(); + assertTrue(content.contains("replaced"), "Response should contain replaced metadata: " + content); + + session.close(); + } + } + + /** + * Verifies that preMcpToolCall hook can remove metadata from the MCP request. + * + * @see Snapshot: + * pre_mcp_tool_call_hook/should_remove_meta_via_premcptoolcall_hook + */ + @Disabled("Requires snapshot: pre_mcp_tool_call_hook/should_remove_meta_via_premcptoolcall_hook") + @Test + void testShouldRemoveMetaViaPreMcpToolCallHook() throws Exception { + ctx.configureForTest("pre_mcp_tool_call_hook", "should_remove_meta_via_premcptoolcall_hook"); + + var mcpServers = new HashMap(); + mcpServers.put("meta-echo", new McpStdioServerConfig().setCommand("npx").setArgs(List.of("-y", "mcp-meta-echo")) + .setTools(List.of("*")).setWorkingDirectory(ctx.getWorkDir().toString())); + + var hooks = new SessionHooks().setOnPreMcpToolCall((input, invocation) -> { + // Return output with null metaToUse to remove metadata + return CompletableFuture.completedFuture(PreMcpToolCallHookOutput.removeMeta()); + }); + + try (CopilotClient client = ctx.createClient()) { + CopilotSession session = client.createSession(new SessionConfig().setMcpServers(mcpServers).setHooks(hooks) + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get(); + + AssistantMessageEvent response = session.sendAndWait(new MessageOptions().setPrompt( + "Use the meta-echo/echo_meta tool with value 'test-remove'. Reply with just the raw tool result.")) + .get(60, TimeUnit.SECONDS); + + assertNotNull(response); + + session.close(); + } + } +} diff --git a/src/test/java/com/github/copilot/sdk/ProviderConfigTest.java b/src/test/java/com/github/copilot/sdk/ProviderConfigTest.java index d3e18010bc..6bbb3ae284 100644 --- a/src/test/java/com/github/copilot/sdk/ProviderConfigTest.java +++ b/src/test/java/com/github/copilot/sdk/ProviderConfigTest.java @@ -386,4 +386,52 @@ void testResumeSessionConfigWithoutProviderOmitsField() throws Exception { assertTrue(json.path("provider").isMissingNode(), "provider field should be omitted when null"); } + + // ========================================================================= + // Provider model and token limit overrides + // ========================================================================= + + @Test + void testProviderModelIdAndWireModelSerialization() throws Exception { + var provider = new ProviderConfig().setBaseUrl("https://example.com/provider") + .setHeaders(java.util.Map.of("Authorization", "Bearer provider-token")).setModelId("gpt-4o") + .setWireModel("my-finetune-v3").setMaxPromptTokens(100_000).setMaxOutputTokens(4096); + + JsonNode json = MAPPER.valueToTree(provider); + + assertEquals("https://example.com/provider", json.get("baseUrl").asText()); + assertEquals("Bearer provider-token", json.get("headers").get("Authorization").asText()); + assertEquals("gpt-4o", json.get("modelId").asText()); + assertEquals("my-finetune-v3", json.get("wireModel").asText()); + assertEquals(100_000, json.get("maxPromptTokens").asInt()); + assertEquals(4096, json.get("maxOutputTokens").asInt()); + + // Round-trip + ProviderConfig deserialized = MAPPER.readValue(MAPPER.writeValueAsString(provider), ProviderConfig.class); + assertEquals("gpt-4o", deserialized.getModelId()); + assertEquals("my-finetune-v3", deserialized.getWireModel()); + assertEquals(100_000, deserialized.getMaxPromptTokens().getAsInt()); + assertEquals(4096, deserialized.getMaxOutputTokens().getAsInt()); + } + + @Test + void testProviderModelFieldsDefaultToNull() { + var provider = new ProviderConfig(); + assertNull(provider.getModelId()); + assertNull(provider.getWireModel()); + assertTrue(provider.getMaxPromptTokens().isEmpty()); + assertTrue(provider.getMaxOutputTokens().isEmpty()); + } + + @Test + void testProviderModelFieldsOmittedWhenNull() throws Exception { + var provider = new ProviderConfig().setType("openai"); + + JsonNode json = MAPPER.valueToTree(provider); + + assertTrue(json.path("modelId").isMissingNode()); + assertTrue(json.path("wireModel").isMissingNode()); + assertTrue(json.path("maxPromptTokens").isMissingNode()); + assertTrue(json.path("maxOutputTokens").isMissingNode()); + } } diff --git a/src/test/java/com/github/copilot/sdk/RemoteSessionTest.java b/src/test/java/com/github/copilot/sdk/RemoteSessionTest.java new file mode 100644 index 0000000000..6e093db6ca --- /dev/null +++ b/src/test/java/com/github/copilot/sdk/RemoteSessionTest.java @@ -0,0 +1,399 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.copilot.sdk.json.CreateSessionRequest; +import com.github.copilot.sdk.json.ResumeSessionConfig; +import com.github.copilot.sdk.json.ResumeSessionRequest; +import com.github.copilot.sdk.json.SessionConfig; + +/** + * Tests for the {@code remoteSession} feature across all session config types. + *

+ * Validates the complete lifecycle of the remote session mode: + *

    + *
  • Getter/setter and fluent chaining on {@link SessionConfig} and + * {@link ResumeSessionConfig}
  • + *
  • Propagation through {@link SessionRequestBuilder} into + * {@link CreateSessionRequest} and {@link ResumeSessionRequest}
  • + *
  • JSON wire-format serialization: correct key, correct value, omission when + * unset
  • + *
  • Defensive copy via {@code copy()} preserves the value
  • + *
  • All three supported mode values ("off", "export", "on") are transmitted + * correctly
  • + *
+ */ +class RemoteSessionTest { + + private static final ObjectMapper MAPPER = JsonRpcClient.getObjectMapper(); + + // ========================================================================= + // SessionConfig getter/setter/copy + // ========================================================================= + + @Test + void sessionConfig_remoteSessionDefaultsToNull() { + var cfg = new SessionConfig(); + assertNull(cfg.getRemoteSession(), "remoteSession should be null when not set"); + } + + @ParameterizedTest + @ValueSource(strings = {"off", "export", "on"}) + void sessionConfig_setRemoteSessionReturnsSelf(String mode) { + var cfg = new SessionConfig(); + SessionConfig result = cfg.setRemoteSession(mode); + assertSame(cfg, result, "setRemoteSession should return the same instance for chaining"); + assertEquals(mode, cfg.getRemoteSession()); + } + + @Test + void sessionConfig_copyPreservesRemoteSession() { + var original = new SessionConfig().setRemoteSession("export"); + var copy = original.clone(); + assertEquals("export", copy.getRemoteSession()); + } + + @Test + void sessionConfig_copyPreservesNullRemoteSession() { + var original = new SessionConfig(); + var copy = original.clone(); + assertNull(copy.getRemoteSession()); + } + + @Test + void sessionConfig_setRemoteSessionToNullClearsValue() { + var cfg = new SessionConfig().setRemoteSession("on"); + cfg.setRemoteSession(null); + assertNull(cfg.getRemoteSession()); + } + + // ========================================================================= + // ResumeSessionConfig getter/setter/copy + // ========================================================================= + + @Test + void resumeSessionConfig_remoteSessionDefaultsToNull() { + var cfg = new ResumeSessionConfig(); + assertNull(cfg.getRemoteSession(), "remoteSession should be null when not set"); + } + + @ParameterizedTest + @ValueSource(strings = {"off", "export", "on"}) + void resumeSessionConfig_setRemoteSessionReturnsSelf(String mode) { + var cfg = new ResumeSessionConfig(); + ResumeSessionConfig result = cfg.setRemoteSession(mode); + assertSame(cfg, result, "setRemoteSession should return the same instance for chaining"); + assertEquals(mode, cfg.getRemoteSession()); + } + + @Test + void resumeSessionConfig_copyPreservesRemoteSession() { + var original = new ResumeSessionConfig().setRemoteSession("on"); + var copy = original.clone(); + assertEquals("on", copy.getRemoteSession()); + } + + // ========================================================================= + // SessionRequestBuilder – CreateSessionRequest wiring + // ========================================================================= + + @ParameterizedTest + @ValueSource(strings = {"off", "export", "on"}) + void buildCreateRequest_propagatesRemoteSession(String mode) { + var config = new SessionConfig().setRemoteSession(mode); + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + assertEquals(mode, request.getRemoteSession()); + } + + @Test + void buildCreateRequest_nullConfig_remoteSessionIsNull() { + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(null); + assertNull(request.getRemoteSession()); + } + + @Test + void buildCreateRequest_unsetRemoteSession_isNull() { + var config = new SessionConfig(); + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + assertNull(request.getRemoteSession()); + } + + // ========================================================================= + // SessionRequestBuilder – ResumeSessionRequest wiring + // ========================================================================= + + @ParameterizedTest + @ValueSource(strings = {"off", "export", "on"}) + void buildResumeRequest_propagatesRemoteSession(String mode) { + var config = new ResumeSessionConfig().setRemoteSession(mode); + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-1", config); + assertEquals(mode, request.getRemoteSession()); + } + + @Test + void buildResumeRequest_nullConfig_remoteSessionIsNull() { + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-1", null); + assertNull(request.getRemoteSession()); + } + + @Test + void buildResumeRequest_unsetRemoteSession_isNull() { + var config = new ResumeSessionConfig(); + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-1", config); + assertNull(request.getRemoteSession()); + } + + // ========================================================================= + // JSON wire-format: CreateSessionRequest + // ========================================================================= + + @ParameterizedTest + @ValueSource(strings = {"off", "export", "on"}) + void createRequest_serializesRemoteSessionCorrectly(String mode) throws Exception { + var config = new SessionConfig().setRemoteSession(mode); + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + + String json = MAPPER.writeValueAsString(request); + JsonNode tree = MAPPER.readTree(json); + + assertTrue(tree.has("remoteSession"), "Serialized JSON should contain 'remoteSession' field for mode: " + mode); + assertEquals(mode, tree.get("remoteSession").asText()); + } + + @Test + void createRequest_omitsRemoteSessionWhenNull() throws Exception { + var config = new SessionConfig(); + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + + String json = MAPPER.writeValueAsString(request); + JsonNode tree = MAPPER.readTree(json); + + assertFalse(tree.has("remoteSession"), "Serialized JSON should omit 'remoteSession' when not set"); + } + + // ========================================================================= + // JSON wire-format: ResumeSessionRequest + // ========================================================================= + + @ParameterizedTest + @ValueSource(strings = {"off", "export", "on"}) + void resumeRequest_serializesRemoteSessionCorrectly(String mode) throws Exception { + var config = new ResumeSessionConfig().setRemoteSession(mode); + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-1", config); + + String json = MAPPER.writeValueAsString(request); + JsonNode tree = MAPPER.readTree(json); + + assertTrue(tree.has("remoteSession"), "Serialized JSON should contain 'remoteSession' field for mode: " + mode); + assertEquals(mode, tree.get("remoteSession").asText()); + } + + @Test + void resumeRequest_omitsRemoteSessionWhenNull() throws Exception { + var config = new ResumeSessionConfig(); + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-1", config); + + String json = MAPPER.writeValueAsString(request); + JsonNode tree = MAPPER.readTree(json); + + assertFalse(tree.has("remoteSession"), "Serialized JSON should omit 'remoteSession' when not set"); + } + + // ========================================================================= + // JSON round-trip: CreateSessionRequest + // ========================================================================= + + @ParameterizedTest + @ValueSource(strings = {"off", "export", "on"}) + void createRequest_roundTripsRemoteSession(String mode) throws Exception { + var config = new SessionConfig().setRemoteSession(mode); + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + + String json = MAPPER.writeValueAsString(request); + CreateSessionRequest deserialized = MAPPER.readValue(json, CreateSessionRequest.class); + assertEquals(mode, deserialized.getRemoteSession()); + } + + @Test + void createRequest_roundTripsNullRemoteSession() throws Exception { + var config = new SessionConfig(); + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + + String json = MAPPER.writeValueAsString(request); + CreateSessionRequest deserialized = MAPPER.readValue(json, CreateSessionRequest.class); + assertNull(deserialized.getRemoteSession()); + } + + // ========================================================================= + // JSON round-trip: ResumeSessionRequest + // ========================================================================= + + @ParameterizedTest + @ValueSource(strings = {"off", "export", "on"}) + void resumeRequest_roundTripsRemoteSession(String mode) throws Exception { + var config = new ResumeSessionConfig().setRemoteSession(mode); + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-1", config); + + String json = MAPPER.writeValueAsString(request); + ResumeSessionRequest deserialized = MAPPER.readValue(json, ResumeSessionRequest.class); + assertEquals(mode, deserialized.getRemoteSession()); + } + + // ========================================================================= + // Fluent chaining: remoteSession composes with other config options + // ========================================================================= + + @Test + void sessionConfig_remoteSessionComposesWithOtherFields() { + var config = new SessionConfig().setModel("gpt-4o").setRemoteSession("export").setReasoningEffort("high"); + + assertEquals("gpt-4o", config.getModel()); + assertEquals("export", config.getRemoteSession()); + assertEquals("high", config.getReasoningEffort()); + } + + @Test + void resumeSessionConfig_remoteSessionComposesWithOtherFields() { + var config = new ResumeSessionConfig().setModel("gpt-4o").setRemoteSession("on").setReasoningEffort("medium"); + + assertEquals("gpt-4o", config.getModel()); + assertEquals("on", config.getRemoteSession()); + assertEquals("medium", config.getReasoningEffort()); + } + + @Test + void createRequest_remoteSessionDoesNotAffectOtherFields() throws Exception { + var config = new SessionConfig().setModel("gpt-4o").setRemoteSession("export").setReasoningEffort("high") + .setGitHubToken("ghp_test"); + + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + String json = MAPPER.writeValueAsString(request); + JsonNode tree = MAPPER.readTree(json); + + assertEquals("export", tree.get("remoteSession").asText()); + assertEquals("gpt-4o", tree.get("model").asText()); + assertEquals("high", tree.get("reasoningEffort").asText()); + assertEquals("ghp_test", tree.get("gitHubToken").asText()); + } + + @Test + void resumeRequest_remoteSessionDoesNotAffectOtherFields() throws Exception { + var config = new ResumeSessionConfig().setModel("gpt-4o").setRemoteSession("on").setReasoningEffort("medium") + .setGitHubToken("ghp_test"); + + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-1", config); + String json = MAPPER.writeValueAsString(request); + JsonNode tree = MAPPER.readTree(json); + + assertEquals("on", tree.get("remoteSession").asText()); + assertEquals("gpt-4o", tree.get("model").asText()); + assertEquals("medium", tree.get("reasoningEffort").asText()); + assertEquals("ghp_test", tree.get("gitHubToken").asText()); + } + + // ========================================================================= + // Deserialization from raw JSON (simulates CLI response ingestion) + // ========================================================================= + + @Test + void createRequest_deserializesRemoteSessionFromRawJson() throws Exception { + String json = """ + { + "sessionId": "test-session", + "remoteSession": "export", + "model": "gpt-4o" + } + """; + CreateSessionRequest request = MAPPER.readValue(json, CreateSessionRequest.class); + assertEquals("export", request.getRemoteSession()); + assertEquals("test-session", request.getSessionId()); + } + + @Test + void resumeRequest_deserializesRemoteSessionFromRawJson() throws Exception { + String json = """ + { + "sessionId": "resume-session", + "remoteSession": "on", + "model": "gpt-4o" + } + """; + ResumeSessionRequest request = MAPPER.readValue(json, ResumeSessionRequest.class); + assertEquals("on", request.getRemoteSession()); + assertEquals("resume-session", request.getSessionId()); + } + + @Test + void createRequest_deserializesWithMissingRemoteSession() throws Exception { + String json = """ + { + "sessionId": "test-session", + "model": "gpt-4o" + } + """; + CreateSessionRequest request = MAPPER.readValue(json, CreateSessionRequest.class); + assertNull(request.getRemoteSession()); + } + + // ========================================================================= + // Handoff event with remoteSessionId (remote session lifecycle) + // ========================================================================= + + @Test + void handoffEvent_withRemoteSourceType_containsRemoteSessionId() throws Exception { + String json = """ + { + "type": "session.handoff", + "data": { + "handoffTime": "2025-06-01T12:00:00Z", + "sourceType": "remote", + "remoteSessionId": "remote-sess-42", + "summary": "Session exported for remote execution", + "repository": { + "owner": "test-org", + "name": "test-repo", + "branch": "feature-branch" + } + } + } + """; + + var event = (com.github.copilot.sdk.generated.SessionHandoffEvent) MAPPER.readValue(json, + com.github.copilot.sdk.generated.SessionEvent.class); + assertNotNull(event); + var data = event.getData(); + assertEquals("remote-sess-42", data.remoteSessionId()); + assertEquals(com.github.copilot.sdk.generated.HandoffSourceType.REMOTE, data.sourceType()); + assertEquals("Session exported for remote execution", data.summary()); + assertEquals("test-org", data.repository().owner()); + assertEquals("test-repo", data.repository().name()); + assertEquals("feature-branch", data.repository().branch()); + } + + @Test + void handoffEvent_withoutRemoteSessionId_fieldIsNull() throws Exception { + String json = """ + { + "type": "session.handoff", + "data": { + "targetAgent": "local-agent" + } + } + """; + + var event = (com.github.copilot.sdk.generated.SessionHandoffEvent) MAPPER.readValue(json, + com.github.copilot.sdk.generated.SessionEvent.class); + assertNotNull(event); + assertNull(event.getData().remoteSessionId()); + } +} diff --git a/src/test/java/com/github/copilot/sdk/RpcHandlerDispatcherTest.java b/src/test/java/com/github/copilot/sdk/RpcHandlerDispatcherTest.java index 315a38b900..7453a7b266 100644 --- a/src/test/java/com/github/copilot/sdk/RpcHandlerDispatcherTest.java +++ b/src/test/java/com/github/copilot/sdk/RpcHandlerDispatcherTest.java @@ -304,7 +304,7 @@ void permissionRequestWithUnknownSession() throws Exception { JsonNode response = readResponse(); JsonNode result = response.get("result").get("result"); - assertEquals("denied-no-approval-rule-and-could-not-request-from-user", result.get("kind").asText()); + assertEquals("user-not-available", result.get("kind").asText()); } @Test @@ -339,7 +339,7 @@ void permissionRequestHandlerFails() throws Exception { JsonNode response = readResponse(); // CopilotSession catches the exception and returns a denied result JsonNode result = response.get("result").get("result"); - assertEquals("denied-no-approval-rule-and-could-not-request-from-user", result.get("kind").asText()); + assertEquals("user-not-available", result.get("kind").asText()); } @Test @@ -358,7 +358,7 @@ void permissionRequestV2RejectsNoResult() throws Exception { // to the exception path and respond with denied. JsonNode response = readResponse(); JsonNode result = response.get("result").get("result"); - assertEquals("denied-no-approval-rule-and-could-not-request-from-user", result.get("kind").asText()); + assertEquals("user-not-available", result.get("kind").asText()); } // ===== userInput.request tests ===== diff --git a/src/test/java/com/github/copilot/sdk/RpcWrappersTest.java b/src/test/java/com/github/copilot/sdk/RpcWrappersTest.java index 7d7b0dca46..e2356d985a 100644 --- a/src/test/java/com/github/copilot/sdk/RpcWrappersTest.java +++ b/src/test/java/com/github/copilot/sdk/RpcWrappersTest.java @@ -145,7 +145,7 @@ void sessionRpc_instantiates_with_all_namespace_fields() { assertNotNull(session.model); assertNotNull(session.mode); assertNotNull(session.plan); - assertNotNull(session.workspace); + assertNotNull(session.workspaces); assertNotNull(session.fleet); assertNotNull(session.agent); assertNotNull(session.skills); @@ -183,7 +183,7 @@ void sessionRpc_model_switchTo_merges_sessionId_with_extra_params() { var session = new SessionRpc(stub, "sess-xyz"); // switchTo takes extra params beyond sessionId - var switchParams = new SessionModelSwitchToParams(null, "gpt-5", null, null); + var switchParams = new SessionModelSwitchToParams(null, "gpt-5", null, null, null); session.model.switchTo(switchParams); assertEquals(1, stub.calls.size()); diff --git a/src/test/java/com/github/copilot/sdk/SessionConfigE2ETest.java b/src/test/java/com/github/copilot/sdk/SessionConfigE2ETest.java new file mode 100644 index 0000000000..4c2691d86f --- /dev/null +++ b/src/test/java/com/github/copilot/sdk/SessionConfigE2ETest.java @@ -0,0 +1,174 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk; + +import static org.junit.jupiter.api.Assertions.*; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import com.github.copilot.sdk.json.MessageOptions; +import com.github.copilot.sdk.json.PermissionHandler; +import com.github.copilot.sdk.json.ProviderConfig; +import com.github.copilot.sdk.json.ResumeSessionConfig; +import com.github.copilot.sdk.json.SessionConfig; + +/** + * E2E tests for session configuration features. + */ +public class SessionConfigE2ETest { + + private static E2ETestContext ctx; + + @BeforeAll + static void setup() throws Exception { + ctx = E2ETestContext.create(); + } + + @AfterAll + static void teardown() throws Exception { + if (ctx != null) { + ctx.close(); + } + } + + @Test + void testShouldApplyInstructionDirectoriesOnCreate() throws Exception { + ctx.configureForTest("session_config", "should_apply_instructiondirectories_on_create"); + + // Set up instruction directory with a custom instruction file + Path projectDir = ctx.getWorkDir().resolve("instruction-create-project"); + Path instructionDir = ctx.getWorkDir().resolve("extra-create-instructions"); + Path instructionFilesDir = instructionDir.resolve(".github").resolve("instructions"); + String sentinel = "JAVA_CREATE_INSTRUCTION_DIRECTORIES_SENTINEL"; + Files.createDirectories(projectDir); + Files.createDirectories(instructionFilesDir); + Files.writeString(instructionFilesDir.resolve("extra.instructions.md"), "Always include " + sentinel + "."); + + try (CopilotClient client = ctx.createClient()) { + CopilotSession session = client.createSession(new SessionConfig().setWorkingDirectory(projectDir.toString()) + .setInstructionDirectories(List.of(instructionDir.toString())) + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get(); + + session.sendAndWait(new MessageOptions().setPrompt("What is 1+1?")).get(60, TimeUnit.SECONDS); + + List> exchanges = ctx.getExchanges(); + assertFalse(exchanges.isEmpty(), "Should have at least one exchange"); + String systemMessage = getSystemMessage(exchanges.get(0)); + assertNotNull(systemMessage, "System message should not be null"); + assertTrue(systemMessage.contains(sentinel), + "System message should contain the instruction sentinel: " + sentinel); + } + } + + @Test + void testShouldApplyInstructionDirectoriesOnResume() throws Exception { + ctx.configureForTest("session_config", "should_apply_instructiondirectories_on_resume"); + + // Set up instruction directory with a custom instruction file + Path projectDir = ctx.getWorkDir().resolve("instruction-resume-project"); + Path instructionDir = ctx.getWorkDir().resolve("extra-resume-instructions"); + Path instructionFilesDir = instructionDir.resolve(".github").resolve("instructions"); + String sentinel = "JAVA_RESUME_INSTRUCTION_DIRECTORIES_SENTINEL"; + Files.createDirectories(projectDir); + Files.createDirectories(instructionFilesDir); + Files.writeString(instructionFilesDir.resolve("extra.instructions.md"), "Always include " + sentinel + "."); + + try (CopilotClient client = ctx.createClient()) { + // Create a session first + CopilotSession session1 = client.createSession(new SessionConfig() + .setWorkingDirectory(projectDir.toString()).setOnPermissionRequest(PermissionHandler.APPROVE_ALL)) + .get(); + + // Resume with instructionDirectories + CopilotSession session2 = client.resumeSession(session1.getSessionId(), + new ResumeSessionConfig().setWorkingDirectory(projectDir.toString()) + .setInstructionDirectories(List.of(instructionDir.toString())) + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL)) + .get(); + + session2.sendAndWait(new MessageOptions().setPrompt("What is 1+1?")).get(60, TimeUnit.SECONDS); + + List> exchanges = ctx.getExchanges(); + assertFalse(exchanges.isEmpty(), "Should have at least one exchange"); + String systemMessage = getSystemMessage(exchanges.get(0)); + assertNotNull(systemMessage, "System message should not be null"); + assertTrue(systemMessage.contains(sentinel), + "System message should contain the instruction sentinel: " + sentinel); + } + } + + @Test + void testShouldForwardProviderWireModel() throws Exception { + ctx.configureForTest("session_config", "should_forward_provider_wire_model"); + + try (CopilotClient client = ctx.createClient()) { + CopilotSession session = client + .createSession(new SessionConfig().setModel("claude-sonnet-4.5") + .setProvider(new ProviderConfig().setType("openai").setBaseUrl(ctx.getProxyUrl()) + .setApiKey("test-provider-key").setWireModel("test-wire-model") + .setMaxOutputTokens(1024)) + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL)) + .get(); + + session.sendAndWait(new MessageOptions().setPrompt("What is 1+1?")).get(30, TimeUnit.SECONDS); + + List> exchanges = ctx.getExchanges(); + assertFalse(exchanges.isEmpty(), "Should have at least one exchange"); + @SuppressWarnings("unchecked") + Map request = (Map) exchanges.get(0).get("request"); + assertEquals("test-wire-model", request.get("model")); + } + } + + @Test + void testShouldUseProviderModelIdAsWireModel() throws Exception { + ctx.configureForTest("session_config", "should_use_provider_model_id_as_wire_model"); + + try (CopilotClient client = ctx.createClient()) { + CopilotSession session = client.createSession(new SessionConfig() + .setProvider(new ProviderConfig().setType("openai").setBaseUrl(ctx.getProxyUrl()) + .setApiKey("test-provider-key").setModelId("claude-sonnet-4.5")) + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get(); + + session.sendAndWait(new MessageOptions().setPrompt("What is 1+1?")).get(30, TimeUnit.SECONDS); + + List> exchanges = ctx.getExchanges(); + assertFalse(exchanges.isEmpty(), "Should have at least one exchange"); + @SuppressWarnings("unchecked") + Map request = (Map) exchanges.get(0).get("request"); + assertEquals("claude-sonnet-4.5", request.get("model")); + } + } + + @SuppressWarnings("unchecked") + private static String getSystemMessage(Map exchange) { + // The exchange structure is: { request: { messages: [...] }, response: ..., + // requestHeaders: ... } + Object requestObj = exchange.get("request"); + if (!(requestObj instanceof Map request)) { + return null; + } + Object messagesObj = request.get("messages"); + if (messagesObj instanceof List messages) { + for (Object msg : messages) { + if (msg instanceof Map msgMap) { + if ("system".equals(msgMap.get("role"))) { + Object content = msgMap.get("content"); + return content != null ? content.toString() : null; + } + } + } + } + return null; + } +} diff --git a/src/test/java/com/github/copilot/sdk/SessionEventDeserializationTest.java b/src/test/java/com/github/copilot/sdk/SessionEventDeserializationTest.java index baa572f357..0abec58f95 100644 --- a/src/test/java/com/github/copilot/sdk/SessionEventDeserializationTest.java +++ b/src/test/java/com/github/copilot/sdk/SessionEventDeserializationTest.java @@ -736,7 +736,7 @@ void testParseAbortEvent() throws Exception { { "type": "abort", "data": { - "reason": "user_requested" + "reason": "user_initiated" } } """; @@ -791,12 +791,11 @@ void testParseSessionShutdownEvent() throws Exception { assertEquals("session.shutdown", event.getType()); var shutdownEvent = (SessionShutdownEvent) event; - assertEquals(SessionShutdownEvent.SessionShutdownEventData.SessionShutdownEventDataShutdownType.ROUTINE, - shutdownEvent.getData().shutdownType()); - assertEquals(5.0, shutdownEvent.getData().totalPremiumRequests()); + assertEquals(ShutdownType.ROUTINE, shutdownEvent.getData().shutdownType()); + assertEquals(Double.valueOf(5.0), shutdownEvent.getData().totalPremiumRequests()); assertEquals("gpt-4", shutdownEvent.getData().currentModel()); assertNotNull(shutdownEvent.getData().codeChanges()); - assertEquals(10.0, shutdownEvent.getData().codeChanges().linesAdded()); + assertEquals((Long) 10L, shutdownEvent.getData().codeChanges().linesAdded()); } @Test @@ -1055,7 +1054,7 @@ void testSessionStartEventAllFields() throws Exception { assertNotNull(event); var data = event.getData(); assertEquals("sess-full", data.sessionId()); - assertEquals(2.0, data.version()); + assertEquals((Long) 2L, data.version()); assertEquals("copilot-cli", data.producer()); assertEquals("1.2.3", data.copilotVersion()); assertNotNull(data.startTime()); @@ -1078,7 +1077,7 @@ void testSessionResumeEventAllFields() throws Exception { assertNotNull(event); var data = event.getData(); assertNotNull(data.resumeTime()); - assertEquals(42.0, data.eventCount()); + assertEquals((Long) 42L, data.eventCount()); } @Test @@ -1148,8 +1147,7 @@ void testSessionHandoffEventAllFields() throws Exception { assertNotNull(event); var data = event.getData(); assertNotNull(data.handoffTime()); - assertEquals(SessionHandoffEvent.SessionHandoffEventData.SessionHandoffEventDataSourceType.REMOTE, - data.sourceType()); + assertEquals(HandoffSourceType.REMOTE, data.sourceType()); assertEquals("additional context", data.context()); assertEquals("handoff summary", data.summary()); assertEquals("remote-sess-1", data.remoteSessionId()); @@ -1180,13 +1178,13 @@ void testSessionTruncationEventAllFields() throws Exception { var event = (SessionTruncationEvent) parseJson(json); assertNotNull(event); var data = event.getData(); - assertEquals(128000.0, data.tokenLimit()); - assertEquals(150000.0, data.preTruncationTokensInMessages()); - assertEquals(100.0, data.preTruncationMessagesLength()); - assertEquals(120000.0, data.postTruncationTokensInMessages()); - assertEquals(80.0, data.postTruncationMessagesLength()); - assertEquals(30000.0, data.tokensRemovedDuringTruncation()); - assertEquals(20.0, data.messagesRemovedDuringTruncation()); + assertEquals((Long) 128000L, data.tokenLimit()); + assertEquals((Long) 150000L, data.preTruncationTokensInMessages()); + assertEquals((Long) 100L, data.preTruncationMessagesLength()); + assertEquals((Long) 120000L, data.postTruncationTokensInMessages()); + assertEquals((Long) 80L, data.postTruncationMessagesLength()); + assertEquals((Long) 30000L, data.tokensRemovedDuringTruncation()); + assertEquals((Long) 20L, data.messagesRemovedDuringTruncation()); assertEquals("system", data.performedBy()); } @@ -1206,9 +1204,9 @@ void testSessionUsageInfoEventAllFields() throws Exception { var event = (SessionUsageInfoEvent) parseJson(json); assertNotNull(event); var data = event.getData(); - assertEquals(128000.0, data.tokenLimit()); - assertEquals(50000.0, data.currentTokens()); - assertEquals(25.0, data.messagesLength()); + assertEquals((Long) 128000L, data.tokenLimit()); + assertEquals((Long) 50000L, data.currentTokens()); + assertEquals((Long) 25L, data.messagesLength()); } @Test @@ -1228,9 +1226,9 @@ void testSessionCompactionCompleteEventAllFields() throws Exception { "checkpointNumber": 3.0, "checkpointPath": "/checkpoints/3", "compactionTokensUsed": { - "input": 1000, - "output": 500, - "cachedInput": 200 + "inputTokens": 1000, + "outputTokens": 500, + "cacheReadTokens": 200 }, "requestId": "req-compact-1" } @@ -1242,21 +1240,21 @@ void testSessionCompactionCompleteEventAllFields() throws Exception { var data = event.getData(); assertTrue(data.success()); assertNull(data.error()); - assertEquals(150000.0, data.preCompactionTokens()); - assertEquals(60000.0, data.postCompactionTokens()); - assertEquals(100.0, data.preCompactionMessagesLength()); - assertEquals(50.0, data.messagesRemoved()); - assertEquals(90000.0, data.tokensRemoved()); + assertEquals((Long) 150000L, data.preCompactionTokens()); + assertEquals((Long) 60000L, data.postCompactionTokens()); + assertEquals((Long) 100L, data.preCompactionMessagesLength()); + assertEquals((Long) 50L, data.messagesRemoved()); + assertEquals((Long) 90000L, data.tokensRemoved()); assertEquals("Compacted conversation", data.summaryContent()); - assertEquals(3.0, data.checkpointNumber()); + assertEquals((Long) 3L, data.checkpointNumber()); assertEquals("/checkpoints/3", data.checkpointPath()); assertEquals("req-compact-1", data.requestId()); var tokens = data.compactionTokensUsed(); assertNotNull(tokens); - assertEquals(1000.0, tokens.input()); - assertEquals(500.0, tokens.output()); - assertEquals(200.0, tokens.cachedInput()); + assertEquals((Long) 1000L, tokens.inputTokens()); + assertEquals((Long) 500L, tokens.outputTokens()); + assertEquals((Long) 200L, tokens.cacheReadTokens()); } @Test @@ -1288,19 +1286,18 @@ void testSessionShutdownEventAllFields() throws Exception { var event = (SessionShutdownEvent) parseJson(json); assertNotNull(event); var data = event.getData(); - assertEquals(SessionShutdownEvent.SessionShutdownEventData.SessionShutdownEventDataShutdownType.ERROR, - data.shutdownType()); + assertEquals(ShutdownType.ERROR, data.shutdownType()); assertEquals("OOM", data.errorReason()); - assertEquals(10.0, data.totalPremiumRequests()); - assertEquals(5000.5, data.totalApiDurationMs()); - assertEquals(1700000000000.0, data.sessionStartTime()); + assertEquals(Double.valueOf(10.0), data.totalPremiumRequests()); + assertEquals((Long) 5000L, data.totalApiDurationMs()); + assertEquals((Long) 1700000000000L, data.sessionStartTime()); assertEquals("gpt-4-turbo", data.currentModel()); assertNotNull(data.modelMetrics()); var changes = data.codeChanges(); assertNotNull(changes); - assertEquals(50.0, changes.linesAdded()); - assertEquals(20.0, changes.linesRemoved()); + assertEquals((Long) 50L, changes.linesAdded()); + assertEquals((Long) 20L, changes.linesRemoved()); assertNotNull(changes.filesModified()); assertEquals(3, changes.filesModified().size()); assertEquals("a.java", changes.filesModified().get(0)); @@ -1394,7 +1391,7 @@ void testAssistantStreamingDeltaEventAllFields() throws Exception { var event = (AssistantStreamingDeltaEvent) parseJson(json); assertNotNull(event); assertEquals("assistant.streaming_delta", event.getType()); - assertEquals(4096.0, event.getData().totalResponseSizeBytes()); + assertEquals((Long) 4096L, event.getData().totalResponseSizeBytes()); } @Test @@ -1485,12 +1482,12 @@ void testAssistantUsageEventAllFields() throws Exception { assertNotNull(event); var data = event.getData(); assertEquals("gpt-4-turbo", data.model()); - assertEquals(500.0, data.inputTokens()); - assertEquals(200.0, data.outputTokens()); - assertEquals(50.0, data.cacheReadTokens()); - assertEquals(150.0, data.cacheWriteTokens()); + assertEquals((Long) 500L, data.inputTokens()); + assertEquals((Long) 200L, data.outputTokens()); + assertEquals((Long) 50L, data.cacheReadTokens()); + assertEquals((Long) 150L, data.cacheWriteTokens()); assertEquals(0.05, data.cost()); - assertEquals(1234.5, data.duration()); + assertEquals((Long) 1234L, data.duration()); assertEquals("user", data.initiator()); assertEquals("api-1", data.apiCallId()); assertEquals("prov-1", data.providerCallId()); @@ -1500,11 +1497,11 @@ void testAssistantUsageEventAllFields() throws Exception { // Verify copilotUsage assertNotNull(data.copilotUsage()); - assertEquals(1234567.0, data.copilotUsage().totalNanoAiu()); + assertEquals(Double.valueOf(1234567.0), data.copilotUsage().totalNanoAiu()); assertNotNull(data.copilotUsage().tokenDetails()); assertEquals(2, data.copilotUsage().tokenDetails().size()); assertEquals("input", data.copilotUsage().tokenDetails().get(0).tokenType()); - assertEquals(500.0, data.copilotUsage().tokenDetails().get(0).tokenCount()); + assertEquals((Long) 500L, data.copilotUsage().tokenDetails().get(0).tokenCount()); assertEquals("output", data.copilotUsage().tokenDetails().get(1).tokenType()); } @@ -1525,10 +1522,8 @@ void testAssistantUsageEventWithNullQuotaSnapshots() throws Exception { assertNotNull(event); var data = event.getData(); assertEquals("gpt-4-turbo", data.model()); - assertEquals(500.0, data.inputTokens()); - assertEquals(200.0, data.outputTokens()); - // quotaSnapshots is null when absent in JSON (generated class uses nullable - // fields) + assertEquals((Long) 500L, data.inputTokens()); + assertEquals((Long) 200L, data.outputTokens()); assertNull(data.quotaSnapshots()); } @@ -1990,14 +1985,14 @@ void testAbortEventAllFields() throws Exception { { "type": "abort", "data": { - "reason": "user_cancelled" + "reason": "user_abort" } } """; var event = (AbortEvent) parseJson(json); assertNotNull(event); - assertEquals("user_cancelled", event.getData().reason()); + assertEquals(AbortReason.USER_ABORT, event.getData().reason()); } @Test @@ -2149,9 +2144,8 @@ void testParseJsonNodeSessionShutdownWithCodeChanges() throws Exception { var event = (SessionShutdownEvent) parseJson(json); assertNotNull(event); - assertEquals(SessionShutdownEvent.SessionShutdownEventData.SessionShutdownEventDataShutdownType.ROUTINE, - event.getData().shutdownType()); - assertEquals(100.0, event.getData().codeChanges().linesAdded()); + assertEquals(ShutdownType.ROUTINE, event.getData().shutdownType()); + assertEquals((Long) 100L, event.getData().codeChanges().linesAdded()); assertEquals(1, event.getData().codeChanges().filesModified().size()); } @@ -2279,9 +2273,10 @@ void testParsePermissionCompletedEvent() throws Exception { assertNotNull(event); assertEquals("permission.completed", event.getType()); assertEquals("perm-req-456", event.getData().requestId()); - assertEquals( - PermissionCompletedEvent.PermissionCompletedEventData.PermissionCompletedEventDataResult.PermissionCompletedEventDataResultKind.APPROVED, - event.getData().result().kind()); + assertNotNull(event.getData().result()); + @SuppressWarnings("unchecked") + var result = (java.util.Map) event.getData().result(); + assertEquals("approved", result.get("kind")); } @Test @@ -2329,8 +2324,8 @@ void testParseExitPlanModeRequestedEvent() throws Exception { "requestId": "plan-req-001", "summary": "Plan is ready", "planContent": "## Plan\\n1. Do thing", - "actions": ["approve", "edit", "reject"], - "recommendedAction": "approve" + "actions": ["exit_only", "interactive", "autopilot"], + "recommendedAction": "interactive" } } """; @@ -2341,7 +2336,7 @@ void testParseExitPlanModeRequestedEvent() throws Exception { assertEquals("plan-req-001", event.getData().requestId()); assertEquals("Plan is ready", event.getData().summary()); assertEquals(3, event.getData().actions().size()); - assertEquals("approve", event.getData().recommendedAction()); + assertEquals(ExitPlanModeAction.INTERACTIVE, event.getData().recommendedAction()); } @Test @@ -2404,8 +2399,7 @@ void testParseCapabilitiesChangedEvent() throws Exception { assertTrue(castedEvent.getData().ui().elicitation()); // Verify setData round-trip - var newData = new CapabilitiesChangedEvent.CapabilitiesChangedEventData( - new CapabilitiesChangedEvent.CapabilitiesChangedEventData.CapabilitiesChangedEventDataUi(false)); + var newData = new CapabilitiesChangedEvent.CapabilitiesChangedEventData(new CapabilitiesChangedUI(false)); castedEvent.setData(newData); assertFalse(castedEvent.getData().ui().elicitation()); } @@ -2475,8 +2469,7 @@ void testParseElicitationRequestedEvent() throws Exception { assertEquals("tc-123", castedEvent.getData().toolCallId()); assertEquals("mcp_tool", castedEvent.getData().elicitationSource()); assertEquals("Please provide your name", castedEvent.getData().message()); - assertEquals(ElicitationRequestedEvent.ElicitationRequestedEventData.ElicitationRequestedEventDataMode.FORM, - castedEvent.getData().mode()); + assertEquals(ElicitationRequestedMode.FORM, castedEvent.getData().mode()); assertNotNull(castedEvent.getData().requestedSchema()); assertEquals("object", castedEvent.getData().requestedSchema().type()); assertNotNull(castedEvent.getData().requestedSchema().properties()); @@ -2484,13 +2477,10 @@ void testParseElicitationRequestedEvent() throws Exception { assertTrue(castedEvent.getData().requestedSchema().required().contains("name")); // Verify setData round-trip - castedEvent.setData( - new ElicitationRequestedEvent.ElicitationRequestedEventData("elix-002", null, null, "Enter URL", - ElicitationRequestedEvent.ElicitationRequestedEventData.ElicitationRequestedEventDataMode.URL, - null, "https://example.com")); + castedEvent.setData(new ElicitationRequestedEvent.ElicitationRequestedEventData("elix-002", null, null, + "Enter URL", ElicitationRequestedMode.URL, null, "https://example.com")); assertEquals("elix-002", castedEvent.getData().requestId()); - assertEquals(ElicitationRequestedEvent.ElicitationRequestedEventData.ElicitationRequestedEventDataMode.URL, - castedEvent.getData().mode()); + assertEquals(ElicitationRequestedMode.URL, castedEvent.getData().mode()); } @Test diff --git a/src/test/java/com/github/copilot/sdk/SessionEventHandlingTest.java b/src/test/java/com/github/copilot/sdk/SessionEventHandlingTest.java index 73ed6fffa3..94f2c3dc76 100644 --- a/src/test/java/com/github/copilot/sdk/SessionEventHandlingTest.java +++ b/src/test/java/com/github/copilot/sdk/SessionEventHandlingTest.java @@ -180,7 +180,7 @@ void testHandlerReceivesCorrectEventData() { SessionStartEvent startEvent = createSessionStartEvent(); startEvent.setData(new SessionStartEvent.SessionStartEventData("my-session-123", null, null, null, null, null, - null, null, null, null)); + null, null, null, null, null, null)); dispatchEvent(startEvent); AssistantMessageEvent msgEvent = createAssistantMessageEvent("Test content"); @@ -857,15 +857,15 @@ private SessionStartEvent createSessionStartEvent() { private SessionStartEvent createSessionStartEvent(String sessionId) { var event = new SessionStartEvent(); var data = new SessionStartEvent.SessionStartEventData(sessionId, null, null, null, null, null, null, null, - null, null); + null, null, null, null); event.setData(data); return event; } private AssistantMessageEvent createAssistantMessageEvent(String content) { var event = new AssistantMessageEvent(); - var data = new AssistantMessageEvent.AssistantMessageEventData(null, content, null, null, null, null, null, - null, null, null, null); + var data = new AssistantMessageEvent.AssistantMessageEventData(null, null, content, null, null, null, null, + null, null, null, null, null, null, null, null); event.setData(data); return event; } diff --git a/src/test/java/com/github/copilot/sdk/SessionHandlerTest.java b/src/test/java/com/github/copilot/sdk/SessionHandlerTest.java index 068ae630a1..5a8dc3fcbe 100644 --- a/src/test/java/com/github/copilot/sdk/SessionHandlerTest.java +++ b/src/test/java/com/github/copilot/sdk/SessionHandlerTest.java @@ -66,7 +66,7 @@ void testHandlePermissionRequestWithNoHandlerReturnsDenied() throws Exception { PermissionRequestResult result = session.handlePermissionRequest(data).get(); - assertEquals("denied-no-approval-rule-and-could-not-request-from-user", result.getKind()); + assertEquals("user-not-available", result.getKind()); } // ===== handlePermissionRequest: handler throws ===== @@ -81,7 +81,7 @@ void testHandlePermissionRequestHandlerExceptionReturnsDenied() throws Exception PermissionRequestResult result = session.handlePermissionRequest(data).get(); - assertEquals("denied-no-approval-rule-and-could-not-request-from-user", result.getKind()); + assertEquals("user-not-available", result.getKind()); } // ===== handlePermissionRequest: handler future fails ===== @@ -95,7 +95,7 @@ void testHandlePermissionRequestHandlerFutureFailsReturnsDenied() throws Excepti PermissionRequestResult result = session.handlePermissionRequest(data).get(); - assertEquals("denied-no-approval-rule-and-could-not-request-from-user", result.getKind()); + assertEquals("user-not-available", result.getKind()); } // ===== handlePermissionRequest: handler succeeds ===== @@ -262,6 +262,54 @@ void testHandleHooksInvokeSessionEnd() throws Exception { assertEquals("summary", output.sessionSummary()); } + // ===== handleHooksInvoke: sessionId deserialization on hook inputs ===== + + @Test + void testHookInputSessionIdDeserializedForSessionStart() throws Exception { + var hooks = new SessionHooks().setOnSessionStart((hookInput, invocation) -> { + assertEquals("runtime-session-123", hookInput.sessionId()); + assertEquals(1735689600L, hookInput.timestamp()); + assertEquals("/tmp", hookInput.cwd()); + return CompletableFuture.completedFuture(new SessionStartHookOutput(null, null)); + }); + session.registerHooks(hooks); + + JsonNode input = MAPPER.valueToTree( + Map.of("sessionId", "runtime-session-123", "timestamp", 1735689600L, "cwd", "/tmp", "source", "new")); + + session.handleHooksInvoke("sessionStart", input).get(); + } + + @Test + void testHookInputSessionIdDeserializedForSessionEnd() throws Exception { + var hooks = new SessionHooks().setOnSessionEnd((hookInput, invocation) -> { + assertEquals("runtime-session-456", hookInput.sessionId()); + assertEquals("user_closed", hookInput.reason()); + return CompletableFuture.completedFuture(new SessionEndHookOutput(false, null, null)); + }); + session.registerHooks(hooks); + + JsonNode input = MAPPER.valueToTree(Map.of("sessionId", "runtime-session-456", "timestamp", 1735689600L, "cwd", + "/tmp", "reason", "user_closed")); + + session.handleHooksInvoke("sessionEnd", input).get(); + } + + @Test + void testHookInputSessionIdDeserializedForUserPromptSubmitted() throws Exception { + var hooks = new SessionHooks().setOnUserPromptSubmitted((hookInput, invocation) -> { + assertEquals("runtime-session-789", hookInput.sessionId()); + assertEquals("hello", hookInput.prompt()); + return CompletableFuture.completedFuture(new UserPromptSubmittedHookOutput(null, null, null)); + }); + session.registerHooks(hooks); + + JsonNode input = MAPPER.valueToTree( + Map.of("sessionId", "runtime-session-789", "timestamp", 1735689600L, "cwd", "/tmp", "prompt", "hello")); + + session.handleHooksInvoke("userPromptSubmitted", input).get(); + } + // ===== handleHooksInvoke: unhandled hook type ===== @Test diff --git a/src/test/java/com/github/copilot/sdk/SessionRequestBuilderTest.java b/src/test/java/com/github/copilot/sdk/SessionRequestBuilderTest.java index 75457583e4..5c8f008382 100644 --- a/src/test/java/com/github/copilot/sdk/SessionRequestBuilderTest.java +++ b/src/test/java/com/github/copilot/sdk/SessionRequestBuilderTest.java @@ -12,10 +12,15 @@ import org.junit.jupiter.api.Test; +import com.github.copilot.sdk.json.AutoModeSwitchResponse; +import com.github.copilot.sdk.json.CloudSessionOptions; +import com.github.copilot.sdk.json.CloudSessionRepository; import com.github.copilot.sdk.json.CreateSessionRequest; +import com.github.copilot.sdk.json.DefaultAgentConfig; import com.github.copilot.sdk.json.ElicitationHandler; import com.github.copilot.sdk.json.ElicitationResult; import com.github.copilot.sdk.json.ElicitationResultAction; +import com.github.copilot.sdk.json.ExitPlanModeResult; import com.github.copilot.sdk.json.ResumeSessionConfig; import com.github.copilot.sdk.json.ResumeSessionRequest; import com.github.copilot.sdk.json.SessionConfig; @@ -85,6 +90,20 @@ void testBuildCreateRequestSetsClientName() { assertEquals("my-app", request.getClientName()); } + @Test + void testBuildCreateRequestForwardsEnableSessionTelemetryWhenFalse() { + var config = new SessionConfig().setEnableSessionTelemetry(false); + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + assertFalse(request.getEnableSessionTelemetry()); + } + + @Test + void testBuildCreateRequestOmitsEnableSessionTelemetryWhenNotSet() { + var config = new SessionConfig(); + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + assertNull(request.getEnableSessionTelemetry()); + } + // ========================================================================= // buildResumeRequest // ========================================================================= @@ -98,6 +117,20 @@ void testBuildResumeRequestNullConfig() { assertEquals("direct", request.getEnvValueMode(), "envValueMode should be 'direct' even for null config"); } + @Test + void testBuildResumeRequestForwardsEnableSessionTelemetryWhenFalse() { + var config = new ResumeSessionConfig().setEnableSessionTelemetry(false); + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-1", config); + assertFalse(request.getEnableSessionTelemetry()); + } + + @Test + void testBuildResumeRequestOmitsEnableSessionTelemetryWhenNotSet() { + var config = new ResumeSessionConfig(); + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-1", config); + assertNull(request.getEnableSessionTelemetry()); + } + @Test void testBuildResumeRequestWithTools() { var tool = ToolDefinition.create("my_tool", "A tool", Map.of("type", "object"), @@ -400,4 +433,278 @@ void configureResumedSessionWithOnEvent_registersEventHandler() { // Covers ResumeSessionConfig.getOnEvent() != null branch (L277-278) SessionRequestBuilder.configureSession(session, config); } + + @Test + void testBuildCreateRequestWithDefaultAgent() { + var defaultAgent = new DefaultAgentConfig().setExcludedTools(List.of("secret_tool")); + var config = new SessionConfig().setDefaultAgent(defaultAgent); + + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + + assertNotNull(request.getDefaultAgent()); + assertEquals(List.of("secret_tool"), request.getDefaultAgent().getExcludedTools()); + } + + @Test + void testBuildCreateRequestWithGitHubToken() { + var config = new SessionConfig().setGitHubToken("ghp_per_session_token"); + + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + + assertEquals("ghp_per_session_token", request.getGitHubToken()); + } + + @Test + void testBuildResumeRequestWithDefaultAgent() { + var defaultAgent = new DefaultAgentConfig().setExcludedTools(List.of("secret_tool")); + var config = new ResumeSessionConfig().setDefaultAgent(defaultAgent); + + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("test-session", config); + + assertNotNull(request.getDefaultAgent()); + assertEquals(List.of("secret_tool"), request.getDefaultAgent().getExcludedTools()); + } + + @Test + void testBuildResumeRequestWithGitHubToken() { + var config = new ResumeSessionConfig().setGitHubToken("ghp_per_session_token"); + + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("test-session", config); + + assertEquals("ghp_per_session_token", request.getGitHubToken()); + } + + // ========================================================================= + // instructionDirectories propagation + // ========================================================================= + + @Test + void testBuildCreateRequestPropagatesInstructionDirectories() { + var dirs = List.of("/path/to/instructions", "/another/path"); + var config = new SessionConfig().setInstructionDirectories(dirs); + + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + + assertEquals(dirs, request.getInstructionDirectories()); + } + + @Test + void testBuildResumeRequestPropagatesInstructionDirectories() { + var dirs = List.of("/resume/instructions", "/other/dir"); + var config = new ResumeSessionConfig().setInstructionDirectories(dirs); + + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-inst", config); + + assertEquals(dirs, request.getInstructionDirectories()); + } + + // ========================================================================= + // enableSessionTelemetry serialization + // ========================================================================= + + @Test + void testCreateRequestSerializesEnableSessionTelemetryWhenFalse() throws Exception { + var config = new SessionConfig().setEnableSessionTelemetry(false); + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + var mapper = JsonRpcClient.getObjectMapper(); + var json = mapper.writeValueAsString(request); + assertTrue(json.contains("\"enableSessionTelemetry\":false"), + "enableSessionTelemetry should be serialized when set to false"); + } + + @Test + void testCreateRequestOmitsEnableSessionTelemetryWhenNull() throws Exception { + var config = new SessionConfig(); + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + var mapper = JsonRpcClient.getObjectMapper(); + var json = mapper.writeValueAsString(request); + assertFalse(json.contains("enableSessionTelemetry"), "enableSessionTelemetry should be omitted when null"); + } + + @Test + void testResumeRequestSerializesEnableSessionTelemetryWhenFalse() throws Exception { + var config = new ResumeSessionConfig().setEnableSessionTelemetry(false); + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-tel", config); + var mapper = JsonRpcClient.getObjectMapper(); + var json = mapper.writeValueAsString(request); + assertTrue(json.contains("\"enableSessionTelemetry\":false"), + "enableSessionTelemetry should be serialized when set to false"); + } + + @Test + void testResumeRequestOmitsEnableSessionTelemetryWhenNull() throws Exception { + var config = new ResumeSessionConfig(); + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-tel", config); + var mapper = JsonRpcClient.getObjectMapper(); + var json = mapper.writeValueAsString(request); + assertFalse(json.contains("enableSessionTelemetry"), "enableSessionTelemetry should be omitted when null"); + } + + // ========================================================================= + // Mode handler request flags + // ========================================================================= + + @Test + void testBuildCreateRequestWithExitPlanModeHandler() { + var config = new SessionConfig().setOnExitPlanMode( + (request, invocation) -> CompletableFuture.completedFuture(new ExitPlanModeResult())); + + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + + assertTrue(request.getRequestExitPlanMode()); + } + + @Test + void testBuildCreateRequestWithAutoModeSwitchHandler() { + var config = new SessionConfig().setOnAutoModeSwitch( + (request, invocation) -> CompletableFuture.completedFuture(AutoModeSwitchResponse.NO)); + + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + + assertTrue(request.getRequestAutoModeSwitch()); + } + + @Test + void testBuildCreateRequestWithoutModeHandlers() { + var config = new SessionConfig(); + + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + + assertNull(request.getRequestExitPlanMode()); + assertNull(request.getRequestAutoModeSwitch()); + } + + @Test + void testBuildResumeRequestWithExitPlanModeHandler() { + var config = new ResumeSessionConfig().setOnExitPlanMode( + (request, invocation) -> CompletableFuture.completedFuture(new ExitPlanModeResult())); + + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("session-1", config); + + assertTrue(request.getRequestExitPlanMode()); + } + + @Test + void testBuildResumeRequestWithAutoModeSwitchHandler() { + var config = new ResumeSessionConfig().setOnAutoModeSwitch( + (request, invocation) -> CompletableFuture.completedFuture(AutoModeSwitchResponse.NO)); + + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("session-1", config); + + assertTrue(request.getRequestAutoModeSwitch()); + } + + @Test + void configureSessionWithExitPlanModeHandler_registersHandler() { + CopilotSession session = new CopilotSession("session-1", null); + + var config = new SessionConfig().setOnExitPlanMode( + (request, invocation) -> CompletableFuture.completedFuture(new ExitPlanModeResult())); + + SessionRequestBuilder.configureSession(session, config); + } + + @Test + void configureSessionWithAutoModeSwitchHandler_registersHandler() { + CopilotSession session = new CopilotSession("session-1", null); + + var config = new SessionConfig().setOnAutoModeSwitch( + (request, invocation) -> CompletableFuture.completedFuture(AutoModeSwitchResponse.NO)); + + SessionRequestBuilder.configureSession(session, config); + } + + @Test + void configureResumedSessionWithExitPlanModeHandler_registersHandler() { + CopilotSession session = new CopilotSession("session-1", null); + + var config = new ResumeSessionConfig().setOnExitPlanMode( + (request, invocation) -> CompletableFuture.completedFuture(new ExitPlanModeResult())); + + SessionRequestBuilder.configureSession(session, config); + } + + @Test + void configureResumedSessionWithAutoModeSwitchHandler_registersHandler() { + CopilotSession session = new CopilotSession("session-1", null); + + var config = new ResumeSessionConfig().setOnAutoModeSwitch( + (request, invocation) -> CompletableFuture.completedFuture(AutoModeSwitchResponse.NO)); + + SessionRequestBuilder.configureSession(session, config); + } + + @Test + void testCreateRequestSerializesModeFlags() throws Exception { + var config = new SessionConfig() + .setOnExitPlanMode((r, i) -> CompletableFuture.completedFuture(new ExitPlanModeResult())) + .setOnAutoModeSwitch((r, i) -> CompletableFuture.completedFuture(AutoModeSwitchResponse.NO)); + + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + var mapper = JsonRpcClient.getObjectMapper(); + var json = mapper.writeValueAsString(request); + + assertTrue(json.contains("\"requestExitPlanMode\":true")); + assertTrue(json.contains("\"requestAutoModeSwitch\":true")); + } + + @Test + void testResumeRequestSerializesModeFlags() throws Exception { + var config = new ResumeSessionConfig() + .setOnExitPlanMode((r, i) -> CompletableFuture.completedFuture(new ExitPlanModeResult())) + .setOnAutoModeSwitch((r, i) -> CompletableFuture.completedFuture(AutoModeSwitchResponse.NO)); + + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("session-1", config); + var mapper = JsonRpcClient.getObjectMapper(); + var json = mapper.writeValueAsString(request); + + assertTrue(json.contains("\"requestExitPlanMode\":true")); + assertTrue(json.contains("\"requestAutoModeSwitch\":true")); + } + + // ========================================================================= + // Cloud session options wiring + // ========================================================================= + + @Test + void testBuildCreateRequestPropagatesCloudSessionOptions() throws Exception { + var cloud = new CloudSessionOptions() + .setRepository(new CloudSessionRepository().setOwner("my-org").setName("my-repo").setBranch("main")); + var config = new SessionConfig().setCloud(cloud); + + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + + assertNotNull(request.getCloud()); + assertEquals("my-org", request.getCloud().getRepository().getOwner()); + assertEquals("my-repo", request.getCloud().getRepository().getName()); + assertEquals("main", request.getCloud().getRepository().getBranch()); + } + + @Test + void testBuildCreateRequestOmitsCloudWhenNull() throws Exception { + var config = new SessionConfig(); + + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + var mapper = JsonRpcClient.getObjectMapper(); + var json = mapper.writeValueAsString(request); + + assertNull(request.getCloud()); + assertFalse(json.contains("\"cloud\""), "cloud should be omitted when null"); + } + + @Test + void testCloudSessionOptionsSerializesCorrectly() throws Exception { + var cloud = new CloudSessionOptions() + .setRepository(new CloudSessionRepository().setOwner("acme").setName("widgets").setBranch("feature-1")); + var config = new SessionConfig().setCloud(cloud); + + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + var mapper = JsonRpcClient.getObjectMapper(); + var json = mapper.writeValueAsString(request); + + assertTrue(json.contains("\"cloud\"")); + assertTrue(json.contains("\"owner\":\"acme\"")); + assertTrue(json.contains("\"name\":\"widgets\"")); + assertTrue(json.contains("\"branch\":\"feature-1\"")); + } } diff --git a/src/test/java/com/github/copilot/sdk/StreamingFidelityTest.java b/src/test/java/com/github/copilot/sdk/StreamingFidelityTest.java index f3f5976523..d3df63eb06 100644 --- a/src/test/java/com/github/copilot/sdk/StreamingFidelityTest.java +++ b/src/test/java/com/github/copilot/sdk/StreamingFidelityTest.java @@ -14,6 +14,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import com.github.copilot.sdk.generated.SessionEvent; @@ -139,6 +140,7 @@ void testShouldNotProduceDeltasWhenStreamingIsDisabled() throws Exception { * @see Snapshot: streaming_fidelity/should_produce_deltas_after_session_resume */ @Test + @Tag("isolated-resume") void testShouldProduceDeltasAfterSessionResume() throws Exception { ctx.configureForTest("streaming_fidelity", "should_produce_deltas_after_session_resume"); @@ -182,4 +184,98 @@ void testShouldProduceDeltasAfterSessionResume() throws Exception { } } } + + /** + * Verifies that no delta events are produced after resuming a session with + * streaming disabled (even though it was originally created with streaming + * enabled). + * + * @see Snapshot: + * streaming_fidelity/should_not_produce_deltas_after_session_resume_with_streaming_disabled + */ + @Test + @Tag("isolated-resume") + void testShouldNotProduceDeltasAfterSessionResumeWithStreamingDisabled() throws Exception { + ctx.configureForTest("streaming_fidelity", + "should_not_produce_deltas_after_session_resume_with_streaming_disabled"); + + try (CopilotClient client = ctx.createClient()) { + // Create a streaming session and send an initial message + CopilotSession session = client.createSession( + new SessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL).setStreaming(true)).get(); + session.sendAndWait(new MessageOptions().setPrompt("What is 3 + 6?")).get(60, TimeUnit.SECONDS); + String sessionId = session.getSessionId(); + session.close(); + + // Resume using a new client with streaming DISABLED + try (CopilotClient newClient = ctx.createClient()) { + CopilotSession session2 = newClient.resumeSession(sessionId, new ResumeSessionConfig() + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL).setStreaming(false)).get(); + + List events = new ArrayList<>(); + session2.on(events::add); + + AssistantMessageEvent answer = session2 + .sendAndWait(new MessageOptions().setPrompt("Now if you double that, what do you get?")) + .get(60, TimeUnit.SECONDS); + assertNotNull(answer); + assertTrue(answer.getData().content().contains("18"), + "Follow-up response should contain 18: " + answer.getData().content()); + + // No deltas when streaming is toggled off + List deltaEvents = events.stream() + .filter(e -> e instanceof AssistantMessageDeltaEvent).map(e -> (AssistantMessageDeltaEvent) e) + .toList(); + assertTrue(deltaEvents.isEmpty(), + "Should not receive delta events when streaming is disabled on resume"); + + // But should still have a final assistant.message + List assistantEvents = events.stream() + .filter(e -> e instanceof AssistantMessageEvent).map(e -> (AssistantMessageEvent) e).toList(); + assertFalse(assistantEvents.isEmpty(), + "Should still have a final assistant.message when streaming is disabled"); + + session2.close(); + } + } + } + + /** + * Verifies that setting reasoningEffort alongside streaming=true does not break + * the streaming pipeline β€” deltas still arrive and complete successfully. + * + * @see Snapshot: + * streaming_fidelity/should_emit_streaming_deltas_with_reasoning_effort_configured + */ + @Test + void testShouldEmitStreamingDeltasWithReasoningEffortConfigured() throws Exception { + ctx.configureForTest("streaming_fidelity", "should_emit_streaming_deltas_with_reasoning_effort_configured"); + + try (CopilotClient client = ctx.createClient()) { + CopilotSession session = client + .createSession(new SessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL) + .setStreaming(true).setReasoningEffort("high")) + .get(); + + List events = new ArrayList<>(); + session.on(events::add); + + session.sendAndWait(new MessageOptions().setPrompt("What is 15 * 17?")).get(60, TimeUnit.SECONDS); + + // With streaming + reasoning effort, we should still get content deltas + List deltaEvents = events.stream() + .filter(e -> e instanceof AssistantMessageDeltaEvent).map(e -> (AssistantMessageDeltaEvent) e) + .toList(); + assertFalse(deltaEvents.isEmpty(), "Should have received delta events with reasoning effort configured"); + + // And a final assistant.message with the answer + List assistantEvents = events.stream() + .filter(e -> e instanceof AssistantMessageEvent).map(e -> (AssistantMessageEvent) e).toList(); + assertFalse(assistantEvents.isEmpty(), "Should have received assistant message events"); + assertTrue(assistantEvents.get(assistantEvents.size() - 1).getData().content().contains("255"), + "Response should contain 255"); + + session.close(); + } + } } diff --git a/src/test/java/com/github/copilot/sdk/TelemetryConfigTest.java b/src/test/java/com/github/copilot/sdk/TelemetryConfigTest.java index 99b360d2db..278777ce13 100644 --- a/src/test/java/com/github/copilot/sdk/TelemetryConfigTest.java +++ b/src/test/java/com/github/copilot/sdk/TelemetryConfigTest.java @@ -22,7 +22,7 @@ void defaultValuesAreNull() { assertNull(config.getFilePath()); assertNull(config.getExporterType()); assertNull(config.getSourceName()); - assertNull(config.getCaptureContent()); + assertTrue(config.getCaptureContent().isEmpty()); } @Test @@ -57,10 +57,10 @@ void sourceNameGetterSetter() { void captureContentGetterSetter() { var config = new TelemetryConfig(); config.setCaptureContent(true); - assertTrue(config.getCaptureContent()); + assertTrue(config.getCaptureContent().get()); config.setCaptureContent(false); - assertFalse(config.getCaptureContent()); + assertFalse(config.getCaptureContent().get()); } @Test @@ -72,6 +72,6 @@ void fluentChainingReturnsThis() { assertEquals("/tmp/spans.json", config.getFilePath()); assertEquals("file", config.getExporterType()); assertEquals("sdk-test", config.getSourceName()); - assertTrue(config.getCaptureContent()); + assertTrue(config.getCaptureContent().get()); } } diff --git a/src/test/java/com/github/copilot/sdk/TestUtil.java b/src/test/java/com/github/copilot/sdk/TestUtil.java index d9462af87f..af44745901 100644 --- a/src/test/java/com/github/copilot/sdk/TestUtil.java +++ b/src/test/java/com/github/copilot/sdk/TestUtil.java @@ -36,9 +36,9 @@ public static String tempPath(String filename) { *

* Resolution order: *

    - *
  1. Search the system PATH using {@code where.exe} (Windows) or {@code which} - * (Linux/macOS).
  2. - *
  3. Fall back to the {@code COPILOT_CLI_PATH} environment variable.
  4. + *
  5. Use the {@code COPILOT_CLI_PATH} environment variable when set.
  6. + *
  7. Otherwise search the system PATH using {@code where.exe} (Windows) or + * {@code which} (Linux/macOS).
  8. *
  9. Walk parent directories looking for * {@code nodejs/node_modules/@github/copilot/index.js}.
  10. *
@@ -55,16 +55,16 @@ public static String tempPath(String filename) { * {@code null} if none was found */ static String findCliPath() { - String copilotInPath = findCopilotInPath(); - if (copilotInPath != null) { - return copilotInPath; - } - String envPath = System.getenv("COPILOT_CLI_PATH"); if (envPath != null && !envPath.isEmpty()) { return envPath; } + String copilotInPath = findCopilotInPath(); + if (copilotInPath != null) { + return copilotInPath; + } + Path current = Paths.get(System.getProperty("user.dir")); while (current != null) { Path cliPath = current.resolve("nodejs/node_modules/@github/copilot/index.js"); diff --git a/src/test/java/com/github/copilot/sdk/ToolResultsTest.java b/src/test/java/com/github/copilot/sdk/ToolResultsTest.java new file mode 100644 index 0000000000..31f9d1b07d --- /dev/null +++ b/src/test/java/com/github/copilot/sdk/ToolResultsTest.java @@ -0,0 +1,148 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk; + +import static org.junit.jupiter.api.Assertions.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.TimeUnit; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import com.github.copilot.sdk.generated.SessionEvent; +import com.github.copilot.sdk.generated.ToolExecutionCompleteEvent; +import com.github.copilot.sdk.json.MessageOptions; +import com.github.copilot.sdk.json.PermissionHandler; +import com.github.copilot.sdk.json.SessionConfig; +import com.github.copilot.sdk.json.ToolDefinition; +import com.github.copilot.sdk.json.ToolResultObject; + +/** + * E2E tests for tool result types β€” verifying that rejected and denied result + * types are handled correctly by the runtime. + * + *

+ * Snapshots are stored in {@code test/snapshots/tool_results/}. + *

+ */ +public class ToolResultsTest { + + private static E2ETestContext ctx; + + @BeforeAll + static void setup() throws Exception { + ctx = E2ETestContext.create(); + } + + @AfterAll + static void teardown() throws Exception { + if (ctx != null) { + ctx.close(); + } + } + + /** + * Verifies that a tool returning a "rejected" resultType is reported as a + * failed tool execution with the correct error code. + * + * @see Snapshot: + * tool_results/should_handle_tool_result_with_rejected_resulttype + */ + @Test + void testShouldHandleToolResultWithRejectedResultType() throws Exception { + ctx.configureForTest("tool_results", "should_handle_tool_result_with_rejected_resulttype"); + + var toolHandlerCalled = new boolean[]{false}; + + Map params = Map.of("type", "object", "properties", Map.of(), "required", List.of()); + + ToolDefinition deployTool = ToolDefinition.create("deploy_service", "Deploys a service", params, + (invocation) -> { + toolHandlerCalled[0] = true; + return CompletableFuture.completedFuture(new ToolResultObject("rejected", + "Deployment rejected: policy violation - production deployments require approval", null, + null, null, null)); + }); + + try (CopilotClient client = ctx.createClient()) { + CopilotSession session = client.createSession(new SessionConfig().setTools(List.of(deployTool)) + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get(); + + List events = new ArrayList<>(); + session.on(events::add); + + session.sendAndWait(new MessageOptions().setPrompt( + "Deploy the service using deploy_service. If it's rejected, tell me it was 'rejected by policy'.")) + .get(60, TimeUnit.SECONDS); + + assertTrue(toolHandlerCalled[0], "Tool handler should have been called"); + + List toolEvents = events.stream() + .filter(e -> e instanceof ToolExecutionCompleteEvent).map(e -> (ToolExecutionCompleteEvent) e) + .toList(); + assertFalse(toolEvents.isEmpty(), "Should have a tool.execution_complete event"); + + ToolExecutionCompleteEvent toolEvt = toolEvents.get(0); + assertFalse(toolEvt.getData().success(), "Tool execution should not be marked as successful"); + assertNotNull(toolEvt.getData().error(), "Should have error details"); + assertEquals("rejected", toolEvt.getData().error().code(), "Error code should be 'rejected'"); + + session.close(); + } + } + + /** + * Verifies that a tool returning a "denied" resultType is reported as a failed + * tool execution with the correct error code. + * + * @see Snapshot: tool_results/should_handle_tool_result_with_denied_resulttype + */ + @Test + void testShouldHandleToolResultWithDeniedResultType() throws Exception { + ctx.configureForTest("tool_results", "should_handle_tool_result_with_denied_resulttype"); + + var toolHandlerCalled = new boolean[]{false}; + + Map params = Map.of("type", "object", "properties", Map.of(), "required", List.of()); + + ToolDefinition accessTool = ToolDefinition.create("access_secret", "Accesses a secret", params, + (invocation) -> { + toolHandlerCalled[0] = true; + return CompletableFuture.completedFuture(new ToolResultObject("denied", + "Access denied: insufficient permissions to read secrets", null, null, null, null)); + }); + + try (CopilotClient client = ctx.createClient()) { + CopilotSession session = client.createSession(new SessionConfig().setTools(List.of(accessTool)) + .setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get(); + + List events = new ArrayList<>(); + session.on(events::add); + + session.sendAndWait(new MessageOptions().setPrompt( + "Use access_secret to get the API key. If access is denied, tell me it was 'access denied'.")) + .get(60, TimeUnit.SECONDS); + + assertTrue(toolHandlerCalled[0], "Tool handler should have been called"); + + List toolEvents = events.stream() + .filter(e -> e instanceof ToolExecutionCompleteEvent).map(e -> (ToolExecutionCompleteEvent) e) + .toList(); + assertFalse(toolEvents.isEmpty(), "Should have a tool.execution_complete event"); + + ToolExecutionCompleteEvent toolEvt = toolEvents.get(0); + assertFalse(toolEvt.getData().success(), "Tool execution should not be marked as successful"); + assertNotNull(toolEvt.getData().error(), "Should have error details"); + assertEquals("denied", toolEvt.getData().error().code(), "Error code should be 'denied'"); + + session.close(); + } + } +} diff --git a/src/test/java/com/github/copilot/sdk/ToolsTest.java b/src/test/java/com/github/copilot/sdk/ToolsTest.java index 1c4eaaf581..6cd0c99bd3 100644 --- a/src/test/java/com/github/copilot/sdk/ToolsTest.java +++ b/src/test/java/com/github/copilot/sdk/ToolsTest.java @@ -25,6 +25,7 @@ import com.github.copilot.sdk.json.PermissionHandler; import com.github.copilot.sdk.json.PermissionRequest; import com.github.copilot.sdk.json.PermissionRequestResult; +import com.github.copilot.sdk.json.PermissionRequestResultKind; import com.github.copilot.sdk.json.SessionConfig; import com.github.copilot.sdk.json.ToolDefinition; @@ -305,10 +306,9 @@ void testDeniesCustomToolWhenPermissionDenied(TestInfo testInfo) throws Exceptio try (CopilotClient client = ctx.createClient()) { CopilotSession session = client - .createSession( - new SessionConfig().setTools(List.of(encryptTool)) - .setOnPermissionRequest((request, invocation) -> CompletableFuture.completedFuture( - new PermissionRequestResult().setKind("denied-interactively-by-user")))) + .createSession(new SessionConfig().setTools(List.of(encryptTool)) + .setOnPermissionRequest((request, invocation) -> CompletableFuture.completedFuture( + new PermissionRequestResult().setKind(PermissionRequestResultKind.REJECTED)))) .get(); session.sendAndWait(new MessageOptions().setPrompt("Use encrypt_string to encrypt this string: Hello")) @@ -360,4 +360,109 @@ void testOverridesBuiltInToolWithCustomTool() throws Exception { session.close(); } } + + /** + * Verifies that the model can call multiple custom tools in parallel within a + * single turn. + * + * @see Snapshot: + * tools/should_execute_multiple_custom_tools_in_parallel_single_turn + */ + @Test + void testShouldExecuteMultipleCustomToolsInParallelSingleTurn() throws Exception { + ctx.configureForTest("tools", "should_execute_multiple_custom_tools_in_parallel_single_turn"); + + var toolACalled = new CompletableFuture(); + var toolBCalled = new CompletableFuture(); + + Map cityParams = Map.of("type", "object", "properties", + Map.of("city", Map.of("type", "string", "description", "City name")), "required", List.of("city")); + Map countryParams = Map.of("type", "object", "properties", + Map.of("country", Map.of("type", "string", "description", "Country name")), "required", + List.of("country")); + + ToolDefinition lookupCity = ToolDefinition.create("lookup_city", "Looks up city information", cityParams, + (invocation) -> { + String city = (String) invocation.getArguments().get("city"); + toolACalled.complete(city); + return CompletableFuture.completedFuture("CITY_" + city.toUpperCase()); + }); + + ToolDefinition lookupCountry = ToolDefinition.create("lookup_country", "Looks up country information", + countryParams, (invocation) -> { + String country = (String) invocation.getArguments().get("country"); + toolBCalled.complete(country); + return CompletableFuture.completedFuture("COUNTRY_" + country.toUpperCase()); + }); + + try (CopilotClient client = ctx.createClient()) { + CopilotSession session = client.createSession(new SessionConfig() + .setTools(List.of(lookupCity, lookupCountry)).setOnPermissionRequest(PermissionHandler.APPROVE_ALL)) + .get(); + + AssistantMessageEvent response = session.sendAndWait(new MessageOptions().setPrompt( + "Use lookup_city with 'Paris' and lookup_country with 'France' at the same time, then combine both results in your reply.")) + .get(60, TimeUnit.SECONDS); + + // Both tools should have been called + assertEquals("Paris", toolACalled.get(10, TimeUnit.SECONDS)); + assertEquals("France", toolBCalled.get(10, TimeUnit.SECONDS)); + + assertNotNull(response); + String content = response.getData().content(); + assertTrue(content.contains("CITY_PARIS"), "Response should contain CITY_PARIS: " + content); + assertTrue(content.contains("COUNTRY_FRANCE"), "Response should contain COUNTRY_FRANCE: " + content); + + session.close(); + } + } + + /** + * Verifies that excludedTools are respected even when also listed in + * availableTools. + * + * @see Snapshot: tools/should_respect_availabletools_and_excludedtools_combined + */ + @Test + void testShouldRespectAvailableToolsAndExcludedToolsCombined() throws Exception { + ctx.configureForTest("tools", "should_respect_availabletools_and_excludedtools_combined"); + + var excludedToolCalled = new boolean[]{false}; + + Map inputParams = Map.of("type", "object", "properties", + Map.of("input", Map.of("type", "string", "description", "Input value")), "required", List.of("input")); + + ToolDefinition allowedTool = ToolDefinition.create("allowed_tool", "An allowed tool", inputParams, + (invocation) -> { + String input = (String) invocation.getArguments().get("input"); + return CompletableFuture.completedFuture("ALLOWED_" + input.toUpperCase()); + }); + + ToolDefinition excludedTool = ToolDefinition.create("excluded_tool", "A tool that should be excluded", + inputParams, (invocation) -> { + excludedToolCalled[0] = true; + String input = (String) invocation.getArguments().get("input"); + return CompletableFuture.completedFuture("EXCLUDED_" + input.toUpperCase()); + }); + + try (CopilotClient client = ctx.createClient()) { + CopilotSession session = client.createSession(new SessionConfig() + .setTools(List.of(allowedTool, excludedTool)) + .setAvailableTools(List.of("allowed_tool", "excluded_tool")) + .setExcludedTools(List.of("excluded_tool")).setOnPermissionRequest(PermissionHandler.APPROVE_ALL)) + .get(); + + AssistantMessageEvent response = session + .sendAndWait(new MessageOptions() + .setPrompt("Use the allowed_tool with input 'test'. Do NOT use excluded_tool.")) + .get(60, TimeUnit.SECONDS); + + assertNotNull(response); + assertTrue(response.getData().content().contains("ALLOWED_TEST"), + "Response should contain ALLOWED_TEST: " + response.getData().content()); + assertFalse(excludedToolCalled[0], "Excluded tool should not have been called"); + + session.close(); + } + } } diff --git a/src/test/java/com/github/copilot/sdk/generated/GeneratedEventTypesCoverageTest.java b/src/test/java/com/github/copilot/sdk/generated/GeneratedEventTypesCoverageTest.java index 72642cd74b..7cbaf9a0c6 100644 --- a/src/test/java/com/github/copilot/sdk/generated/GeneratedEventTypesCoverageTest.java +++ b/src/test/java/com/github/copilot/sdk/generated/GeneratedEventTypesCoverageTest.java @@ -45,7 +45,7 @@ void testParseAssistantStreamingDeltaEvent() throws Exception { assertInstanceOf(AssistantStreamingDeltaEvent.class, event); assertEquals("assistant.streaming_delta", event.getType()); var typed = (AssistantStreamingDeltaEvent) event; - assertEquals(1024.0, typed.getData().totalResponseSizeBytes()); + assertEquals((Long) 1024L, typed.getData().totalResponseSizeBytes()); } // ── CapabilitiesChangedEvent ─────────────────────────────────────────── @@ -153,8 +153,7 @@ void testParseElicitationRequestedEvent() throws Exception { var typed = (ElicitationRequestedEvent) event; assertEquals("elicit-1", typed.getData().requestId()); assertEquals("Please enter your name", typed.getData().message()); - assertEquals(ElicitationRequestedEvent.ElicitationRequestedEventData.ElicitationRequestedEventDataMode.FORM, - typed.getData().mode()); + assertEquals(ElicitationRequestedMode.FORM, typed.getData().mode()); } @Test @@ -165,8 +164,7 @@ void testParseElicitationRequestedEventUrlMode() throws Exception { """); assertInstanceOf(ElicitationRequestedEvent.class, event); var typed = (ElicitationRequestedEvent) event; - assertEquals(ElicitationRequestedEvent.ElicitationRequestedEventData.ElicitationRequestedEventDataMode.URL, - typed.getData().mode()); + assertEquals(ElicitationRequestedMode.URL, typed.getData().mode()); assertEquals("https://example.com", typed.getData().url()); } @@ -182,8 +180,7 @@ void testParseElicitationCompletedEvent() throws Exception { assertEquals("elicitation.completed", event.getType()); var typed = (ElicitationCompletedEvent) event; assertEquals("elicit-1", typed.getData().requestId()); - assertEquals(ElicitationCompletedEvent.ElicitationCompletedEventData.ElicitationCompletedEventDataAction.ACCEPT, - typed.getData().action()); + assertEquals(ElicitationCompletedAction.ACCEPT, typed.getData().action()); assertEquals("Alice", typed.getData().content().get("name")); } @@ -194,9 +191,7 @@ void testParseElicitationCompletedEventDecline() throws Exception { """); assertInstanceOf(ElicitationCompletedEvent.class, event); var typed = (ElicitationCompletedEvent) event; - assertEquals( - ElicitationCompletedEvent.ElicitationCompletedEventData.ElicitationCompletedEventDataAction.DECLINE, - typed.getData().action()); + assertEquals(ElicitationCompletedAction.DECLINE, typed.getData().action()); } @Test @@ -206,8 +201,7 @@ void testParseElicitationCompletedEventCancel() throws Exception { """); assertInstanceOf(ElicitationCompletedEvent.class, event); var typed = (ElicitationCompletedEvent) event; - assertEquals(ElicitationCompletedEvent.ElicitationCompletedEventData.ElicitationCompletedEventDataAction.CANCEL, - typed.getData().action()); + assertEquals(ElicitationCompletedAction.CANCEL, typed.getData().action()); } // ── ExitPlanModeRequestedEvent ───────────────────────────────────────── @@ -216,14 +210,14 @@ void testParseElicitationCompletedEventCancel() throws Exception { void testParseExitPlanModeRequestedEvent() throws Exception { var event = parse( """ - {"type":"exit_plan_mode.requested","data":{"requestId":"epm-1","summary":"Implement login","planContent":"# Plan\\n1. Create login","actions":["approve","edit","reject"],"recommendedAction":"approve"}} + {"type":"exit_plan_mode.requested","data":{"requestId":"epm-1","summary":"Implement login","planContent":"# Plan\\n1. Create login","actions":["exit_only","interactive","autopilot"],"recommendedAction":"interactive"}} """); assertInstanceOf(ExitPlanModeRequestedEvent.class, event); assertEquals("exit_plan_mode.requested", event.getType()); var typed = (ExitPlanModeRequestedEvent) event; assertEquals("epm-1", typed.getData().requestId()); assertEquals("Implement login", typed.getData().summary()); - assertEquals("approve", typed.getData().recommendedAction()); + assertEquals(ExitPlanModeAction.INTERACTIVE, typed.getData().recommendedAction()); assertEquals(3, typed.getData().actions().size()); } @@ -402,9 +396,7 @@ void testParseSessionContextChangedEvent() throws Exception { var typed = (SessionContextChangedEvent) event; assertEquals("/workspace", typed.getData().cwd()); assertEquals("myorg/myrepo", typed.getData().repository()); - assertEquals( - SessionContextChangedEvent.SessionContextChangedEventData.SessionContextChangedEventDataHostType.GITHUB, - typed.getData().hostType()); + assertEquals(WorkingDirectoryContextHostType.GITHUB, typed.getData().hostType()); assertEquals("main", typed.getData().branch()); } @@ -415,9 +407,7 @@ void testParseSessionContextChangedEventAdoHostType() throws Exception { """); assertInstanceOf(SessionContextChangedEvent.class, event); var typed = (SessionContextChangedEvent) event; - assertEquals( - SessionContextChangedEvent.SessionContextChangedEventData.SessionContextChangedEventDataHostType.ADO, - typed.getData().hostType()); + assertEquals(WorkingDirectoryContextHostType.ADO, typed.getData().hostType()); } // ── SessionCustomAgentsUpdatedEvent ──────────────────────────────────── @@ -474,9 +464,7 @@ void testParseSessionMcpServersLoadedEvent() throws Exception { assertNotNull(typed.getData().servers()); assertEquals(1, typed.getData().servers().size()); assertEquals("mcp1", typed.getData().servers().get(0).name()); - assertEquals( - SessionMcpServersLoadedEvent.SessionMcpServersLoadedEventData.SessionMcpServersLoadedEventDataServersItem.SessionMcpServersLoadedEventDataServersItemStatus.CONNECTED, - typed.getData().servers().get(0).status()); + assertEquals(McpServerStatus.CONNECTED, typed.getData().servers().get(0).status()); } @Test @@ -541,7 +529,7 @@ void testParseSessionSkillsLoadedEvent() throws Exception { assertEquals(1, typed.getData().skills().size()); var skill = typed.getData().skills().get(0); assertEquals("deploy", skill.name()); - assertEquals("project", skill.source()); + assertEquals(SkillSource.PROJECT, skill.source()); assertTrue(skill.userInvocable()); assertTrue(skill.enabled()); } @@ -685,56 +673,32 @@ void testParseUserInputCompletedEventFreeform() throws Exception { @Test void testElicitationRequestedEventDataModeEnumValues() { - assertEquals("form", - ElicitationRequestedEvent.ElicitationRequestedEventData.ElicitationRequestedEventDataMode.FORM - .getValue()); - assertEquals("url", - ElicitationRequestedEvent.ElicitationRequestedEventData.ElicitationRequestedEventDataMode.URL - .getValue()); + assertEquals("form", ElicitationRequestedMode.FORM.getValue()); + assertEquals("url", ElicitationRequestedMode.URL.getValue()); } @Test void testElicitationRequestedEventDataModeEnumFromValue() { - assertEquals(ElicitationRequestedEvent.ElicitationRequestedEventData.ElicitationRequestedEventDataMode.FORM, - ElicitationRequestedEvent.ElicitationRequestedEventData.ElicitationRequestedEventDataMode - .fromValue("form")); - assertThrows(IllegalArgumentException.class, - () -> ElicitationRequestedEvent.ElicitationRequestedEventData.ElicitationRequestedEventDataMode - .fromValue("unknown")); + assertEquals(ElicitationRequestedMode.FORM, ElicitationRequestedMode.fromValue("form")); + assertThrows(IllegalArgumentException.class, () -> ElicitationRequestedMode.fromValue("unknown")); } @Test void testElicitationCompletedEventActionEnumValues() { - assertEquals("accept", - ElicitationCompletedEvent.ElicitationCompletedEventData.ElicitationCompletedEventDataAction.ACCEPT - .getValue()); - assertEquals("decline", - ElicitationCompletedEvent.ElicitationCompletedEventData.ElicitationCompletedEventDataAction.DECLINE - .getValue()); - assertEquals("cancel", - ElicitationCompletedEvent.ElicitationCompletedEventData.ElicitationCompletedEventDataAction.CANCEL - .getValue()); + assertEquals("accept", ElicitationCompletedAction.ACCEPT.getValue()); + assertEquals("decline", ElicitationCompletedAction.DECLINE.getValue()); + assertEquals("cancel", ElicitationCompletedAction.CANCEL.getValue()); } @Test void testSessionContextChangedHostTypeEnumFromValue() { - assertEquals( - SessionContextChangedEvent.SessionContextChangedEventData.SessionContextChangedEventDataHostType.GITHUB, - SessionContextChangedEvent.SessionContextChangedEventData.SessionContextChangedEventDataHostType - .fromValue("github")); - assertEquals( - SessionContextChangedEvent.SessionContextChangedEventData.SessionContextChangedEventDataHostType.ADO, - SessionContextChangedEvent.SessionContextChangedEventData.SessionContextChangedEventDataHostType - .fromValue("ado")); - assertThrows(IllegalArgumentException.class, - () -> SessionContextChangedEvent.SessionContextChangedEventData.SessionContextChangedEventDataHostType - .fromValue("unknown")); + assertEquals(WorkingDirectoryContextHostType.GITHUB, WorkingDirectoryContextHostType.fromValue("github")); + assertEquals(WorkingDirectoryContextHostType.ADO, WorkingDirectoryContextHostType.fromValue("ado")); + assertThrows(IllegalArgumentException.class, () -> WorkingDirectoryContextHostType.fromValue("unknown")); } @Test void testSessionMcpServersLoadedStatusEnumFromValue() { - assertThrows(IllegalArgumentException.class, - () -> SessionMcpServersLoadedEvent.SessionMcpServersLoadedEventData.SessionMcpServersLoadedEventDataServersItem.SessionMcpServersLoadedEventDataServersItemStatus - .fromValue("unknown")); + assertThrows(IllegalArgumentException.class, () -> McpServerStatus.fromValue("unknown")); } } diff --git a/src/test/java/com/github/copilot/sdk/generated/rpc/GeneratedRpcApiCoverageTest.java b/src/test/java/com/github/copilot/sdk/generated/rpc/GeneratedRpcApiCoverageTest.java index e7f8d55d4c..e0f66bd595 100644 --- a/src/test/java/com/github/copilot/sdk/generated/rpc/GeneratedRpcApiCoverageTest.java +++ b/src/test/java/com/github/copilot/sdk/generated/rpc/GeneratedRpcApiCoverageTest.java @@ -58,7 +58,7 @@ void serverRpc_sessionFs_setProvider_invokes_correct_method() { var stub = new StubCaller(); var server = new ServerRpc(stub); - var params = new SessionFsSetProviderParams("/workspace", "/state", null); + var params = new SessionFsSetProviderParams("/workspace", "/state", null, null); server.sessionFs.setProvider(params); assertEquals(1, stub.calls.size()); @@ -71,7 +71,7 @@ void serverRpc_sessions_fork_invokes_correct_method() { var stub = new StubCaller(); var server = new ServerRpc(stub); - var params = new SessionsForkParams("parent-session-id", null); + var params = new SessionsForkParams("parent-session-id", null, null); server.sessions.fork(params); assertEquals(1, stub.calls.size()); @@ -184,10 +184,10 @@ void sessionRpc_workspace_listFiles_injects_sessionId() { var stub = new StubCaller(); var session = new SessionRpc(stub, "sess-ws"); - session.workspace.listFiles(); + session.workspaces.listFiles(); assertEquals(1, stub.calls.size()); - assertEquals("session.workspace.listFiles", stub.calls.get(0).method()); + assertEquals("session.workspaces.listFiles", stub.calls.get(0).method()); var params = (Map) stub.calls.get(0).params(); assertEquals("sess-ws", params.get("sessionId")); } @@ -197,11 +197,11 @@ void sessionRpc_workspace_readFile_merges_sessionId() { var stub = new StubCaller(); var session = new SessionRpc(stub, "sess-ws-rf"); - var rfParams = new SessionWorkspaceReadFileParams(null, "/src/Main.java"); - session.workspace.readFile(rfParams); + var rfParams = new SessionWorkspacesReadFileParams(null, "/src/Main.java"); + session.workspaces.readFile(rfParams); assertEquals(1, stub.calls.size()); - assertEquals("session.workspace.readFile", stub.calls.get(0).method()); + assertEquals("session.workspaces.readFile", stub.calls.get(0).method()); var params = (com.fasterxml.jackson.databind.node.ObjectNode) stub.calls.get(0).params(); assertEquals("sess-ws-rf", params.get("sessionId").asText()); assertEquals("/src/Main.java", params.get("path").asText()); @@ -212,11 +212,11 @@ void sessionRpc_workspace_createFile_merges_sessionId() { var stub = new StubCaller(); var session = new SessionRpc(stub, "sess-ws-cf"); - var cfParams = new SessionWorkspaceCreateFileParams(null, "/new/file.txt", "content"); - session.workspace.createFile(cfParams); + var cfParams = new SessionWorkspacesCreateFileParams(null, "/new/file.txt", "content"); + session.workspaces.createFile(cfParams); assertEquals(1, stub.calls.size()); - assertEquals("session.workspace.createFile", stub.calls.get(0).method()); + assertEquals("session.workspaces.createFile", stub.calls.get(0).method()); var params = (com.fasterxml.jackson.databind.node.ObjectNode) stub.calls.get(0).params(); assertEquals("sess-ws-cf", params.get("sessionId").asText()); } @@ -633,7 +633,7 @@ void sessionRpc_log_merges_sessionId() { var stub = new StubCaller(); var session = new SessionRpc(stub, "sess-log"); - var logParams = new SessionLogParams(null, "Hello from test", null, null, null); + var logParams = new SessionLogParams(null, "Hello from test", null, null, null, null, null); session.log(logParams); assertEquals(1, stub.calls.size()); @@ -649,15 +649,16 @@ void sessionRpc_log_merges_sessionId() { @Test void serverRpc_sessionFs_setProvider_params_record() { - var params = new SessionFsSetProviderParams("/workspace", "/state", null); + var params = new SessionFsSetProviderParams("/workspace", "/state", null, null); assertEquals("/workspace", params.initialCwd()); assertEquals("/state", params.sessionStatePath()); assertNull(params.conventions()); + assertNull(params.capabilities()); } @Test void sessionsForkParams_record() { - var params = new SessionsForkParams("parent-id", "event-123"); + var params = new SessionsForkParams("parent-id", "event-123", null); assertEquals("parent-id", params.sessionId()); assertEquals("event-123", params.toEventId()); } @@ -674,24 +675,20 @@ void sessionAgentDeselectResult_empty_record() { @Test void sessionLogParams_level_enum_values() { - assertEquals("info", SessionLogParams.SessionLogParamsLevel.INFO.getValue()); - assertEquals("warning", SessionLogParams.SessionLogParamsLevel.WARNING.getValue()); - assertEquals("error", SessionLogParams.SessionLogParamsLevel.ERROR.getValue()); + assertEquals("info", SessionLogLevel.INFO.getValue()); + assertEquals("warning", SessionLogLevel.WARNING.getValue()); + assertEquals("error", SessionLogLevel.ERROR.getValue()); } @Test void sessionLogParams_level_enum_fromValue() { - assertEquals(SessionLogParams.SessionLogParamsLevel.INFO, - SessionLogParams.SessionLogParamsLevel.fromValue("info")); - assertEquals(SessionLogParams.SessionLogParamsLevel.WARNING, - SessionLogParams.SessionLogParamsLevel.fromValue("warning")); - assertEquals(SessionLogParams.SessionLogParamsLevel.ERROR, - SessionLogParams.SessionLogParamsLevel.fromValue("error")); + assertEquals(SessionLogLevel.INFO, SessionLogLevel.fromValue("info")); + assertEquals(SessionLogLevel.WARNING, SessionLogLevel.fromValue("warning")); + assertEquals(SessionLogLevel.ERROR, SessionLogLevel.fromValue("error")); } @Test void sessionLogParams_level_enum_fromValue_unknown_throws() { - assertThrows(IllegalArgumentException.class, - () -> SessionLogParams.SessionLogParamsLevel.fromValue("unknown-level")); + assertThrows(IllegalArgumentException.class, () -> SessionLogLevel.fromValue("unknown-level")); } } diff --git a/src/test/java/com/github/copilot/sdk/generated/rpc/GeneratedRpcRecordsCoverageTest.java b/src/test/java/com/github/copilot/sdk/generated/rpc/GeneratedRpcRecordsCoverageTest.java index e2bf423ff1..6601b48298 100644 --- a/src/test/java/com/github/copilot/sdk/generated/rpc/GeneratedRpcRecordsCoverageTest.java +++ b/src/test/java/com/github/copilot/sdk/generated/rpc/GeneratedRpcRecordsCoverageTest.java @@ -6,6 +6,7 @@ import static org.junit.jupiter.api.Assertions.*; +import java.time.OffsetDateTime; import java.util.List; import java.util.Map; import java.util.UUID; @@ -32,10 +33,10 @@ void pingParams_record() { @Test void pingResult_record() { - var result = new PingResult("pong", 1234.0, 2.0); + var result = new PingResult("pong", null, 2L); assertEquals("pong", result.message()); - assertEquals(1234.0, result.timestamp()); - assertEquals(2.0, result.protocolVersion()); + assertNull(result.timestamp()); + assertEquals(2L, result.protocolVersion()); } @Test @@ -67,7 +68,7 @@ void toolsListParams_record() { @Test void sessionsForkParams_record() { - var params = new SessionsForkParams("sess-1", "event-abc"); + var params = new SessionsForkParams("sess-1", "event-abc", null); assertEquals("sess-1", params.sessionId()); assertEquals("event-abc", params.toEventId()); } @@ -209,12 +210,10 @@ void sessionFsRmParams_record() { @Test void sessionFsSetProviderParams_conventions_enum() { - assertEquals("windows", SessionFsSetProviderParams.SessionFsSetProviderParamsConventions.WINDOWS.getValue()); - assertEquals("posix", SessionFsSetProviderParams.SessionFsSetProviderParamsConventions.POSIX.getValue()); - assertEquals(SessionFsSetProviderParams.SessionFsSetProviderParamsConventions.POSIX, - SessionFsSetProviderParams.SessionFsSetProviderParamsConventions.fromValue("posix")); - assertThrows(IllegalArgumentException.class, - () -> SessionFsSetProviderParams.SessionFsSetProviderParamsConventions.fromValue("unknown")); + assertEquals("windows", SessionFsSetProviderConventions.WINDOWS.getValue()); + assertEquals("posix", SessionFsSetProviderConventions.POSIX.getValue()); + assertEquals(SessionFsSetProviderConventions.POSIX, SessionFsSetProviderConventions.fromValue("posix")); + assertThrows(IllegalArgumentException.class, () -> SessionFsSetProviderConventions.fromValue("unknown")); } @Test @@ -248,20 +247,19 @@ void sessionHistoryTruncateParams_record() { @Test void sessionLogParams_record() { - var params = new SessionLogParams("sess-24", "test message", SessionLogParams.SessionLogParamsLevel.INFO, false, - null); + var params = new SessionLogParams("sess-24", "test message", SessionLogLevel.INFO, null, false, null, null); assertEquals("sess-24", params.sessionId()); assertEquals("test message", params.message()); - assertEquals(SessionLogParams.SessionLogParamsLevel.INFO, params.level()); + assertEquals(SessionLogLevel.INFO, params.level()); assertFalse(params.ephemeral()); assertNull(params.url()); } @Test void sessionLogParams_level_enum_all_values() { - for (var level : SessionLogParams.SessionLogParamsLevel.values()) { + for (var level : SessionLogLevel.values()) { assertNotNull(level.getValue()); - assertEquals(level, SessionLogParams.SessionLogParamsLevel.fromValue(level.getValue())); + assertEquals(level, SessionLogLevel.fromValue(level.getValue())); } } @@ -299,21 +297,20 @@ void sessionModeGetParams_record() { @Test void sessionModeSetParams_record() { - var params = new SessionModeSetParams("sess-30", SessionModeSetParams.SessionModeSetParamsMode.PLAN); + var params = new SessionModeSetParams("sess-30", SessionMode.PLAN); assertEquals("sess-30", params.sessionId()); - assertEquals(SessionModeSetParams.SessionModeSetParamsMode.PLAN, params.mode()); + assertEquals(SessionMode.PLAN, params.mode()); } @Test void sessionModeSetParams_mode_enum() { - assertEquals("interactive", SessionModeSetParams.SessionModeSetParamsMode.INTERACTIVE.getValue()); - assertEquals("plan", SessionModeSetParams.SessionModeSetParamsMode.PLAN.getValue()); - assertEquals("autopilot", SessionModeSetParams.SessionModeSetParamsMode.AUTOPILOT.getValue()); - for (var mode : SessionModeSetParams.SessionModeSetParamsMode.values()) { - assertEquals(mode, SessionModeSetParams.SessionModeSetParamsMode.fromValue(mode.getValue())); + assertEquals("interactive", SessionMode.INTERACTIVE.getValue()); + assertEquals("plan", SessionMode.PLAN.getValue()); + assertEquals("autopilot", SessionMode.AUTOPILOT.getValue()); + for (var mode : SessionMode.values()) { + assertEquals(mode, SessionMode.fromValue(mode.getValue())); } - assertThrows(IllegalArgumentException.class, - () -> SessionModeSetParams.SessionModeSetParamsMode.fromValue("unknown-mode")); + assertThrows(IllegalArgumentException.class, () -> SessionMode.fromValue("unknown-mode")); } @Test @@ -324,10 +321,11 @@ void sessionModelGetCurrentParams_record() { @Test void sessionModelSwitchToParams_record() { - var params = new SessionModelSwitchToParams("sess-32", "claude-sonnet-4.5", "high", null); + var params = new SessionModelSwitchToParams("sess-32", "claude-sonnet-4.5", "high", null, null); assertEquals("sess-32", params.sessionId()); assertEquals("claude-sonnet-4.5", params.modelId()); assertEquals("high", params.reasoningEffort()); + assertNull(params.reasoningSummary()); assertNull(params.modelCapabilities()); } @@ -366,32 +364,30 @@ void sessionPluginsListParams_record() { @Test void sessionShellExecParams_record() { - var params = new SessionShellExecParams("sess-38", "ls -la", "/workspace", 5000.0); + var params = new SessionShellExecParams("sess-38", "ls -la", "/workspace", 5000L); assertEquals("sess-38", params.sessionId()); assertEquals("ls -la", params.command()); assertEquals("/workspace", params.cwd()); - assertEquals(5000.0, params.timeout()); + assertEquals(5000L, params.timeout()); } @Test void sessionShellKillParams_record() { - var params = new SessionShellKillParams("sess-39", "proc-abc", - SessionShellKillParams.SessionShellKillParamsSignal.SIGTERM); + var params = new SessionShellKillParams("sess-39", "proc-abc", ShellKillSignal.SIGTERM); assertEquals("sess-39", params.sessionId()); assertEquals("proc-abc", params.processId()); - assertEquals(SessionShellKillParams.SessionShellKillParamsSignal.SIGTERM, params.signal()); + assertEquals(ShellKillSignal.SIGTERM, params.signal()); } @Test void sessionShellKillParams_signal_enum() { - assertEquals("SIGTERM", SessionShellKillParams.SessionShellKillParamsSignal.SIGTERM.getValue()); - assertEquals("SIGKILL", SessionShellKillParams.SessionShellKillParamsSignal.SIGKILL.getValue()); - assertEquals("SIGINT", SessionShellKillParams.SessionShellKillParamsSignal.SIGINT.getValue()); - for (var sig : SessionShellKillParams.SessionShellKillParamsSignal.values()) { - assertEquals(sig, SessionShellKillParams.SessionShellKillParamsSignal.fromValue(sig.getValue())); + assertEquals("SIGTERM", ShellKillSignal.SIGTERM.getValue()); + assertEquals("SIGKILL", ShellKillSignal.SIGKILL.getValue()); + assertEquals("SIGINT", ShellKillSignal.SIGINT.getValue()); + for (var sig : ShellKillSignal.values()) { + assertEquals(sig, ShellKillSignal.fromValue(sig.getValue())); } - assertThrows(IllegalArgumentException.class, - () -> SessionShellKillParams.SessionShellKillParamsSignal.fromValue("SIGHUP")); + assertThrows(IllegalArgumentException.class, () -> ShellKillSignal.fromValue("SIGHUP")); } @Test @@ -476,10 +472,11 @@ void sessionWorkspaceReadFileParams_record() { @Test void pingResult_fields() { - var result = new PingResult("pong", 9999.0, 1.0); + var ts = OffsetDateTime.now(); + var result = new PingResult("pong", ts, 1L); assertEquals("pong", result.message()); - assertEquals(9999.0, result.timestamp()); - assertEquals(1.0, result.protocolVersion()); + assertEquals(ts, result.timestamp()); + assertEquals(1L, result.protocolVersion()); } @Test @@ -489,22 +486,25 @@ void sessionAgentDeselectResult_empty() { @Test void sessionAgentListResult_with_items() { - var item = new SessionAgentListResult.SessionAgentListResultAgentsItem("name1", "Name One", "Desc 1"); + var item = new AgentInfo("name1", "Name One", "Desc 1", "/path/to/agent1", null, null, null, null, null, null, + null); var result = new SessionAgentListResult(List.of(item)); assertEquals(1, result.agents().size()); assertEquals("name1", result.agents().get(0).name()); assertEquals("Name One", result.agents().get(0).displayName()); assertEquals("Desc 1", result.agents().get(0).description()); + assertEquals("/path/to/agent1", result.agents().get(0).path()); } @Test void sessionAgentGetCurrentResult_nested() { - var agent = new SessionAgentGetCurrentResult.SessionAgentGetCurrentResultAgent("agent-1", "Agent One", - "Does things"); + var agent = new AgentInfo("agent-1", "Agent One", "Does things", null, null, null, null, null, null, null, + null); var result = new SessionAgentGetCurrentResult(agent); assertEquals("agent-1", result.agent().name()); assertEquals("Agent One", result.agent().displayName()); assertEquals("Does things", result.agent().description()); + assertNull(result.agent().path()); } @Test @@ -515,7 +515,7 @@ void sessionAgentGetCurrentResult_null_agent() { @Test void sessionAgentReloadResult_with_items() { - var item = new SessionAgentReloadResult.SessionAgentReloadResultAgentsItem("a", "A", "Desc"); + var item = new AgentInfo("a", "A", "Desc", "/path/to/a", null, null, null, null, null, null, null); var result = new SessionAgentReloadResult(List.of(item)); assertEquals(1, result.agents().size()); assertEquals("a", result.agents().get(0).name()); @@ -523,8 +523,8 @@ void sessionAgentReloadResult_with_items() { @Test void sessionAgentSelectResult_nested() { - var agent = new SessionAgentSelectResult.SessionAgentSelectResultAgent("selected", "Selected", - "The selected agent"); + var agent = new AgentInfo("selected", "Selected", "The selected agent", "/path/to/selected", null, null, null, + null, null, null, null); var result = new SessionAgentSelectResult(agent); assertEquals("selected", result.agent().name()); } @@ -548,45 +548,28 @@ void sessionExtensionsEnableResult_empty() { @Test void sessionExtensionsListResult_nested() { - var ext = new SessionExtensionsListResult.SessionExtensionsListResultExtensionsItem("ext-1", "My Extension", - SessionExtensionsListResult.SessionExtensionsListResultExtensionsItem.SessionExtensionsListResultExtensionsItemSource.PROJECT, - SessionExtensionsListResult.SessionExtensionsListResultExtensionsItem.SessionExtensionsListResultExtensionsItemStatus.RUNNING, - 1234L); + var ext = new Extension("ext-1", "My Extension", ExtensionSource.PROJECT, ExtensionStatus.RUNNING, 1234L); var result = new SessionExtensionsListResult(List.of(ext)); assertEquals(1, result.extensions().size()); assertEquals("ext-1", result.extensions().get(0).id()); assertEquals("My Extension", result.extensions().get(0).name()); - assertEquals( - SessionExtensionsListResult.SessionExtensionsListResultExtensionsItem.SessionExtensionsListResultExtensionsItemSource.PROJECT, - result.extensions().get(0).source()); - assertEquals( - SessionExtensionsListResult.SessionExtensionsListResultExtensionsItem.SessionExtensionsListResultExtensionsItemStatus.RUNNING, - result.extensions().get(0).status()); + assertEquals(ExtensionSource.PROJECT, result.extensions().get(0).source()); + assertEquals(ExtensionStatus.RUNNING, result.extensions().get(0).status()); assertEquals(1234L, result.extensions().get(0).pid()); } @Test void sessionExtensionsListResult_enums() { - for (var src : SessionExtensionsListResult.SessionExtensionsListResultExtensionsItem.SessionExtensionsListResultExtensionsItemSource - .values()) { + for (var src : ExtensionSource.values()) { assertNotNull(src.getValue()); - assertEquals(src, - SessionExtensionsListResult.SessionExtensionsListResultExtensionsItem.SessionExtensionsListResultExtensionsItemSource - .fromValue(src.getValue())); + assertEquals(src, ExtensionSource.fromValue(src.getValue())); } - for (var status : SessionExtensionsListResult.SessionExtensionsListResultExtensionsItem.SessionExtensionsListResultExtensionsItemStatus - .values()) { + for (var status : ExtensionStatus.values()) { assertNotNull(status.getValue()); - assertEquals(status, - SessionExtensionsListResult.SessionExtensionsListResultExtensionsItem.SessionExtensionsListResultExtensionsItemStatus - .fromValue(status.getValue())); + assertEquals(status, ExtensionStatus.fromValue(status.getValue())); } - assertThrows(IllegalArgumentException.class, - () -> SessionExtensionsListResult.SessionExtensionsListResultExtensionsItem.SessionExtensionsListResultExtensionsItemSource - .fromValue("unknown")); - assertThrows(IllegalArgumentException.class, - () -> SessionExtensionsListResult.SessionExtensionsListResultExtensionsItem.SessionExtensionsListResultExtensionsItemStatus - .fromValue("unknown")); + assertThrows(IllegalArgumentException.class, () -> ExtensionSource.fromValue("unknown")); + assertThrows(IllegalArgumentException.class, () -> ExtensionStatus.fromValue("unknown")); } @Test @@ -610,42 +593,34 @@ void sessionFsExistsResult_record() { @Test void sessionFsReadFileResult_record() { - var result = new SessionFsReadFileResult("file content here"); + var result = new SessionFsReadFileResult("file content here", null); assertEquals("file content here", result.content()); } @Test void sessionFsReaddirResult_record() { - var result = new SessionFsReaddirResult(List.of("file1.txt", "file2.txt")); + var result = new SessionFsReaddirResult(List.of("file1.txt", "file2.txt"), null); assertEquals(2, result.entries().size()); assertEquals("file1.txt", result.entries().get(0)); } @Test void sessionFsReaddirWithTypesResult_nested() { - var entry = new SessionFsReaddirWithTypesResult.SessionFsReaddirWithTypesResultEntriesItem("myfile.txt", - SessionFsReaddirWithTypesResult.SessionFsReaddirWithTypesResultEntriesItem.SessionFsReaddirWithTypesResultEntriesItemType.FILE); - var result = new SessionFsReaddirWithTypesResult(List.of(entry)); + var entry = new SessionFsReaddirWithTypesEntry("myfile.txt", SessionFsReaddirWithTypesEntryType.FILE); + var result = new SessionFsReaddirWithTypesResult(List.of(entry), null); assertEquals(1, result.entries().size()); assertEquals("myfile.txt", result.entries().get(0).name()); - assertEquals( - SessionFsReaddirWithTypesResult.SessionFsReaddirWithTypesResultEntriesItem.SessionFsReaddirWithTypesResultEntriesItemType.FILE, - result.entries().get(0).type()); + assertEquals(SessionFsReaddirWithTypesEntryType.FILE, result.entries().get(0).type()); assertEquals("file", result.entries().get(0).type().getValue()); } @Test void sessionFsReaddirWithTypesResult_type_enum() { - for (var t : SessionFsReaddirWithTypesResult.SessionFsReaddirWithTypesResultEntriesItem.SessionFsReaddirWithTypesResultEntriesItemType - .values()) { + for (var t : SessionFsReaddirWithTypesEntryType.values()) { assertNotNull(t.getValue()); - assertEquals(t, - SessionFsReaddirWithTypesResult.SessionFsReaddirWithTypesResultEntriesItem.SessionFsReaddirWithTypesResultEntriesItemType - .fromValue(t.getValue())); + assertEquals(t, SessionFsReaddirWithTypesEntryType.fromValue(t.getValue())); } - assertThrows(IllegalArgumentException.class, - () -> SessionFsReaddirWithTypesResult.SessionFsReaddirWithTypesResultEntriesItem.SessionFsReaddirWithTypesResultEntriesItemType - .fromValue("symlink")); + assertThrows(IllegalArgumentException.class, () -> SessionFsReaddirWithTypesEntryType.fromValue("symlink")); } @Test @@ -657,31 +632,30 @@ void sessionFsSetProviderResult_record() { @Test void sessionFsStatResult_record() { - var result = new SessionFsStatResult(true, false, 1024.0, "2026-01-01T00:00:00Z", "2025-12-01T00:00:00Z"); + var result = new SessionFsStatResult(true, false, 1024L, null, null, null); assertTrue(result.isFile()); assertFalse(result.isDirectory()); - assertEquals(1024.0, result.size()); - assertEquals("2026-01-01T00:00:00Z", result.mtime()); - assertEquals("2025-12-01T00:00:00Z", result.birthtime()); + assertEquals(1024L, result.size()); + assertNull(result.mtime()); + assertNull(result.birthtime()); } @Test void sessionHistoryCompactResult_nested() { - var ctx = new SessionHistoryCompactResult.SessionHistoryCompactResultContextWindow(100000.0, 5000.0, 20.0, - 1000.0, 3000.0, 500.0); - var result = new SessionHistoryCompactResult(true, 2000.0, 5.0, ctx); + var ctx = new HistoryCompactContextWindow(100000L, 5000L, 20L, 1000L, 3000L, 500L); + var result = new SessionHistoryCompactResult(true, 2000L, 5L, null, ctx); assertTrue(result.success()); - assertEquals(2000.0, result.tokensRemoved()); - assertEquals(5.0, result.messagesRemoved()); + assertEquals(2000L, result.tokensRemoved()); + assertEquals(5L, result.messagesRemoved()); assertNotNull(result.contextWindow()); - assertEquals(100000.0, result.contextWindow().tokenLimit()); - assertEquals(5000.0, result.contextWindow().currentTokens()); + assertEquals(100000L, result.contextWindow().tokenLimit()); + assertEquals(5000L, result.contextWindow().currentTokens()); } @Test void sessionHistoryTruncateResult_record() { - var result = new SessionHistoryTruncateResult(3.0); - assertEquals(3.0, result.eventsRemoved()); + var result = new SessionHistoryTruncateResult(3L); + assertEquals(3L, result.eventsRemoved()); } @Test @@ -703,30 +677,21 @@ void sessionMcpEnableResult_empty() { @Test void sessionMcpListResult_nested() { - var server = new SessionMcpListResult.SessionMcpListResultServersItem("my-mcp", - SessionMcpListResult.SessionMcpListResultServersItem.SessionMcpListResultServersItemStatus.CONNECTED, - "user", null); + var server = new McpServer("my-mcp", McpServerStatus.CONNECTED, McpServerSource.USER, null); var result = new SessionMcpListResult(List.of(server)); assertEquals(1, result.servers().size()); assertEquals("my-mcp", result.servers().get(0).name()); - assertEquals( - SessionMcpListResult.SessionMcpListResultServersItem.SessionMcpListResultServersItemStatus.CONNECTED, - result.servers().get(0).status()); - assertEquals("user", result.servers().get(0).source()); + assertEquals(McpServerStatus.CONNECTED, result.servers().get(0).status()); + assertEquals(McpServerSource.USER, result.servers().get(0).source()); } @Test void sessionMcpListResult_status_enum_all_values() { - for (var status : SessionMcpListResult.SessionMcpListResultServersItem.SessionMcpListResultServersItemStatus - .values()) { + for (var status : McpServerStatus.values()) { assertNotNull(status.getValue()); - assertEquals(status, - SessionMcpListResult.SessionMcpListResultServersItem.SessionMcpListResultServersItemStatus - .fromValue(status.getValue())); + assertEquals(status, McpServerStatus.fromValue(status.getValue())); } - assertThrows(IllegalArgumentException.class, - () -> SessionMcpListResult.SessionMcpListResultServersItem.SessionMcpListResultServersItemStatus - .fromValue("unknown-status")); + assertThrows(IllegalArgumentException.class, () -> McpServerStatus.fromValue("unknown-status")); } @Test @@ -755,7 +720,7 @@ void sessionModeSetResult_enum() { @Test void sessionModelGetCurrentResult_record() { - var result = new SessionModelGetCurrentResult("claude-sonnet-4.5"); + var result = new SessionModelGetCurrentResult("claude-sonnet-4.5", null); assertEquals("claude-sonnet-4.5", result.modelId()); } @@ -792,8 +757,7 @@ void sessionPlanUpdateResult_empty() { @Test void sessionPluginsListResult_nested() { - var plugin = new SessionPluginsListResult.SessionPluginsListResultPluginsItem("my-plugin", "marketplace-x", - "1.2.3", true); + var plugin = new Plugin("my-plugin", "marketplace-x", "1.2.3", true); var result = new SessionPluginsListResult(List.of(plugin)); assertEquals(1, result.plugins().size()); assertEquals("my-plugin", result.plugins().get(0).name()); @@ -827,18 +791,17 @@ void sessionSkillsEnableResult_empty() { @Test void sessionSkillsListResult_nested() { - var item = new SessionSkillsListResult.SessionSkillsListResultSkillsItem("deploy", "Deploy the app", "project", - true, true, "/skills/deploy.md"); + var item = new Skill("deploy", "Deploy the app", SkillSource.PROJECT, true, true, "/skills/deploy.md", null); var result = new SessionSkillsListResult(List.of(item)); assertEquals(1, result.skills().size()); assertEquals("deploy", result.skills().get(0).name()); - assertEquals("project", result.skills().get(0).source()); + assertEquals(SkillSource.PROJECT, result.skills().get(0).source()); assertTrue(result.skills().get(0).enabled()); } @Test void sessionSkillsReloadResult_empty() { - assertNotNull(new SessionSkillsReloadResult()); + assertNotNull(new SessionSkillsReloadResult(null, null)); } @Test @@ -850,22 +813,20 @@ void sessionToolsHandlePendingToolCallResult_record() { @Test void sessionUiElicitationResult_accept() { - var result = new SessionUiElicitationResult(SessionUiElicitationResult.SessionUiElicitationResultAction.ACCEPT, - Map.of("name", "Alice")); - assertEquals(SessionUiElicitationResult.SessionUiElicitationResultAction.ACCEPT, result.action()); + var result = new SessionUiElicitationResult(UIElicitationResponseAction.ACCEPT, Map.of("name", "Alice")); + assertEquals(UIElicitationResponseAction.ACCEPT, result.action()); assertEquals("Alice", result.content().get("name")); } @Test void sessionUiElicitationResult_action_enum() { - assertEquals("accept", SessionUiElicitationResult.SessionUiElicitationResultAction.ACCEPT.getValue()); - assertEquals("decline", SessionUiElicitationResult.SessionUiElicitationResultAction.DECLINE.getValue()); - assertEquals("cancel", SessionUiElicitationResult.SessionUiElicitationResultAction.CANCEL.getValue()); - for (var a : SessionUiElicitationResult.SessionUiElicitationResultAction.values()) { - assertEquals(a, SessionUiElicitationResult.SessionUiElicitationResultAction.fromValue(a.getValue())); + assertEquals("accept", UIElicitationResponseAction.ACCEPT.getValue()); + assertEquals("decline", UIElicitationResponseAction.DECLINE.getValue()); + assertEquals("cancel", UIElicitationResponseAction.CANCEL.getValue()); + for (var a : UIElicitationResponseAction.values()) { + assertEquals(a, UIElicitationResponseAction.fromValue(a.getValue())); } - assertThrows(IllegalArgumentException.class, - () -> SessionUiElicitationResult.SessionUiElicitationResultAction.fromValue("unknown")); + assertThrows(IllegalArgumentException.class, () -> UIElicitationResponseAction.fromValue("unknown")); } @Test @@ -876,8 +837,8 @@ void sessionUiHandlePendingElicitationResult_record() { @Test void sessionUsageGetMetricsResult_nested() { - var changes = new SessionUsageGetMetricsResult.SessionUsageGetMetricsResultCodeChanges(100L, 50L, 5L); - var result = new SessionUsageGetMetricsResult(0.5, 10L, 2000.0, 1700000000000L, changes, null, "gpt-5", 1000L, + var changes = new UsageMetricsCodeChanges(100L, 50L, 5L, null); + var result = new SessionUsageGetMetricsResult(0.5, 10L, null, null, 2000L, null, changes, null, "gpt-5", 1000L, 500L); assertEquals(0.5, result.totalPremiumRequestCost()); assertEquals(10L, result.totalUserRequests()); @@ -908,7 +869,7 @@ void sessionWorkspaceReadFileResult_record() { @Test void sessionsForkResult_record() { - var result = new SessionsForkResult("forked-sess-id"); + var result = new SessionsForkResult("forked-sess-id", null); assertEquals("forked-sess-id", result.sessionId()); } @@ -916,17 +877,17 @@ void sessionsForkResult_record() { @Test void accountGetQuotaResult_nested() { - var snapshot = new AccountGetQuotaResult.AccountGetQuotaResultQuotaSnapshotsValue(100.0, 40.0, 60.0, 5.0, true, - "2026-05-01"); + var snapshot = new AccountQuotaSnapshot(null, 100L, 40L, null, 60.0, 5.0, true, + java.time.OffsetDateTime.parse("2026-05-01T00:00:00Z")); var result = new AccountGetQuotaResult(Map.of("chat", snapshot)); assertEquals(1, result.quotaSnapshots().size()); var s = result.quotaSnapshots().get("chat"); - assertEquals(100.0, s.entitlementRequests()); - assertEquals(40.0, s.usedRequests()); + assertEquals(100L, s.entitlementRequests()); + assertEquals(40L, s.usedRequests()); assertEquals(60.0, s.remainingPercentage()); assertEquals(5.0, s.overage()); assertTrue(s.overageAllowedWithExhaustedQuota()); - assertEquals("2026-05-01", s.resetDate()); + assertEquals(java.time.OffsetDateTime.parse("2026-05-01T00:00:00Z"), s.resetDate()); } @Test @@ -938,41 +899,33 @@ void mcpConfigListResult_record() { @Test void mcpDiscoverResult_nested() { - var server = new McpDiscoverResult.McpDiscoverResultServersItem("discovered-server", "local", - McpDiscoverResult.McpDiscoverResultServersItem.McpDiscoverResultServersItemSource.USER, true); + var server = new DiscoveredMcpServer("discovered-server", DiscoveredMcpServerType.STDIO, McpServerSource.USER, + true); var result = new McpDiscoverResult(List.of(server)); assertEquals(1, result.servers().size()); assertEquals("discovered-server", result.servers().get(0).name()); - assertEquals("local", result.servers().get(0).type()); - assertEquals(McpDiscoverResult.McpDiscoverResultServersItem.McpDiscoverResultServersItemSource.USER, - result.servers().get(0).source()); + assertEquals(DiscoveredMcpServerType.STDIO, result.servers().get(0).type()); + assertEquals(McpServerSource.USER, result.servers().get(0).source()); assertTrue(result.servers().get(0).enabled()); } @Test void mcpDiscoverResult_source_enum_all_values() { - for (var src : McpDiscoverResult.McpDiscoverResultServersItem.McpDiscoverResultServersItemSource.values()) { + for (var src : DiscoveredMcpServerSource.values()) { assertNotNull(src.getValue()); - assertEquals(src, McpDiscoverResult.McpDiscoverResultServersItem.McpDiscoverResultServersItemSource - .fromValue(src.getValue())); + assertEquals(src, DiscoveredMcpServerSource.fromValue(src.getValue())); } - assertThrows(IllegalArgumentException.class, - () -> McpDiscoverResult.McpDiscoverResultServersItem.McpDiscoverResultServersItemSource - .fromValue("unknown-source")); + assertThrows(IllegalArgumentException.class, () -> DiscoveredMcpServerSource.fromValue("unknown-source")); } @Test void modelsListResult_nested() { - var supports = new ModelsListResult.ModelsListResultModelsItem.ModelsListResultModelsItemCapabilities.ModelsListResultModelsItemCapabilitiesSupports( - true, false); - var limits = new ModelsListResult.ModelsListResultModelsItem.ModelsListResultModelsItemCapabilities.ModelsListResultModelsItemCapabilitiesLimits( - 100000.0, 8192.0, 128000.0, null); - var capabilities = new ModelsListResult.ModelsListResultModelsItem.ModelsListResultModelsItemCapabilities( - supports, limits); - var policy = new ModelsListResult.ModelsListResultModelsItem.ModelsListResultModelsItemPolicy("active", null); - var billing = new ModelsListResult.ModelsListResultModelsItem.ModelsListResultModelsItemBilling(1.0); - var modelItem = new ModelsListResult.ModelsListResultModelsItem("gpt-5", "GPT-5", capabilities, policy, billing, - null, null); + var supports = new ModelCapabilitiesSupports(true, false); + var limits = new ModelCapabilitiesLimits(100000L, 8192L, 128000L, null); + var capabilities = new ModelCapabilities(supports, limits); + var policy = new ModelPolicy(ModelPolicyState.ENABLED, null); + var billing = new ModelBilling(1.0, null); + var modelItem = new Model("gpt-5", "GPT-5", capabilities, policy, billing, null, null, null, null); var result = new ModelsListResult(List.of(modelItem)); assertEquals(1, result.models().size()); @@ -980,15 +933,14 @@ void modelsListResult_nested() { assertEquals("GPT-5", result.models().get(0).name()); assertTrue(result.models().get(0).capabilities().supports().vision()); assertFalse(result.models().get(0).capabilities().supports().reasoningEffort()); - assertEquals(100000.0, result.models().get(0).capabilities().limits().maxPromptTokens()); - assertEquals("active", result.models().get(0).policy().state()); - assertEquals(1.0, result.models().get(0).billing().multiplier()); + assertEquals(100000L, result.models().get(0).capabilities().limits().maxPromptTokens()); + assertEquals(ModelPolicyState.ENABLED, result.models().get(0).policy().state()); + assertEquals(Double.valueOf(1.0), result.models().get(0).billing().multiplier()); } @Test void toolsListResult_nested() { - var tool = new ToolsListResult.ToolsListResultToolsItem("bash", "bash", "Run shell commands", - Map.of("type", "object"), "Use for shell commands"); + var tool = new Tool("bash", "bash", "Run shell commands", Map.of("type", "object"), "Use for shell commands"); var result = new ToolsListResult(List.of(tool)); assertEquals(1, result.tools().size()); assertEquals("bash", result.tools().get(0).name()); @@ -1001,20 +953,17 @@ void toolsListResult_nested() { @Test void sessionModelSwitchToParams_nested_records() { - var limitsVision = new SessionModelSwitchToParams.SessionModelSwitchToParamsModelCapabilities.SessionModelSwitchToParamsModelCapabilitiesLimits.SessionModelSwitchToParamsModelCapabilitiesLimitsVision( - List.of("image/png", "image/jpeg"), 10.0, 5000000.0); - var limits = new SessionModelSwitchToParams.SessionModelSwitchToParamsModelCapabilities.SessionModelSwitchToParamsModelCapabilitiesLimits( - 100000.0, 8192.0, 128000.0, limitsVision); - var supports = new SessionModelSwitchToParams.SessionModelSwitchToParamsModelCapabilities.SessionModelSwitchToParamsModelCapabilitiesSupports( - true, true); - var capabilities = new SessionModelSwitchToParams.SessionModelSwitchToParamsModelCapabilities(supports, limits); - var params = new SessionModelSwitchToParams("sess-m", "gpt-5", null, capabilities); + var limitsVision = new ModelCapabilitiesOverrideLimitsVision(List.of("image/png", "image/jpeg"), 10L, 5000000L); + var limits = new ModelCapabilitiesOverrideLimits(100000L, 8192L, 128000L, limitsVision); + var supports = new ModelCapabilitiesOverrideSupports(true, true); + var capabilities = new ModelCapabilitiesOverride(supports, limits); + var params = new SessionModelSwitchToParams("sess-m", "gpt-5", null, null, capabilities); assertEquals("gpt-5", params.modelId()); assertNotNull(params.modelCapabilities()); assertTrue(params.modelCapabilities().supports().vision()); assertTrue(params.modelCapabilities().supports().reasoningEffort()); - assertEquals(100000.0, params.modelCapabilities().limits().maxPromptTokens()); + assertEquals(100000L, params.modelCapabilities().limits().maxPromptTokens()); assertEquals(2, params.modelCapabilities().limits().vision().supportedMediaTypes().size()); } @@ -1022,8 +971,7 @@ void sessionModelSwitchToParams_nested_records() { @Test void sessionUiElicitationParams_nested_schema() { - var schema = new SessionUiElicitationParams.SessionUiElicitationParamsRequestedSchema("object", - Map.of("name", Map.of("type", "string")), List.of("name")); + var schema = new UIElicitationSchema("object", Map.of("name", Map.of("type", "string")), List.of("name")); var params = new SessionUiElicitationParams("sess-elicit", "Please fill form", schema); assertEquals("sess-elicit", params.sessionId()); assertEquals("object", params.requestedSchema().type()); @@ -1034,15 +982,10 @@ void sessionUiElicitationParams_nested_schema() { @Test void sessionUiHandlePendingElicitationParamsResult_action_enum() { - for (var action : SessionUiHandlePendingElicitationParams.SessionUiHandlePendingElicitationParamsResult.SessionUiHandlePendingElicitationParamsResultAction - .values()) { + for (var action : UIElicitationResponseAction.values()) { assertNotNull(action.getValue()); - assertEquals(action, - SessionUiHandlePendingElicitationParams.SessionUiHandlePendingElicitationParamsResult.SessionUiHandlePendingElicitationParamsResultAction - .fromValue(action.getValue())); + assertEquals(action, UIElicitationResponseAction.fromValue(action.getValue())); } - assertThrows(IllegalArgumentException.class, - () -> SessionUiHandlePendingElicitationParams.SessionUiHandlePendingElicitationParamsResult.SessionUiHandlePendingElicitationParamsResultAction - .fromValue("unknown")); + assertThrows(IllegalArgumentException.class, () -> UIElicitationResponseAction.fromValue("unknown")); } }