diff --git a/.github/aw/actions-lock.json b/.github/aw/actions-lock.json index 1b8b4b56b1..11e06d9b9e 100644 --- a/.github/aw/actions-lock.json +++ b/.github/aw/actions-lock.json @@ -20,6 +20,11 @@ "version": "v4", "sha": "49933ea5288caeca8642d1e84afbd3f7d6820020" }, + "github/gh-aw-actions/setup-cli@v0.68.3": { + "repo": "github/gh-aw-actions/setup-cli", + "version": "v0.68.3", + "sha": "ba90f2186d7ad780ec640f364005fa24e797b360" + }, "github/gh-aw-actions/setup@v0.68.3": { "repo": "github/gh-aw-actions/setup", "version": "v0.68.3", diff --git a/.github/badges/jacoco.svg b/.github/badges/jacoco.svg index 812e6354a7..620c8d52a2 100644 --- a/.github/badges/jacoco.svg +++ b/.github/badges/jacoco.svg @@ -12,7 +12,7 @@ coverage coverage - 86.4% - 86.4% + 82.7% + 82.7% diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c77d00796c..03f0f715ae 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,12 +1,42 @@ -# 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: "npm" + directory: "/scripts/codegen" + schedule: + interval: "daily" + open-pull-requests-limit: 1 + allow: + - dependency-name: "@github/copilot" + + - 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/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..1143634f69 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 @@ -91,7 +91,7 @@ jobs: - 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: | @@ -105,7 +105,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..b44681eb74 --- /dev/null +++ b/.github/workflows/codegen-agentic-fix.lock.yml @@ -0,0 +1,1254 @@ +# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"e9707f96f0d1dc7a2c4bbd2c193b917ff5793901b14d055a1fef0da62dd2b928","compiler_version":"v0.68.3","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/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"}]} +# ___ _ _ +# / _ \ | | (_) +# | |_| | __ _ ___ _ __ | |_ _ ___ +# | _ |/ _` |/ _ \ '_ \| __| |/ __| +# | | | | (_| | __/ | | | |_| | (__ +# \_| |_/\__, |\___|_| |_|\__|_|\___| +# __/ | +# _ _ |___/ +# | | | | / _| | +# | | | | ___ _ __ _ __| |_| | _____ ____ +# | |/\| |/ _ \ '__| |/ /| _| |/ _ \ \ /\ / / ___| +# \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \ +# \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/ +# +# This file was automatically generated by gh-aw (v0.68.3). 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/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 +# - github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 +# +# 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 + +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: "" + 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@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + - 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: "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.20" + GH_AW_INFO_AWMG_VERSION: "" + GH_AW_INFO_FIREWALL_TYPE: "squid" + GH_AW_COMPILED_STRICT: "true" + 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/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 + sparse-checkout-cone-mode: true + fetch-depth: 1 + - name: Check workflow lock file + id: check-lock-file + uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + 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@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + env: + GH_AW_COMPILED_VERSION: "v0.68.3" + 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_89262d074598e425_EOF' + + GH_AW_PROMPT_89262d074598e425_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_89262d074598e425_EOF' + + Tools: add_comment(max:5), push_to_pull_request_branch(max:3), missing_tool, missing_data, noop + GH_AW_PROMPT_89262d074598e425_EOF + cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_push_to_pr_branch.md" + cat << 'GH_AW_PROMPT_89262d074598e425_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_89262d074598e425_EOF + cat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md" + cat << 'GH_AW_PROMPT_89262d074598e425_EOF' + + {{#runtime-import .github/workflows/codegen-agentic-fix.md}} + GH_AW_PROMPT_89262d074598e425_EOF + } > "$GH_AW_PROMPT" + - name: Interpolate variables and render templates + uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + 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@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + 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 }} + 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 + } + }); + - 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 + path: | + /tmp/gh-aw/aw_info.json + /tmp/gh-aw/aw-prompts/prompt.txt + /tmp/gh-aw/github_rate_limits.jsonl + 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@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + trace-id: ${{ needs.activation.outputs.setup-trace-id }} + - 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@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + 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.21 + env: + GH_HOST: github.com + - name: Install AWF binary + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.25.20 + - 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 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: | + 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_e118843832e795e2_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","max":3,"max_patch_size":1024,"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"],"protected_path_prefixes":[".github/",".agents/"]},"report_incomplete":{}} + GH_AW_SAFE_OUTPUTS_CONFIG_e118843832e795e2_EOF + - name: Write 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.", + "push_to_pull_request_branch": " CONSTRAINTS: Maximum 3 push(es) can be made." + }, + "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@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/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 /tmp/gh-aw/mcp-config + + # Export gateway environment variables for MCP config and gateway script + export MCP_GATEWAY_PORT="80" + export MCP_GATEWAY_DOMAIN="host.docker.internal" + 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" + 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' + + mkdir -p /home/runner/.copilot + cat << GH_AW_MCP_CONFIG_1f06674d94d6899b_EOF | bash "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.sh" + { + "mcpServers": { + "github": { + "type": "stdio", + "container": "ghcr.io/github/github-mcp-server:v0.32.0", + "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_1f06674d94d6899b_EOF + - name: Download activation artifact + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: activation + path: /tmp/gh-aw + - name: Clean git credentials + continue-on-error: true + run: bash "${RUNNER_TEMP}/gh-aw/actions/clean_git_credentials.sh" + - name: Execute GitHub Copilot CLI + id: agentic_execution + # Copilot CLI tool arguments (sorted): + timeout-minutes: 20 + run: | + set -o pipefail + touch /tmp/gh-aw/agent-step-summary.md + (umask 177 && touch /tmp/gh-aw/agent-stdio.log) + # 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 + env: + COPILOT_AGENT_RUNNER_TYPE: STANDALONE + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || '' }} + 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 + GITHUB_API_URL: ${{ github.api_url }} + GITHUB_AW: true + 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@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/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@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + 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@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + 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@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/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 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 + # 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@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/parse_token_usage.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/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/sandbox/firewall/logs/ + /tmp/gh-aw/sandbox/firewall/audit/ + 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@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + trace-id: ${{ needs.activation.outputs.setup-trace-id }} + - 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@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + 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@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + 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@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + 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@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + 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@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + 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_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_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_TIMEOUT_MINUTES: "20" + 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@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + trace-id: ${{ needs.activation.outputs.setup-trace-id }} + - 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.20 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.20 ghcr.io/github/gh-aw-firewall/squid:0.25.20 + - 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 configuration for detection + if: always() && steps.detection_guard.outputs.run_detection == 'true' + run: | + rm -f /tmp/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@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + 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: Install GitHub Copilot CLI + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.21 + env: + GH_HOST: github.com + - name: Install AWF binary + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.25.20 + - name: Execute GitHub Copilot CLI + if: always() && steps.detection_guard.outputs.run_detection == '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 + (umask 177 && touch /tmp/gh-aw/threat-detection/detection.log) + # 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 + env: + COPILOT_AGENT_RUNNER_TYPE: STANDALONE + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_MODEL: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || '' }} + GH_AW_PHASE: detection + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_VERSION: v0.68.3 + GITHUB_API_URL: ${{ github.api_url }} + GITHUB_AW: true + 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() + uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + env: + RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }} + 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(); + + 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_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@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + trace-id: ${{ needs.activation.outputs.setup-trace-id }} + - 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@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 + 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\",\"max\":3,\"max_patch_size\":1024,\"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\",\"AGENTS.md\"],\"protected_path_prefixes\":[\".github/\",\".agents/\"]},\"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..eb93e1095d --- /dev/null +++ b/.github/workflows/codegen-agentic-fix.md @@ -0,0 +1,242 @@ +--- +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 + +network: + allowed: + - defaults + - github + +tools: + github: + toolsets: [context, repos] + +safe-outputs: + push_to_pull_request_branch: + max: 3 + 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..b6f161d852 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,140 @@ 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 + + # --- 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) + + 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 - echo "✅ Generated files are up-to-date" + + - 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..5bc3f56182 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@ce1794953e0ec42adc41b6fca05e02ab49ee21c3 # v0.68.3 with: version: v0.42.17 # 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..99e61ac18f 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]+(-java(-preview)?\.[0-9]+)?$'; then + echo "Error: RELEASE_VERSION '$RELEASE_VERSION' is invalid. Expected format: M.M.P, M.M.P-java.N, or M.M.P-java-preview.N (e.g., 1.2.3, 1.2.3-java.0, or 1.2.3-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 versions like 1.0.0, 0.1.32-java.0, and 0.3.0-java-preview.0) + sed -i "s|[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\(-preview\)\{0,1\}\.[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\(-preview\)\{0,1\}\.[0-9][0-9]*\)\{0,1\}|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]*\(-java\(-preview\)\{0,1\}\.[0-9][0-9]*\)\{0,1\}-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]*\(-java\(-preview\)\{0,1\}\.[0-9][0-9]*\)\{0,1\}|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]*\(-java\(-preview\)\{0,1\}\.[0-9][0-9]*\)\{0,1\}|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/update-copilot-dependency.yml b/.github/workflows/update-copilot-dependency.yml index bb86bfd832..f7faee073a 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,22 @@ 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) else - gh pr create \ + PR_NUMBER=$(gh pr create \ --title "Update @github/copilot to $VERSION" \ --body "Automated update of \`@github/copilot\` to version \`$VERSION\`. @@ -140,5 +158,107 @@ jobs: > Created by the **Update @github/copilot Dependency** workflow." \ --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/.lastmerge b/.lastmerge index 4255f7b138..caffac28be 100644 --- a/.lastmerge +++ b/.lastmerge @@ -1 +1 @@ -922959f4a7b83509c3620d4881733c6c5677f00c +dd2dcbc439256acfb9feb2cff07c0b9c820091b8 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3592a5320d..0d198ee218 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,11 @@ 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@dd2dcbc`](https://github.com/github/copilot-sdk/commit/dd2dcbc439256acfb9feb2cff07c0b9c820091b8) + +## [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) @@ -500,6 +503,8 @@ New types: `GetForegroundSessionResponse`, `SetForegroundSessionResponse` [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 [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 +[Unreleased]: https://github.com/github/copilot-sdk-java/compare/v0.3.0-java.2...HEAD +[0.3.0-java.2]: https://github.com/github/copilot-sdk-java/compare/v0.2.2-java.1...v0.3.0-java.2 [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 diff --git a/README.md b/README.md index 1c129cbffe..f5658f3d6f 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,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 + 0.3.0-java.2 ``` @@ -53,14 +53,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 + 0.3.1-java.1-SNAPSHOT ``` ### Gradle ```groovy -implementation 'com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0' +implementation 'com.github:copilot-sdk-java:0.3.0-java.2' ``` ## Quick Start diff --git a/jbang-example.java b/jbang-example.java index aec2c69c52..4b711ba735 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 +//DEPS com.github:copilot-sdk-java:0.3.0-java.2 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..5abdefcbff 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.github copilot-sdk-java - 0.3.0-java-preview.1 + 0.3.0-java.2 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 + v0.3.0-java.2 @@ -60,7 +60,7 @@ com.fasterxml.jackson.core jackson-databind - 2.21.1 + 2.21.2 com.fasterxml.jackson.core @@ -70,7 +70,7 @@ com.fasterxml.jackson.datatype jackson-datatype-jsr310 - 2.21.1 + 2.21.2 @@ -85,7 +85,7 @@ org.junit.jupiter junit-jupiter - 5.14.1 + 5.14.3 test @@ -112,7 +112,7 @@ com.github.spotbugs spotbugs-maven-plugin - 4.9.8.2 + 4.9.8.3 config/spotbugs/spotbugs-exclude.xml @@ -123,12 +123,12 @@ org.apache.maven.plugins maven-compiler-plugin - 3.14.1 + 3.15.0 org.apache.maven.plugins maven-jar-plugin - 3.4.2 + 3.5.0 @@ -215,7 +215,7 @@ org.apache.ant ant - 1.10.15 + 1.10.17 @@ -223,7 +223,7 @@ org.codehaus.mojo exec-maven-plugin - 3.6.2 + 3.6.3 install-harness-dependencies @@ -245,7 +245,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.5.4 + 3.5.5 ${testExecutionAgentArgs} ${surefire.jvm.args} @@ -278,7 +278,7 @@ com.diffplug.spotless spotless-maven-plugin - 2.44.5 + 2.46.1 @@ -369,7 +369,7 @@ org.apache.maven.plugins maven-resources-plugin - 3.4.0 + 3.5.0 filter-site-markdown @@ -456,7 +456,7 @@ org.apache.maven.doxia doxia-module-markdown - 2.0.0 + 2.1.0 @@ -515,13 +515,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 +530,7 @@ org.codehaus.mojo taglist-maven-plugin - 3.2.1 + 3.2.2 @@ -555,7 +555,7 @@ org.apache.maven.plugins maven-dependency-plugin - 3.9.0 + 3.10.0 @@ -659,7 +659,7 @@ org.codehaus.mojo exec-maven-plugin - 3.6.2 + 3.6.3 update-copilot-schema-version @@ -681,7 +681,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.5.0 + 3.6.2 require-schema-version @@ -712,7 +712,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..909fe296c6 100644 --- a/scripts/codegen/java.ts +++ b/scripts/codegen/java.ts @@ -97,6 +97,29 @@ 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(); + +/** + * 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 +129,25 @@ function schemaTypeToJava( ): JavaTypeResult { const imports = new Set(); + // Resolve $ref first — register standalone types for generation + if (schema.$ref) { + 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 +248,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 +272,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 +310,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 +326,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 +654,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 +877,13 @@ 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(); + const packageName = "com.github.copilot.sdk.generated.rpc"; const packageDir = `src/generated/java/com/github/copilot/sdk/generated/rpc`; @@ -704,26 +901,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 +1039,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 +1057,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 +1068,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 +1500,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..682b30bc66 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.36", "json-schema": "^0.4.0", "tsx": "^4.20.6" } @@ -428,26 +428,26 @@ } }, "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.36", + "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.36.tgz", + "integrity": "sha512-x0N5wLzw+tANzb+vCFYLHn3BV3qii2oyn14wC20RO7SsS8/YeBH8olvwlDLJ4PB0mL17QOiytNCdkvjvprm28w==", "license": "SEE LICENSE IN LICENSE.md", "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.36", + "@github/copilot-darwin-x64": "1.0.36", + "@github/copilot-linux-arm64": "1.0.36", + "@github/copilot-linux-x64": "1.0.36", + "@github/copilot-win32-arm64": "1.0.36", + "@github/copilot-win32-x64": "1.0.36" } }, "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.36", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.36.tgz", + "integrity": "sha512-5qkb7frTS4K/LdTDLrzKo78VR4aw/EZ6JzLz4KfmaW4UYyPiNirExDFXa/By22X0o8YMfOp4MCA2KSCAxKdgTg==", "cpu": [ "arm64" ], @@ -461,9 +461,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.36", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.36.tgz", + "integrity": "sha512-AdsM8QtM5QSzMLpavLREh8HALO5G+VWzGNQqIHu4f0YQC/s1cGoiwo3wsgkpxRcLGBykFc+bDX3yK3MDQ8XvSw==", "cpu": [ "x64" ], @@ -477,9 +477,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.36", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.36.tgz", + "integrity": "sha512-n7K1I6r0ggOJ4A9uAMS11USTvn6BKtAwvrOkzEaeRK89VNUJzpTe6p0mE13ItzRe5eot9WLBQOxvXLtL9f6E+g==", "cpu": [ "arm64" ], @@ -493,9 +493,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.36", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.36.tgz", + "integrity": "sha512-wBtCdR3ITZcq07BJbkwHfwI6ayiwbH5pF1ex+Ycl4UI+Lf1vP9eQD6wJppPgsrjwFcdeWRThaYTPCRTkSGHv5g==", "cpu": [ "x64" ], @@ -509,9 +509,9 @@ } }, "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.36", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.36.tgz", + "integrity": "sha512-0GzZUZQn07alI8BgbzK0NlR5+ta/Rd0sWmd8kbRCns7oybAIkSALy6BKVwJmVHtXUi6h4iUE8oiFhkn0spymvw==", "cpu": [ "arm64" ], @@ -525,9 +525,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.36", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.36.tgz", + "integrity": "sha512-UBX9qj0McCK/SLq93XIr1i80fj3b3XmE3befVFrzxQuTeOoxLURN35vi7W+4x+4ZfsDHQpRTlJNjZw9w0fPr+Q==", "cpu": [ "x64" ], diff --git a/scripts/codegen/package.json b/scripts/codegen/package.json index 38dd5fc1f3..1b540376e1 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.36", "json-schema": "^0.4.0", "tsx": "^4.20.6" } 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..a6d75a8f65 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageEvent.java @@ -41,7 +41,7 @@ public record AssistantMessageEventData( /** 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 */ @@ -59,46 +59,5 @@ public record AssistantMessageEventData( /** 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/AssistantMessageToolRequest.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageToolRequest.java new file mode 100644 index 0000000000..d45803b66a --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantMessageToolRequest.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; + +/** + * 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, + /** 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/AssistantUsageCopilotUsage.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageCopilotUsage.java new file mode 100644 index 0000000000..4bb8aa92c6 --- /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-AIU (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..895f19030f --- /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") 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/AssistantUsageEvent.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageEvent.java index 65f47bfadf..4613d520e7 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageEvent.java @@ -10,8 +10,6 @@ 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; @@ -67,59 +65,11 @@ public record AssistantUsageEventData( /** 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, + @JsonProperty("copilotUsage") AssistantUsageCopilotUsage copilotUsage, /** Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh") */ @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..0986f67d71 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageQuotaSnapshot.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 java.time.OffsetDateTime; +import javax.annotation.processing.Generated; + +@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") 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 +) { +} 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..a6d994d6b8 --- /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; + +/** + * The {@code auto_mode_switch.completed} session event. + * + * @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 choice: 'yes', 'yes_always', or 'no' */ + @JsonProperty("response") String 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..8ad1a2da82 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/AutoModeSwitchRequestedEvent.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; + +/** + * The {@code auto_mode_switch.requested} session event. + * + * @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 + ) { + } +} 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..6ee7768fbb 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/CapabilitiesChangedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/CapabilitiesChangedEvent.java @@ -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/CommandsChangedCommand.java b/src/generated/java/com/github/copilot/sdk/generated/CommandsChangedCommand.java new file mode 100644 index 0000000000..30c8e99627 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/CommandsChangedCommand.java @@ -0,0 +1,22 @@ +/*--------------------------------------------------------------------------------------------- + * 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; + +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CommandsChangedCommand( + @JsonProperty("name") String name, + @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..48576c314a 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/CommandsChangedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/CommandsChangedEvent.java @@ -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..4409793920 --- /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") Double inputTokens, + /** Output tokens produced by the compaction LLM call */ + @JsonProperty("outputTokens") Double outputTokens, + /** Cached input tokens reused in the compaction LLM call */ + @JsonProperty("cacheReadTokens") Double cacheReadTokens, + /** Tokens written to prompt cache in the compaction LLM call */ + @JsonProperty("cacheWriteTokens") Double 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") Double 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..7e02e4f778 --- /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-AIU (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..3c7fde8ad8 --- /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") 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/CustomAgentsUpdatedAgent.java b/src/generated/java/com/github/copilot/sdk/generated/CustomAgentsUpdatedAgent.java new file mode 100644 index 0000000000..74637aaa82 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/CustomAgentsUpdatedAgent.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 java.util.List; +import javax.annotation.processing.Generated; + +@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 */ + @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..ae94b6bf31 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/ElicitationCompletedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/ElicitationCompletedEvent.java @@ -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..fd5773df6f 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/ElicitationRequestedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/ElicitationRequestedEvent.java @@ -10,8 +10,6 @@ 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; /** @@ -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/ExtensionsLoadedExtension.java b/src/generated/java/com/github/copilot/sdk/generated/ExtensionsLoadedExtension.java new file mode 100644 index 0000000000..366ea550cd --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ExtensionsLoadedExtension.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * 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; + +@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/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..c2a80b0f3d 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/HookEndEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/HookEndEvent.java @@ -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/McpOauthRequiredEvent.java b/src/generated/java/com/github/copilot/sdk/generated/McpOauthRequiredEvent.java index 748cdfc9ba..c7ef7a12af 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/McpOauthRequiredEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/McpOauthRequiredEvent.java @@ -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..b8c0dd93d5 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/McpOauthRequiredStaticClientConfig.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; + +/** + * 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 +) { +} 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..9e17180ded --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/McpServersLoadedServer.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * 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; + +@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") McpServersLoadedServerStatus status, + /** Configuration source: user, workspace, plugin, or builtin */ + @JsonProperty("source") String 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/PermissionCompletedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/PermissionCompletedEvent.java index 06300a5aef..0045393c1a 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/PermissionCompletedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/PermissionCompletedEvent.java @@ -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") PermissionCompletedResult 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..7892d3afe5 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/PermissionRequestedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/PermissionRequestedEvent.java @@ -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/SessionCompactionCompleteEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionCompactionCompleteEvent.java index 14728cf201..5f37980987 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionCompactionCompleteEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionCompactionCompleteEvent.java @@ -55,8 +55,8 @@ public record SessionCompactionCompleteEventData( @JsonProperty("checkpointNumber") Double 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 */ @@ -66,18 +66,5 @@ public record SessionCompactionCompleteEventData( /** Token count from tool definitions after compaction */ @JsonProperty("toolDefinitionsTokens") Double 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/SessionContextChangedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionContextChangedEvent.java index 5399860a22..0eb9e7e34b 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionContextChangedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionContextChangedEvent.java @@ -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..be5e15e91a 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionCustomAgentsUpdatedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionCustomAgentsUpdatedEvent.java @@ -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/SessionEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionEvent.java index 1b63b238e7..85c62a2418 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionEvent.java @@ -88,6 +88,8 @@ @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"), @@ -165,6 +167,8 @@ public abstract sealed class SessionEvent permits 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..4d3420174e 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionExtensionsLoadedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionExtensionsLoadedEvent.java @@ -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..86706272f5 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionHandoffEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionHandoffEvent.java @@ -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/SessionMcpServerStatusChangedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionMcpServerStatusChangedEvent.java index 7bf09f7f55..c422bf29a9 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionMcpServerStatusChangedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionMcpServerStatusChangedEvent.java @@ -38,35 +38,7 @@ 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 + @JsonProperty("status") McpServerStatusChangedStatus 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..be2d4cf744 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionMcpServersLoadedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionMcpServersLoadedEvent.java @@ -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/SessionPlanChangedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionPlanChangedEvent.java index 0ea80289a9..4677d1cdb3 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionPlanChangedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionPlanChangedEvent.java @@ -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/SessionResumeEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionResumeEvent.java index e132a1c9f9..7973e7d17c 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionResumeEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionResumeEvent.java @@ -45,52 +45,11 @@ public record SessionResumeEventData( /** Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh") */ @JsonProperty("reasoningEffort") String reasoningEffort, /** 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 ) { - - /** 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/SessionShutdownEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionShutdownEvent.java index 929d7eb797..39b6cfcfab 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionShutdownEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionShutdownEvent.java @@ -10,7 +10,6 @@ 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; @@ -38,7 +37,7 @@ 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 */ @@ -48,9 +47,9 @@ public record SessionShutdownEventData( /** Unix timestamp (milliseconds) when the session started */ @JsonProperty("sessionStartTime") Double 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 */ @@ -62,76 +61,5 @@ public record SessionShutdownEventData( /** Tool definitions token count at shutdown */ @JsonProperty("toolDefinitionsTokens") Double 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..b5e64465df 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionSkillsLoadedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionSkillsLoadedEvent.java @@ -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/SessionStartEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionStartEvent.java index 2db2d3fe7e..6d83575e85 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionStartEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionStartEvent.java @@ -51,52 +51,11 @@ public record SessionStartEventData( /** Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh") */ @JsonProperty("reasoningEffort") String reasoningEffort, /** 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 ) { - - /** 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/SessionWorkspaceFileChangedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionWorkspaceFileChangedEvent.java index ea2245adfa..9dedc7a5e3 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionWorkspaceFileChangedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionWorkspaceFileChangedEvent.java @@ -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..1afb58b69b --- /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") 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 +) { +} 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..e5cae14764 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/ShutdownModelMetric.java @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * 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; + +@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 +) { +} 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..1872a66038 --- /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") Double count, + /** Cumulative cost multiplier for requests to this model */ + @JsonProperty("cost") Double cost +) { +} 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..bd47eaeb53 --- /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") 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/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/SkillsLoadedSkill.java b/src/generated/java/com/github/copilot/sdk/generated/SkillsLoadedSkill.java new file mode 100644 index 0000000000..2183dad5c4 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/SkillsLoadedSkill.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 javax.annotation.processing.Generated; + +@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 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/SystemMessageEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SystemMessageEvent.java index 8df24f3a6b..07ae27000b 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SystemMessageEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SystemMessageEvent.java @@ -10,7 +10,6 @@ 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; /** @@ -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/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..6481374d1b 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionCompleteEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/ToolExecutionCompleteEvent.java @@ -10,7 +10,6 @@ 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; @@ -48,37 +47,13 @@ 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, /** 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/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..5d156082db 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/UserMessageEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/UserMessageEvent.java @@ -42,36 +42,16 @@ 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 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, /** CAPI interaction ID for correlating this user message with its turn */ @JsonProperty("interactionId") String interactionId ) { - - /** 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/AccountGetQuotaResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/AccountGetQuotaResult.java index 29ebfa7e38..47e3b55ee6 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 @@ -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..c6d8149300 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/AccountQuotaSnapshot.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 javax.annotation.processing.Generated; + +@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 */ + @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 overage requests made this period */ + @JsonProperty("overage") Double overage, + /** Whether overage is allowed when quota is exhausted */ + @JsonProperty("overageAllowedWithExhaustedQuota") Boolean overageAllowedWithExhaustedQuota, + /** Date when the quota resets (ISO 8601 string) */ + @JsonProperty("resetDate") String 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..edd34eb947 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/AgentInfo.java @@ -0,0 +1,26 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.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; + +@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 +) { +} 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/DiscoveredMcpServer.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/DiscoveredMcpServer.java new file mode 100644 index 0000000000..0429b26e13 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/DiscoveredMcpServer.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 javax.annotation.processing.Generated; + +@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 (local configs are normalized to stdio) */ + @JsonProperty("type") DiscoveredMcpServerType type, + /** Configuration source */ + @JsonProperty("source") DiscoveredMcpServerSource 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..1ed5520217 --- /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 (local configs are normalized to stdio) + * + * @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/Extension.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/Extension.java new file mode 100644 index 0000000000..14af4c77d8 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/Extension.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 javax.annotation.processing.Generated; + +@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/InstructionsSources.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/InstructionsSources.java new file mode 100644 index 0000000000..7ca267a1b8 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/InstructionsSources.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 javax.annotation.processing.Generated; + +@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 from frontmatter — when set, this instruction applies only to matching files */ + @JsonProperty("applyTo") String applyTo, + /** Short description (body after frontmatter) for use in instruction tables */ + @JsonProperty("description") String description +) { +} 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..01b702cfe8 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/InstructionsSourcesLocation.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; + +/** + * 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"); + + 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..8de1319422 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/InstructionsSourcesType.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; + +/** + * 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"); + + 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/McpConfigDisableParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpConfigDisableParams.java new file mode 100644 index 0000000000..cef02e1ae8 --- /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; + +/** + * Request parameters for the {@code mcp.config.disable} RPC method. + * + * @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..78ba76b7b8 --- /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; + +/** + * Request parameters for the {@code mcp.config.enable} RPC method. + * + * @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/McpDiscoverResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpDiscoverResult.java index 01561b9f49..3f107275bf 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 @@ -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/McpServer.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpServer.java new file mode 100644 index 0000000000..2f4b2b36ef --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/McpServer.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 javax.annotation.processing.Generated; + +@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/Model.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/Model.java new file mode 100644 index 0000000000..9ba457cecb --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/Model.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 java.util.List; +import javax.annotation.processing.Generated; + +@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 +) { +} 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..656f5383d5 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelBilling.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; + +/** + * 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 +) { +} 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..8794ae2589 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesOverrideLimits.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 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( + @JsonProperty("max_prompt_tokens") Long maxPromptTokens, + @JsonProperty("max_output_tokens") Long maxOutputTokens, + /** Maximum total context window size in tokens */ + @JsonProperty("max_context_window_tokens") Long maxContextWindowTokens, + @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..5d53ca6b82 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesOverrideLimitsVision.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 java.util.List; +import javax.annotation.processing.Generated; + +@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..bc8e3f4952 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelCapabilitiesOverrideSupports.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; + +/** + * 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( + @JsonProperty("vision") Boolean vision, + @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/ModelPolicy.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPolicy.java new file mode 100644 index 0000000000..d3d218bec2 --- /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") String state, + /** Usage terms or conditions for this model */ + @JsonProperty("terms") String terms +) { +} 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..a56eeb9d6e 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 @@ -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/PingResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/PingResult.java index 30ff8c58ac..b91b2fb02b 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 @@ -24,8 +24,8 @@ public record PingResult( /** Echoed message (or default greeting) */ @JsonProperty("message") String message, /** Server timestamp in milliseconds */ - @JsonProperty("timestamp") Double timestamp, + @JsonProperty("timestamp") Long 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..64edf086ec --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/Plugin.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 javax.annotation.processing.Generated; + +@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/ServerMcpConfigApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerMcpConfigApi.java index 0153b2baf4..9e9677e42a 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 @@ -57,4 +57,20 @@ public CompletableFuture remove(McpConfigRemoveParams params) { return caller.invoke("mcp.config.remove", params, Void.class); } + /** + * Invokes {@code mcp.config.enable}. + * @since 1.0.0 + */ + public CompletableFuture enable(McpConfigEnableParams params) { + return caller.invoke("mcp.config.enable", params, Void.class); + } + + /** + * Invokes {@code mcp.config.disable}. + * @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/ServerRpc.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerRpc.java index 0f0e5804c6..d2e3161000 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 @@ -32,6 +32,8 @@ public final class ServerRpc { public final ServerAccountApi account; /** 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. */ @@ -48,6 +50,7 @@ public ServerRpc(RpcCaller caller) { this.tools = new ServerToolsApi(caller); this.account = new ServerAccountApi(caller); this.mcp = new ServerMcpApi(caller); + this.skills = new ServerSkillsApi(caller); this.sessionFs = new ServerSessionFsApi(caller); this.sessions = new ServerSessionsApi(caller); } 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..6cb4327176 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ServerSkill.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 javax.annotation.processing.Generated; + +@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") 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 (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..943f682584 --- /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); + } + + /** + * Invokes {@code skills.discover}. + * @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..41eaeab01e --- /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; + } + + /** + * Invokes {@code skills.config.setDisabledSkills}. + * @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/SessionAgentGetCurrentResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentGetCurrentResult.java index b26fa1bbb5..fea4e47b63 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 @@ -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/SessionAgentListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentListResult.java index 98bff9a15a..f572bf9aed 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 @@ -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/SessionAgentReloadResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentReloadResult.java index 2b1d7395ac..32928e53a1 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 @@ -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/SessionAgentSelectResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAgentSelectResult.java index 2eff0778ee..ab9637568d 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 @@ -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..93624213e8 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionAuthApi.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 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 final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionAuthApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Invokes {@code session.auth.getStatus}. + * @since 1.0.0 + */ + public CompletableFuture getStatus() { + return caller.invoke("session.auth.getStatus", java.util.Map.of("sessionId", this.sessionId), SessionAuthGetStatusResult.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..059833d374 --- /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; + +/** + * Request parameters for the {@code session.auth.getStatus} RPC method. + * + * @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..737c2ae9ea --- /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; + +/** + * Result for the {@code session.auth.getStatus} RPC method. + * + * @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/SessionExtensionsListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionExtensionsListResult.java index 0f6e91d820..9ace814e0b 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 @@ -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/SessionFsAppendFileParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsAppendFileParams.java index f50b670eea..273031f17f 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 @@ -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/SessionFsMkdirParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsMkdirParams.java index 53fc35f256..33ca53d0f3 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 @@ -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/SessionFsReadFileResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReadFileResult.java index c036735381..d222f88676 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 @@ -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/SessionFsReaddirResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirResult.java index 3079b98134..3f2201d2dc 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 @@ -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..ff44088d4b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirWithTypesEntry.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; + +@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/SessionFsReaddirWithTypesResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsReaddirWithTypesResult.java index 0e8dc35878..0fecb63492 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 @@ -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/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..e0c893db0d 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 @@ -26,26 +26,6 @@ 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 ) { - - /** 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/SessionFsStatResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionFsStatResult.java index 39b40a9137..28bb3a9fbd 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,6 +10,7 @@ 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; /** @@ -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..1c03df8a78 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 @@ -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/SessionHistoryCompactResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryCompactResult.java index b20e2c4493..060b97f48f 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 @@ -24,29 +24,10 @@ 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, /** 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/SessionHistoryTruncateResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionHistoryTruncateResult.java index 65f71d4c84..a295cd1bd2 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 @@ -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/SessionInstructionsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionInstructionsApi.java new file mode 100644 index 0000000000..1458419504 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionInstructionsApi.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 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; + } + + /** + * Invokes {@code session.instructions.getSources}. + * @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..5fbe01602c --- /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; + +/** + * Request parameters for the {@code session.instructions.getSources} RPC method. + * + * @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..66ff52bd29 --- /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; + +/** + * Result for the {@code session.instructions.getSources} RPC method. + * + * @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..111e58cf51 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 @@ -26,32 +26,10 @@ 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, /** 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 ) { - - /** 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/SessionMcpApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpApi.java index d6fe3a7eb6..2998ea6626 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,10 +23,14 @@ 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); } /** 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..8128229a04 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 @@ -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..4a864468e3 --- /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; + } + + /** + * Invokes {@code session.mcp.oauth.login}. + *

+ * 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..ef336408d1 --- /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; + +/** + * Request parameters for the {@code session.mcp.oauth.login} RPC method. + * + * @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..e46ab39efb --- /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; + +/** + * Result for the {@code session.mcp.oauth.login} RPC method. + * + * @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/SessionMode.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMode.java new file mode 100644 index 0000000000..5b246bcb5a --- /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 agent mode. Valid values: "interactive", "plan", "autopilot". + * + * @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..bf20ad088f 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,11 +30,11 @@ public final class SessionModeApi { } /** - * Invokes {@code session.mode.get}. + * The agent mode. Valid values: "interactive", "plan", "autopilot". * @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); } /** @@ -44,10 +44,10 @@ public CompletableFuture get() { * by the session-scoped wrapper; any value provided is ignored. * @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/SessionModeSetParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModeSetParams.java index dfbae5cac5..4153014e5d 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 @@ -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 agent mode. Valid values: "interactive", "plan", "autopilot". */ + @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/SessionModelSwitchToParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionModelSwitchToParams.java index 994b3f53b4..4d69219fe2 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,7 +10,6 @@ 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; /** @@ -29,50 +28,6 @@ public record SessionModelSwitchToParams( /** Reasoning effort level to use for the model */ @JsonProperty("reasoningEffort") String reasoningEffort, /** 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/SessionNameApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameApi.java new file mode 100644 index 0000000000..1700becb97 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionNameApi.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 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; + } + + /** + * Invokes {@code session.name.get}. + * @since 1.0.0 + */ + public CompletableFuture get() { + return caller.invoke("session.name.get", java.util.Map.of("sessionId", this.sessionId), SessionNameGetResult.class); + } + + /** + * Invokes {@code session.name.set}. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * @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); + } + +} 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..59b638e4c5 --- /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; + +/** + * Request parameters for the {@code session.name.get} RPC method. + * + * @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..9e516b45aa --- /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; + +/** + * Result for the {@code session.name.get} RPC method. + * + * @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, falling back to the auto-generated summary, or null if neither exists */ + @JsonProperty("name") String name +) { +} 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..45e93db451 --- /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; + +/** + * Request parameters for the {@code session.name.set} RPC method. + * + * @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/SessionPermissionsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsApi.java index 38c2dd4fc3..31edf36b7e 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 @@ -42,4 +42,25 @@ public CompletableFuture return caller.invoke("session.permissions.handlePendingPermissionRequest", _p, SessionPermissionsHandlePendingPermissionRequestResult.class); } + /** + * Invokes {@code session.permissions.setApproveAll}. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * @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); + } + + /** + * Invokes {@code session.permissions.resetSessionApprovals}. + * @since 1.0.0 + */ + public CompletableFuture resetSessionApprovals() { + return caller.invoke("session.permissions.resetSessionApprovals", java.util.Map.of("sessionId", this.sessionId), SessionPermissionsResetSessionApprovalsResult.class); + } + } 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..6fa1b0310f --- /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; + +/** + * Request parameters for the {@code session.permissions.resetSessionApprovals} RPC method. + * + * @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..91fa4c7822 --- /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; + +/** + * Result for the {@code session.permissions.resetSessionApprovals} RPC method. + * + * @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..cd6ad254cc --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsSetApproveAllParams.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 parameters for the {@code session.permissions.setApproveAll} RPC method. + * + * @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 +) { +} 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..be59662460 --- /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; + +/** + * Result for the {@code session.permissions.setApproveAll} RPC method. + * + * @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/SessionPluginsListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPluginsListResult.java index d6008318d8..501e8760d0 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 @@ -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/SessionRpc.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRpc.java index 9faf4612d5..39ab121b6d 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,14 +28,20 @@ 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. */ @@ -72,10 +78,13 @@ 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.skills = new SessionSkillsApi(caller, sessionId); 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..3aeeebff05 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 @@ -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/SessionShellKillParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionShellKillParams.java index 19569dd0e7..cb0e128b6d 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 @@ -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/SessionSkillsListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsListResult.java index dc6ba023e8..cd8e8ea8c8 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 @@ -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/SessionUiApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiApi.java index a987bd627e..d6c1e3b4d3 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,7 +30,7 @@ public final class SessionUiApi { } /** - * Invokes {@code session.ui.elicitation}. + * The elicitation response (accept with form values, decline, or cancel) *

* 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/SessionUiElicitationParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiElicitationParams.java index d1df4daea0..315a857f5d 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,8 +10,6 @@ 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; /** @@ -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/SessionUiHandlePendingElicitationParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiHandlePendingElicitationParams.java index e890fffbda..23fd0759de 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,7 +10,6 @@ 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; /** @@ -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/SessionUsageGetMetricsResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUsageGetMetricsResult.java index 5a98516d4d..9cfdbcfc8d 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 @@ -31,9 +31,9 @@ public record SessionUsageGetMetricsResult( /** Session start timestamp (epoch milliseconds) */ @JsonProperty("sessionStartTime") Long 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 +41,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/SessionWorkspacesApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesApi.java new file mode 100644 index 0000000000..b9a5238fac --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesApi.java @@ -0,0 +1,74 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) 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; + } + + /** + * Invokes {@code session.workspaces.getWorkspace}. + * @since 1.0.0 + */ + public CompletableFuture getWorkspace() { + return caller.invoke("session.workspaces.getWorkspace", java.util.Map.of("sessionId", this.sessionId), SessionWorkspacesGetWorkspaceResult.class); + } + + /** + * Invokes {@code session.workspaces.listFiles}. + * @since 1.0.0 + */ + public CompletableFuture listFiles() { + return caller.invoke("session.workspaces.listFiles", java.util.Map.of("sessionId", this.sessionId), SessionWorkspacesListFilesResult.class); + } + + /** + * Invokes {@code session.workspaces.readFile}. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * @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); + } + + /** + * Invokes {@code session.workspaces.createFile}. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * @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); + } + +} 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..def2ffe373 --- /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; + +/** + * Request parameters for the {@code session.workspaces.createFile} RPC method. + * + * @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..c2f0e5a16d --- /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; + +/** + * Request parameters for the {@code session.workspaces.getWorkspace} RPC method. + * + * @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..2a2260db8a --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesGetWorkspaceResult.java @@ -0,0 +1,92 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.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 java.util.UUID; +import javax.annotation.processing.Generated; + +/** + * Result for the {@code session.workspaces.getWorkspace} RPC method. + * + * @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 +) { + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record SessionWorkspacesGetWorkspaceResultWorkspace( + @JsonProperty("id") UUID id, + @JsonProperty("cwd") String cwd, + @JsonProperty("git_root") String gitRoot, + @JsonProperty("repository") String repository, + @JsonProperty("host_type") SessionWorkspacesGetWorkspaceResultWorkspaceHostType hostType, + @JsonProperty("branch") String branch, + @JsonProperty("summary") String summary, + @JsonProperty("name") String name, + @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("session_sync_level") SessionWorkspacesGetWorkspaceResultWorkspaceSessionSyncLevel sessionSyncLevel, + @JsonProperty("chronicle_sync_dismissed") Boolean chronicleSyncDismissed + ) { + + public enum SessionWorkspacesGetWorkspaceResultWorkspaceHostType { + /** The {@code github} variant. */ + GITHUB("github"), + /** The {@code ado} variant. */ + ADO("ado"); + + private final String value; + SessionWorkspacesGetWorkspaceResultWorkspaceHostType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SessionWorkspacesGetWorkspaceResultWorkspaceHostType fromValue(String value) { + for (SessionWorkspacesGetWorkspaceResultWorkspaceHostType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SessionWorkspacesGetWorkspaceResultWorkspaceHostType value: " + value); + } + } + + public enum SessionWorkspacesGetWorkspaceResultWorkspaceSessionSyncLevel { + /** The {@code local} variant. */ + LOCAL("local"), + /** The {@code user} variant. */ + USER("user"), + /** The {@code repo_and_user} variant. */ + REPO_AND_USER("repo_and_user"); + + private final String value; + SessionWorkspacesGetWorkspaceResultWorkspaceSessionSyncLevel(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SessionWorkspacesGetWorkspaceResultWorkspaceSessionSyncLevel fromValue(String value) { + for (SessionWorkspacesGetWorkspaceResultWorkspaceSessionSyncLevel v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SessionWorkspacesGetWorkspaceResultWorkspaceSessionSyncLevel value: " + value); + } + } + } +} 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..7bcee441ed --- /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; + +/** + * Request parameters for the {@code session.workspaces.listFiles} RPC method. + * + * @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..26064cde40 --- /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; + +/** + * Result for the {@code session.workspaces.listFiles} RPC method. + * + * @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/SessionWorkspacesReadFileParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesReadFileParams.java new file mode 100644 index 0000000000..40b2778542 --- /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; + +/** + * Request parameters for the {@code session.workspaces.readFile} RPC method. + * + * @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..c0ce5e7c7a --- /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; + +/** + * Result for the {@code session.workspaces.readFile} RPC method. + * + * @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/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/Skill.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/Skill.java new file mode 100644 index 0000000000..7f3c2a4010 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/Skill.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 javax.annotation.processing.Generated; + +@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, 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/SkillsConfigSetDisabledSkillsParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SkillsConfigSetDisabledSkillsParams.java new file mode 100644 index 0000000000..94a32b573b --- /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; + +/** + * Request parameters for the {@code skills.config.setDisabledSkills} RPC method. + * + * @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..053d42585a --- /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; + +/** + * Request parameters for the {@code skills.discover} RPC method. + * + * @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..a2f0efe971 --- /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; + +/** + * Result for the {@code skills.discover} RPC method. + * + * @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/Tool.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/Tool.java new file mode 100644 index 0000000000..53fbdcb8ed --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/Tool.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.Map; +import javax.annotation.processing.Generated; + +@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/ToolsListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ToolsListResult.java index d56ef7e7cb..3a1b7c29d5 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,7 +11,6 @@ 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; /** @@ -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/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/UsageMetricsCodeChanges.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsCodeChanges.java new file mode 100644 index 0000000000..442c88da21 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsCodeChanges.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; + +/** + * 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 +) { +} 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..8334872cbb --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsModelMetric.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; + +@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 +) { +} 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/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/main/java/com/github/copilot/sdk/CliServerManager.java b/src/main/java/com/github/copilot/sdk/CliServerManager.java index 2176999865..07b5eefecc 100644 --- a/src/main/java/com/github/copilot/sdk/CliServerManager.java +++ b/src/main/java/com/github/copilot/sdk/CliServerManager.java @@ -83,6 +83,11 @@ ProcessInfo startCliServer() throws IOException, InterruptedException { args.add("--no-auto-login"); } + if (options.getSessionIdleTimeoutSeconds() != null && options.getSessionIdleTimeoutSeconds() > 0) { + args.add("--session-idle-timeout"); + args.add(String.valueOf(options.getSessionIdleTimeoutSeconds())); + } + List command = resolveCliCommand(cliPath, args); var pb = new ProcessBuilder(command); diff --git a/src/main/java/com/github/copilot/sdk/CopilotSession.java b/src/main/java/com/github/copilot/sdk/CopilotSession.java index b54b2cbf3c..c1374320cd 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; @@ -880,8 +884,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 +1040,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) { @@ -1095,9 +1097,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 +1121,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 +1144,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; } @@ -1181,12 +1174,11 @@ public CompletableFuture input(String message, InputOptions options) { 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 +1224,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 +1235,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); } } @@ -1582,21 +1574,19 @@ 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(), s.getReasoningEffort()); } - 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)) @@ -1658,12 +1648,12 @@ 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); diff --git a/src/main/java/com/github/copilot/sdk/SessionRequestBuilder.java b/src/main/java/com/github/copilot/sdk/SessionRequestBuilder.java index f20b0a21fc..de6977ea8d 100644 --- a/src/main/java/com/github/copilot/sdk/SessionRequestBuilder.java +++ b/src/main/java/com/github/copilot/sdk/SessionRequestBuilder.java @@ -118,6 +118,7 @@ static CreateSessionRequest buildCreateRequest(SessionConfig config, String sess request.setIncludeSubAgentStreamingEvents(config.getIncludeSubAgentStreamingEvents()); request.setMcpServers(config.getMcpServers()); request.setCustomAgents(config.getCustomAgents()); + request.setDefaultAgent(config.getDefaultAgent()); request.setAgent(config.getAgent()); request.setInfiniteSessions(config.getInfiniteSessions()); request.setSkillDirectories(config.getSkillDirectories()); @@ -135,6 +136,7 @@ static CreateSessionRequest buildCreateRequest(SessionConfig config, String sess if (config.getOnElicitationRequest() != null) { request.setRequestElicitation(true); } + request.setGitHubToken(config.getGitHubToken()); return request; } @@ -194,6 +196,7 @@ static ResumeSessionRequest buildResumeRequest(String sessionId, ResumeSessionCo request.setIncludeSubAgentStreamingEvents(config.getIncludeSubAgentStreamingEvents()); request.setMcpServers(config.getMcpServers()); request.setCustomAgents(config.getCustomAgents()); + request.setDefaultAgent(config.getDefaultAgent()); request.setAgent(config.getAgent()); request.setSkillDirectories(config.getSkillDirectories()); request.setDisabledSkills(config.getDisabledSkills()); @@ -209,6 +212,7 @@ static ResumeSessionRequest buildResumeRequest(String sessionId, ResumeSessionCo if (config.getOnElicitationRequest() != null) { request.setRequestElicitation(true); } + request.setGitHubToken(config.getGitHubToken()); return request; } 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..3a14d17335 100644 --- a/src/main/java/com/github/copilot/sdk/json/CopilotClientOptions.java +++ b/src/main/java/com/github/copilot/sdk/json/CopilotClientOptions.java @@ -52,6 +52,7 @@ public class CopilotClientOptions { private Supplier>> onListModels; private int port; private TelemetryConfig telemetry; + private Integer sessionIdleTimeoutSeconds; private Boolean useLoggedInUser; private boolean useStdio = true; @@ -430,6 +431,37 @@ public CopilotClientOptions setTelemetry(TelemetryConfig telemetry) { return this; } + /** + * Gets the server-wide idle timeout for sessions in seconds. + * + * @return the session idle timeout in seconds, or {@code null} to disable + * (sessions live indefinitely) + * @since 1.3.0 + */ + public Integer getSessionIdleTimeoutSeconds() { + return 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} or leave as {@code null} to disable (sessions live + * indefinitely). + *

