diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 65e39f8..45b0029 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: lint: timeout-minutes: 10 name: lint - runs-on: ${{ github.repository == 'stainless-sdks/warp-api-typescript' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ubuntu-latest if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -42,7 +42,7 @@ jobs: build: timeout-minutes: 5 name: build - runs-on: ${{ github.repository == 'stainless-sdks/warp-api-typescript' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ubuntu-latest if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') permissions: contents: read @@ -65,29 +65,10 @@ jobs: - name: Check build run: ./scripts/build - - - name: Get GitHub OIDC Token - if: |- - github.repository == 'stainless-sdks/warp-api-typescript' && - !startsWith(github.ref, 'refs/heads/stl/') - id: github-oidc - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - with: - script: core.setOutput('github_token', await core.getIDToken()); - - - name: Upload tarball - if: |- - github.repository == 'stainless-sdks/warp-api-typescript' && - !startsWith(github.ref, 'refs/heads/stl/') - env: - URL: https://pkg.stainless.com/s - AUTH: ${{ steps.github-oidc.outputs.github_token }} - SHA: ${{ github.sha }} - run: ./scripts/utils/upload-artifact.sh test: timeout-minutes: 10 name: test - runs-on: ${{ github.repository == 'stainless-sdks/warp-api-typescript' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ubuntu-latest if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 diff --git a/.github/workflows/promote_sdk.yml b/.github/workflows/promote_sdk.yml new file mode 100644 index 0000000..d007379 --- /dev/null +++ b/.github/workflows/promote_sdk.yml @@ -0,0 +1,26 @@ +# Promote SDK updates from this staging repository to the corresponding +# production repository. + +name: Promote SDK + +on: + workflow_dispatch: + +jobs: + promote: + name: promote + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ github.event.repository.default_branch }} + fetch-depth: 0 + persist-credentials: false + + - name: Promote SDK to production + uses: warpdotdev/warp-github-actions/.github/actions/promote_sdk@main + with: + production_repo_token: ${{ secrets.STAINLESS_SDK_PROD_WRITE_TOKEN }} diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index b6c2398..e4073f5 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -1,13 +1,9 @@ -# This workflow is triggered when a GitHub release is created. -# It can also be run manually to re-publish to NPM in case it failed for some reason. -# You can run this workflow by navigating to https://www.github.com/warpdotdev/oz-sdk-typescript/actions/workflows/publish-npm.yml +# This workflow publishes the package to NPM. +# You can run this workflow manually by navigating to https://www.github.com/warpdotdev/oz-sdk-typescript/actions/workflows/publish-npm.yml name: Publish NPM on: workflow_dispatch: - release: - types: [published] - jobs: publish: name: publish diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index cdc0277..3df5e8d 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -17,3 +17,5 @@ jobs: - name: Check release environment run: | bash ./bin/check-release-environment + env: + RELEASE_PLEASE_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }} diff --git a/.stats.yml b/.stats.yml index 12343f9..c125dfb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1 @@ configured_endpoints: 23 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/warp-bnavetta/warp-api-0bc171e3cd0224936953898ce9b7eb35e1bf1cbf58a673fc80b32c90ce84bcd0.yml -openapi_spec_hash: 6c7d5f294b0800e878729314f57a09f0 -config_hash: 279b20eafe220bf54131676cc0b9cdd2 diff --git a/bin/check-release-environment b/bin/check-release-environment index 6b43775..c43c74f 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,6 +2,10 @@ errors=() +if [ -z "${RELEASE_PLEASE_TOKEN}" ]; then + errors+=("The RELEASE_PLEASE_TOKEN secret has not been set. Create a fine-grained GitHub PAT and add it as a repository secret.") +fi + lenErrors=${#errors[@]} if [[ lenErrors -gt 0 ]]; then diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b203a19..67caed2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3122,10 +3122,7 @@ packages: tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.11/tsc-multi.tgz: resolution: - { - integrity: sha512-LrjLRdfDnJ6UcZPSsxxY8QDnZmS3ZpPyvzgjUlNMjjRoTAUVqeL+IWrIzEU3Z+CwVrpVI97PePRLenEfCtR/UQ==, - tarball: https://github.com/stainless-api/tsc-multi/releases/download/v1.1.11/tsc-multi.tgz, - } + { tarball: https://github.com/stainless-api/tsc-multi/releases/download/v1.1.11/tsc-multi.tgz } version: 1.1.11 engines: { node: '>=14' } hasBin: true diff --git a/release-please-config.json b/release-please-config.json index 1ebd0bd..9f17a90 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -2,7 +2,7 @@ "packages": { ".": {} }, - "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", "include-v-in-tag": true, "include-component-in-tag": false, "versioning": "prerelease", diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh index 45cc720..0fb16e6 100755 --- a/scripts/utils/upload-artifact.sh +++ b/scripts/utils/upload-artifact.sh @@ -20,7 +20,7 @@ UPLOAD_RESPONSE=$(curl -v -X PUT \ if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then echo -e "\033[32mUploaded build to Stainless storage.\033[0m" - echo -e "\033[32mInstallation: npm install 'https://pkg.stainless.com/s/warp-api-typescript/$SHA'\033[0m" + echo -e "\033[32mInstallation: npm install 'https://pkg.stainless.com/s/oz-sdk-typescript-staging/$SHA'\033[0m" else echo -e "\033[31mFailed to upload artifact.\033[0m" exit 1 diff --git a/src/resources/agent/agent.ts b/src/resources/agent/agent.ts index ec4d9df..c97f9c6 100644 --- a/src/resources/agent/agent.ts +++ b/src/resources/agent/agent.ts @@ -104,8 +104,8 @@ export class Agent extends APIResource { } /** - * Alias for POST /agent/run. This is the preferred endpoint for creating new agent - * runs. Behavior is identical to POST /agent/run. + * Spawn a cloud agent with a prompt and optional configuration. The agent will be + * queued for execution and assigned a unique run ID. * * @example * ```ts @@ -1109,7 +1109,8 @@ export interface AgentRunParams { /** * The prompt/instruction for the agent to execute. Required unless a skill is - * specified via the skill field, config.skill_spec, or config.skills. + * specified via the skill field, config.skill_spec, or config.skills. Handoff + * requests may omit prompt when conversation_id is set. */ prompt?: string; diff --git a/src/resources/agent/agent_.ts b/src/resources/agent/agent_.ts index 7846ed6..c9fcf5c 100644 --- a/src/resources/agent/agent_.ts +++ b/src/resources/agent/agent_.ts @@ -1,6 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; +import * as AgentAPI from './agent'; import { APIPromise } from '../../core/api-promise'; import { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; @@ -172,6 +173,12 @@ export interface AgentResponse { */ inference_providers?: AgentResponse.InferenceProviders; + /** + * MCP server configurations attached to this agent by default. Run-level MCP + * config takes precedence over this agent-level default. + */ + mcp_servers?: { [key: string]: AgentAPI.McpServerConfig }; + /** * Optional base prompt for this agent */ @@ -300,6 +307,12 @@ export interface CreateAgentRequest { */ inference_providers?: CreateAgentRequest.InferenceProviders; + /** + * Optional map of MCP server configurations by name to attach to runs executed by + * this agent. Run-level MCP config takes precedence over this agent-level default. + */ + mcp_servers?: { [key: string]: AgentAPI.McpServerConfig }; + /** * Optional list of memory stores to attach to the agent. Each store must be * team-owned by the same team as the agent. Duplicate UIDs within a single request @@ -460,6 +473,13 @@ export interface UpdateAgentRequest { */ inference_providers?: UpdateAgentRequest.InferenceProviders | null; + /** + * Replacement map of MCP server configurations by name. Omit to leave unchanged, + * pass an empty object to clear, or pass a non-empty object to replace. Run-level + * MCP config takes precedence over this agent-level default. + */ + mcp_servers?: { [key: string]: AgentAPI.McpServerConfig }; + /** * Replacement list of memory stores. Omit to leave unchanged, pass an empty array * to clear, or pass a non-empty array to replace. @@ -612,6 +632,12 @@ export interface AgentCreateParams { */ inference_providers?: AgentCreateParams.InferenceProviders; + /** + * Optional map of MCP server configurations by name to attach to runs executed by + * this agent. Run-level MCP config takes precedence over this agent-level default. + */ + mcp_servers?: { [key: string]: AgentAPI.McpServerConfig }; + /** * Optional list of memory stores to attach to the agent. Each store must be * team-owned by the same team as the agent. Duplicate UIDs within a single request @@ -761,6 +787,13 @@ export interface AgentUpdateParams { */ inference_providers?: AgentUpdateParams.InferenceProviders | null; + /** + * Replacement map of MCP server configurations by name. Omit to leave unchanged, + * pass an empty object to clear, or pass a non-empty object to replace. Run-level + * MCP config takes precedence over this agent-level default. + */ + mcp_servers?: { [key: string]: AgentAPI.McpServerConfig }; + /** * Replacement list of memory stores. Omit to leave unchanged, pass an empty array * to clear, or pass a non-empty array to replace. diff --git a/src/resources/agent/runs.ts b/src/resources/agent/runs.ts index 592e1d8..4053344 100644 --- a/src/resources/agent/runs.ts +++ b/src/resources/agent/runs.ts @@ -92,7 +92,6 @@ export class Runs extends APIResource { * ```ts * const response = await client.agent.runs.submitFollowup( * 'runId', - * { message: 'message' }, * ); * ``` */ @@ -347,6 +346,14 @@ export interface RunItem { executor?: AgentAPI.UserProfile; + /** + * Whether the run's type is eligible for cancellation via the API. + * State-independent: false for GitHub Action and local runs; true for all other + * run types (including self-hosted). Clients should still gate the control on the + * run's current state. + */ + is_run_type_cancellable?: boolean; + /** * Whether the sandbox environment is currently running */ @@ -741,7 +748,7 @@ export interface RunSubmitFollowupParams { /** * The follow-up message to send to the run. */ - message: string; + message?: string; /** * Optional query mode for the follow-up. Defaults to `normal` when omitted. The diff --git a/tests/api-resources/agent/agent_.test.ts b/tests/api-resources/agent/agent_.test.ts index 53a0c9d..2754ded 100644 --- a/tests/api-resources/agent/agent_.test.ts +++ b/tests/api-resources/agent/agent_.test.ts @@ -39,6 +39,16 @@ describe('resource agent', () => { role_arn: 'role_arn', }, }, + mcp_servers: { + foo: { + args: ['string'], + command: 'command', + env: { foo: 'string' }, + headers: { foo: 'string' }, + url: 'https://example.com', + warp_id: 'warp_id', + }, + }, memory_stores: [ { access: 'read_write', diff --git a/tests/api-resources/agent/runs.test.ts b/tests/api-resources/agent/runs.test.ts index 4cbb332..6e29b78 100644 --- a/tests/api-resources/agent/runs.test.ts +++ b/tests/api-resources/agent/runs.test.ts @@ -90,8 +90,8 @@ describe('resource runs', () => { }); // Mock server tests are disabled - test.skip('submitFollowup: only required params', async () => { - const responsePromise = client.agent.runs.submitFollowup('runId', { message: 'message' }); + test.skip('submitFollowup', async () => { + const responsePromise = client.agent.runs.submitFollowup('runId', {}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -100,9 +100,4 @@ describe('resource runs', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); - - // Mock server tests are disabled - test.skip('submitFollowup: required and optional params', async () => { - const response = await client.agent.runs.submitFollowup('runId', { message: 'message', mode: 'normal' }); - }); });