+ * 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, or {@code null} to disable + * @return this options instance for method chaining + * @since 1.3.0 + */ + public CopilotClientOptions setSessionIdleTimeoutSeconds(Integer sessionIdleTimeoutSeconds) { + this.sessionIdleTimeoutSeconds = sessionIdleTimeoutSeconds; + return this; + } + /** * Returns whether to use the logged-in user for authentication. * @@ -508,6 +540,7 @@ public CopilotClientOptions clone() { copy.logLevel = this.logLevel; copy.onListModels = this.onListModels; copy.port = this.port; + copy.sessionIdleTimeoutSeconds = this.sessionIdleTimeoutSeconds; 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..ef8d5fda2d 100644 --- a/src/main/java/com/github/copilot/sdk/json/CreateSessionRequest.java +++ b/src/main/java/com/github/copilot/sdk/json/CreateSessionRequest.java @@ -79,6 +79,9 @@ public final class CreateSessionRequest { @JsonProperty("customAgents") private List customAgents; + @JsonProperty("defaultAgent") + private DefaultAgentConfig defaultAgent; + @JsonProperty("agent") private String agent; @@ -106,6 +109,9 @@ public final class CreateSessionRequest { @JsonProperty("modelCapabilities") private ModelCapabilitiesOverride modelCapabilities; + @JsonProperty("gitHubToken") + private String gitHubToken; + /** Gets the model name. @return the model */ public String getModel() { return model; @@ -278,6 +284,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; @@ -382,4 +400,17 @@ 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; + } } 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/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/ResumeSessionConfig.java b/src/main/java/com/github/copilot/sdk/json/ResumeSessionConfig.java index c3199c3176..b4dacf3702 100644 --- a/src/main/java/com/github/copilot/sdk/json/ResumeSessionConfig.java +++ b/src/main/java/com/github/copilot/sdk/json/ResumeSessionConfig.java @@ -56,6 +56,7 @@ public class ResumeSessionConfig { private Boolean includeSubAgentStreamingEvents; private Map mcpServers; private List customAgents; + private DefaultAgentConfig defaultAgent; private String agent; private List skillDirectories; private List disabledSkills; @@ -63,6 +64,7 @@ public class ResumeSessionConfig { private Consumer onEvent; private List commands; private ElicitationHandler onElicitationRequest; + private String gitHubToken; /** * Gets the AI model to use. @@ -520,6 +522,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. * @@ -684,6 +711,33 @@ public ResumeSessionConfig setOnElicitationRequest(ElicitationHandler onElicitat 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; + } + /** * Creates a shallow clone of this {@code ResumeSessionConfig} instance. *

@@ -718,6 +772,7 @@ 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.disabledSkills = this.disabledSkills != null ? new ArrayList<>(this.disabledSkills) : null; @@ -725,6 +780,7 @@ public ResumeSessionConfig clone() { copy.onEvent = this.onEvent; copy.commands = this.commands != null ? new ArrayList<>(this.commands) : null; copy.onElicitationRequest = this.onElicitationRequest; + copy.gitHubToken = this.gitHubToken; 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..e36e90b675 100644 --- a/src/main/java/com/github/copilot/sdk/json/ResumeSessionRequest.java +++ b/src/main/java/com/github/copilot/sdk/json/ResumeSessionRequest.java @@ -89,6 +89,9 @@ public final class ResumeSessionRequest { @JsonProperty("customAgents") private List customAgents; + @JsonProperty("defaultAgent") + private DefaultAgentConfig defaultAgent; + @JsonProperty("agent") private String agent; @@ -110,6 +113,9 @@ public final class ResumeSessionRequest { @JsonProperty("modelCapabilities") private ModelCapabilitiesOverride modelCapabilities; + @JsonProperty("gitHubToken") + private String gitHubToken; + /** Gets the session ID. @return the session ID */ public String getSessionId() { return sessionId; @@ -328,6 +334,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; @@ -402,4 +420,17 @@ 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; + } } 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..09661346a2 100644 --- a/src/main/java/com/github/copilot/sdk/json/SessionConfig.java +++ b/src/main/java/com/github/copilot/sdk/json/SessionConfig.java @@ -53,6 +53,7 @@ public class SessionConfig { private Boolean includeSubAgentStreamingEvents; private Map mcpServers; private List customAgents; + private DefaultAgentConfig defaultAgent; private String agent; private InfiniteSessionConfig infiniteSessions; private List skillDirectories; @@ -63,6 +64,7 @@ public class SessionConfig { private Consumer onEvent; private List commands; private ElicitationHandler onElicitationRequest; + private String gitHubToken; /** * Gets the custom session ID. @@ -448,6 +450,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. * @@ -736,6 +763,33 @@ public SessionConfig setOnElicitationRequest(ElicitationHandler onElicitationReq 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; + } + /** * Creates a shallow clone of this {@code SessionConfig} instance. *

@@ -767,6 +821,7 @@ 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; @@ -777,6 +832,7 @@ public SessionConfig clone() { copy.onEvent = this.onEvent; copy.commands = this.commands != null ? new ArrayList<>(this.commands) : null; copy.onElicitationRequest = this.onElicitationRequest; + copy.gitHubToken = this.gitHubToken; return copy; } } diff --git a/src/site/markdown/advanced.md b/src/site/markdown/advanced.md index 1209e2578f..a4c4d830ad 100644 --- a/src/site/markdown/advanced.md +++ b/src/site/markdown/advanced.md @@ -753,10 +753,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 diff --git a/src/site/markdown/cookbook/error-handling.md b/src/site/markdown/cookbook/error-handling.md index 5272b44b87..4fffd2ba0d 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:0.3.0-java.2 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:0.3.0-java.2 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:0.3.0-java.2 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:0.3.0-java.2 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:0.3.0-java.2 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:0.3.0-java.2 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:0.3.0-java.2 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..723d9b1059 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:0.3.0-java.2 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:0.3.0-java.2 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..c7ac909f18 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:0.3.0-java.2 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:0.3.0-java.2 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..de50001fcf 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:0.3.0-java.2 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:0.3.0-java.2 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:0.3.0-java.2 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..40d7cde768 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:0.3.0-java.2 import com.github.copilot.sdk.CopilotClient; import com.github.copilot.sdk.generated.AssistantMessageEvent; import com.github.copilot.sdk.generated.ToolExecutionStartEvent; diff --git a/src/test/java/com/github/copilot/sdk/CapiProxy.java b/src/test/java/com/github/copilot/sdk/CapiProxy.java index bcd064d949..30f8434363 100644 --- a/src/test/java/com/github/copilot/sdk/CapiProxy.java +++ b/src/test/java/com/github/copilot/sdk/CapiProxy.java @@ -219,6 +219,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. * 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/ConfigCloneTest.java b/src/test/java/com/github/copilot/sdk/ConfigCloneTest.java index 89f03de2de..f4f702f9ee 100644 --- a/src/test/java/com/github/copilot/sdk/ConfigCloneTest.java +++ b/src/test/java/com/github/copilot/sdk/ConfigCloneTest.java @@ -17,6 +17,7 @@ import com.github.copilot.sdk.generated.SessionEvent; import com.github.copilot.sdk.json.CopilotClientOptions; +import com.github.copilot.sdk.json.DefaultAgentConfig; import com.github.copilot.sdk.json.InfiniteSessionConfig; import com.github.copilot.sdk.json.MessageOptions; import com.github.copilot.sdk.json.ModelInfo; @@ -289,4 +290,40 @@ 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()); + } } diff --git a/src/test/java/com/github/copilot/sdk/CopilotClientTest.java b/src/test/java/com/github/copilot/sdk/CopilotClientTest.java index d69f6cf746..1cc067587e 100644 --- a/src/test/java/com/github/copilot/sdk/CopilotClientTest.java +++ b/src/test/java/com/github/copilot/sdk/CopilotClientTest.java @@ -185,6 +185,20 @@ void testUseLoggedInUserWithCliUrlThrows() { assertThrows(IllegalArgumentException.class, () -> new CopilotClient(options)); } + @Test + void testSessionIdleTimeoutSecondsDefaultsToNull() { + var options = new CopilotClientOptions(); + + assertNull(options.getSessionIdleTimeoutSeconds()); + } + + @Test + void testSessionIdleTimeoutSecondsOptionAccepted() { + var options = new CopilotClientOptions().setSessionIdleTimeoutSeconds(600); + + assertEquals(600, options.getSessionIdleTimeoutSeconds()); + } + // ===== 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..8a78c0e4f7 100644 --- a/src/test/java/com/github/copilot/sdk/CopilotSessionTest.java +++ b/src/test/java/com/github/copilot/sdk/CopilotSessionTest.java @@ -34,6 +34,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; @@ -876,4 +877,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/E2ETestContext.java b/src/test/java/com/github/copilot/sdk/E2ETestContext.java index 74c65245b6..45fcbc0a5d 100644 --- a/src/test/java/com/github/copilot/sdk/E2ETestContext.java +++ b/src/test/java/com/github/copilot/sdk/E2ETestContext.java @@ -272,6 +272,89 @@ public CopilotClient createClient() { 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()); + } + + // In CI (GitHub Actions), use a fake token to avoid auth issues + String ci = System.getenv("GITHUB_ACTIONS"); + if (ci != null && !ci.isEmpty() && 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/ExecutorWiringTest.java b/src/test/java/com/github/copilot/sdk/ExecutorWiringTest.java index bda67bbc9f..f836be89a3 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; @@ -199,7 +200,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/McpAndAgentsTest.java b/src/test/java/com/github/copilot/sdk/McpAndAgentsTest.java index 2c91dadfed..a7d81646b3 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. @@ -334,4 +338,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/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..b498c1ce76 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}; 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..519f9ebd43 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); diff --git a/src/test/java/com/github/copilot/sdk/SessionEventDeserializationTest.java b/src/test/java/com/github/copilot/sdk/SessionEventDeserializationTest.java index baa572f357..2da7783587 100644 --- a/src/test/java/com/github/copilot/sdk/SessionEventDeserializationTest.java +++ b/src/test/java/com/github/copilot/sdk/SessionEventDeserializationTest.java @@ -791,8 +791,7 @@ void testParseSessionShutdownEvent() throws Exception { assertEquals("session.shutdown", event.getType()); var shutdownEvent = (SessionShutdownEvent) event; - assertEquals(SessionShutdownEvent.SessionShutdownEventData.SessionShutdownEventDataShutdownType.ROUTINE, - shutdownEvent.getData().shutdownType()); + assertEquals(ShutdownType.ROUTINE, shutdownEvent.getData().shutdownType()); assertEquals(5.0, shutdownEvent.getData().totalPremiumRequests()); assertEquals("gpt-4", shutdownEvent.getData().currentModel()); assertNotNull(shutdownEvent.getData().codeChanges()); @@ -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()); @@ -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" } @@ -1254,9 +1252,9 @@ void testSessionCompactionCompleteEventAllFields() throws Exception { var tokens = data.compactionTokensUsed(); assertNotNull(tokens); - assertEquals(1000.0, tokens.input()); - assertEquals(500.0, tokens.output()); - assertEquals(200.0, tokens.cachedInput()); + assertEquals(1000.0, tokens.inputTokens()); + assertEquals(500.0, tokens.outputTokens()); + assertEquals(200.0, tokens.cacheReadTokens()); } @Test @@ -1288,8 +1286,7 @@ 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()); @@ -2149,8 +2146,7 @@ void testParseJsonNodeSessionShutdownWithCodeChanges() throws Exception { var event = (SessionShutdownEvent) parseJson(json); assertNotNull(event); - assertEquals(SessionShutdownEvent.SessionShutdownEventData.SessionShutdownEventDataShutdownType.ROUTINE, - event.getData().shutdownType()); + assertEquals(ShutdownType.ROUTINE, event.getData().shutdownType()); assertEquals(100.0, event.getData().codeChanges().linesAdded()); assertEquals(1, event.getData().codeChanges().filesModified().size()); } @@ -2279,9 +2275,7 @@ 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()); + assertEquals(PermissionCompletedKind.APPROVED, event.getData().result().kind()); } @Test @@ -2404,8 +2398,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 +2468,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 +2476,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/SessionHandlerTest.java b/src/test/java/com/github/copilot/sdk/SessionHandlerTest.java index 068ae630a1..847734b4a0 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 ===== diff --git a/src/test/java/com/github/copilot/sdk/SessionRequestBuilderTest.java b/src/test/java/com/github/copilot/sdk/SessionRequestBuilderTest.java index 75457583e4..abb4447f52 100644 --- a/src/test/java/com/github/copilot/sdk/SessionRequestBuilderTest.java +++ b/src/test/java/com/github/copilot/sdk/SessionRequestBuilderTest.java @@ -13,6 +13,7 @@ import org.junit.jupiter.api.Test; 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; @@ -400,4 +401,44 @@ 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()); + } } diff --git a/src/test/java/com/github/copilot/sdk/ToolsTest.java b/src/test/java/com/github/copilot/sdk/ToolsTest.java index 1c4eaaf581..d13db36856 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")) 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..2e0b2ed094 100644 --- a/src/test/java/com/github/copilot/sdk/generated/GeneratedEventTypesCoverageTest.java +++ b/src/test/java/com/github/copilot/sdk/generated/GeneratedEventTypesCoverageTest.java @@ -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 ───────────────────────────────────────── @@ -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(McpServersLoadedServerStatus.CONNECTED, typed.getData().servers().get(0).status()); } @Test @@ -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, () -> McpServersLoadedServerStatus.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..89943e3758 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 @@ -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()); } @@ -674,24 +674,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..8e86bddf22 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 @@ -32,10 +32,10 @@ void pingParams_record() { @Test void pingResult_record() { - var result = new PingResult("pong", 1234.0, 2.0); + var result = new PingResult("pong", 1234L, 2L); assertEquals("pong", result.message()); - assertEquals(1234.0, result.timestamp()); - assertEquals(2.0, result.protocolVersion()); + assertEquals(1234L, result.timestamp()); + assertEquals(2L, result.protocolVersion()); } @Test @@ -209,12 +209,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 +246,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, false, 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 +296,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 @@ -366,32 +362,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 +470,10 @@ void sessionWorkspaceReadFileParams_record() { @Test void pingResult_fields() { - var result = new PingResult("pong", 9999.0, 1.0); + var result = new PingResult("pong", 9999L, 1L); assertEquals("pong", result.message()); - assertEquals(9999.0, result.timestamp()); - assertEquals(1.0, result.protocolVersion()); + assertEquals(9999L, result.timestamp()); + assertEquals(1L, result.protocolVersion()); } @Test @@ -489,7 +483,7 @@ 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"); var result = new SessionAgentListResult(List.of(item)); assertEquals(1, result.agents().size()); assertEquals("name1", result.agents().get(0).name()); @@ -499,8 +493,7 @@ void sessionAgentListResult_with_items() { @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"); var result = new SessionAgentGetCurrentResult(agent); assertEquals("agent-1", result.agent().name()); assertEquals("Agent One", result.agent().displayName()); @@ -515,7 +508,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"); var result = new SessionAgentReloadResult(List.of(item)); assertEquals(1, result.agents().size()); assertEquals("a", result.agents().get(0).name()); @@ -523,8 +516,7 @@ 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"); var result = new SessionAgentSelectResult(agent); assertEquals("selected", result.agent().name()); } @@ -548,45 +540,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 +585,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 +624,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, 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 +669,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 @@ -792,8 +749,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,8 +783,7 @@ 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", "project", true, true, "/skills/deploy.md"); var result = new SessionSkillsListResult(List.of(item)); assertEquals(1, result.skills().size()); assertEquals("deploy", result.skills().get(0).name()); @@ -850,22 +805,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,7 +829,7 @@ void sessionUiHandlePendingElicitationResult_record() { @Test void sessionUsageGetMetricsResult_nested() { - var changes = new SessionUsageGetMetricsResult.SessionUsageGetMetricsResultCodeChanges(100L, 50L, 5L); + var changes = new UsageMetricsCodeChanges(100L, 50L, 5L); var result = new SessionUsageGetMetricsResult(0.5, 10L, 2000.0, 1700000000000L, changes, null, "gpt-5", 1000L, 500L); assertEquals(0.5, result.totalPremiumRequestCost()); @@ -916,13 +869,12 @@ 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, "2026-05-01"); 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()); @@ -938,41 +890,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, + DiscoveredMcpServerSource.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(DiscoveredMcpServerSource.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("active", null); + var billing = new ModelBilling(1.0); + var modelItem = new Model("gpt-5", "GPT-5", capabilities, policy, billing, null, null); var result = new ModelsListResult(List.of(modelItem)); assertEquals(1, result.models().size()); @@ -980,15 +924,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(100000L, 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(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 +944,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 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, 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 +962,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 +973,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")); } }