From 51bba74cf406ac231d328f5d084788a9902e478f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 8 Feb 2026 16:25:57 +0000 Subject: [PATCH 1/2] feat(api): manual updates --- .github/workflows/publish-npm.yml | 2 +- .github/workflows/release-doctor.yml | 2 +- .stats.yml | 2 +- LICENSE | 2 +- README.md | 56 +++++------ SECURITY.md | 2 +- package.json | 4 +- src/client.ts | 30 +++--- src/core/api-promise.ts | 8 +- src/core/error.ts | 4 +- src/core/resource.ts | 6 +- src/index.ts | 6 +- src/internal/parse.ts | 4 +- src/internal/shims.ts | 2 +- src/internal/uploads.ts | 10 +- src/internal/utils/base64.ts | 6 +- src/internal/utils/log.ts | 6 +- src/internal/utils/path.ts | 4 +- src/internal/utils/values.ts | 12 +-- tests/api-resources/agent/agent.test.ts | 6 +- tests/api-resources/agent/runs.test.ts | 6 +- tests/api-resources/agent/schedules.test.ts | 4 +- tests/index.test.ts | 106 ++++++++++---------- tests/stringifyQuery.test.ts | 4 +- 24 files changed, 147 insertions(+), 147 deletions(-) diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 0583495..48afbd2 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -32,4 +32,4 @@ jobs: run: | bash ./bin/publish-npm env: - NPM_TOKEN: ${{ secrets.WARP_API_NPM_TOKEN || secrets.NPM_TOKEN }} + NPM_TOKEN: ${{ secrets.OZ_API_NPM_TOKEN || secrets.NPM_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index e0bf20c..c6b3691 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -18,5 +18,5 @@ jobs: run: | bash ./bin/check-release-environment env: - NPM_TOKEN: ${{ secrets.WARP_API_NPM_TOKEN || secrets.NPM_TOKEN }} + NPM_TOKEN: ${{ secrets.OZ_API_NPM_TOKEN || secrets.NPM_TOKEN }} diff --git a/.stats.yml b/.stats.yml index 84b24aa..0643054 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 12 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/warp-bnavetta%2Fwarp-api-c99d72d8d845f1eeabf7a716949a12408df952a2a0ca2b97df570da3a7c8bb49.yml openapi_spec_hash: 8a503cbccc8a5741554282327a557114 -config_hash: 38a89a860ee0f5ef4f2cb10d010e4e8f +config_hash: 433e7a5579323a048aa173a0ace06bfc diff --git a/LICENSE b/LICENSE index 93fb21c..c3e6041 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2026 Warp API + Copyright 2026 Oz API Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index a88e067..5f6b465 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Warp API TypeScript API Library +# Oz API TypeScript API Library [![NPM version]()](https://npmjs.org/package/oz-agent-sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/oz-agent-sdk) -This library provides convenient access to the Warp API REST API from server-side TypeScript or JavaScript. +This library provides convenient access to the Oz API REST API from server-side TypeScript or JavaScript. The full API of this library can be found in [api.md](api.md). @@ -20,9 +20,9 @@ The full API of this library can be found in [api.md](api.md). ```js -import WarpAPI from 'oz-agent-sdk'; +import OzAPI from 'oz-agent-sdk'; -const client = new WarpAPI({ +const client = new OzAPI({ apiKey: process.env['WARP_API_KEY'], // This is the default and can be omitted }); @@ -98,14 +98,14 @@ This library includes TypeScript definitions for all request params and response ```ts -import WarpAPI from 'oz-agent-sdk'; +import OzAPI from 'oz-agent-sdk'; -const client = new WarpAPI({ +const client = new OzAPI({ apiKey: process.env['WARP_API_KEY'], // This is the default and can be omitted }); -const params: WarpAPI.AgentRunParams = { prompt: 'Fix the bug in auth.go' }; -const response: WarpAPI.AgentRunResponse = await client.agent.run(params); +const params: OzAPI.AgentRunParams = { prompt: 'Fix the bug in auth.go' }; +const response: OzAPI.AgentRunResponse = await client.agent.run(params); ``` Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors. @@ -119,7 +119,7 @@ a subclass of `APIError` will be thrown: ```ts const response = await client.agent.run({ prompt: 'Fix the bug in auth.go' }).catch(async (err) => { - if (err instanceof WarpAPI.APIError) { + if (err instanceof OzAPI.APIError) { console.log(err.status); // 400 console.log(err.name); // BadRequestError console.log(err.headers); // {server: 'nginx', ...} @@ -153,7 +153,7 @@ You can use the `maxRetries` option to configure or disable this: ```js // Configure the default for all requests: -const client = new WarpAPI({ +const client = new OzAPI({ maxRetries: 0, // default is 2 }); @@ -170,7 +170,7 @@ Requests time out after 1 minute by default. You can configure this with a `time ```ts // Configure the default for all requests: -const client = new WarpAPI({ +const client = new OzAPI({ timeout: 20 * 1000, // 20 seconds (default is 1 minute) }); @@ -196,7 +196,7 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse ```ts -const client = new WarpAPI(); +const client = new OzAPI(); const response = await client.agent.run({ prompt: 'Fix the bug in auth.go' }).asResponse(); console.log(response.headers.get('X-My-Header')); @@ -219,13 +219,13 @@ console.log(response.run_id); The log level can be configured in two ways: -1. Via the `WARP_API_LOG` environment variable +1. Via the `OZ_API_LOG` environment variable 2. Using the `logLevel` client option (overrides the environment variable if set) ```ts -import WarpAPI from 'oz-agent-sdk'; +import OzAPI from 'oz-agent-sdk'; -const client = new WarpAPI({ +const client = new OzAPI({ logLevel: 'debug', // Show all log messages }); ``` @@ -251,13 +251,13 @@ When providing a custom logger, the `logLevel` option still controls which messa below the configured level will not be sent to your logger. ```ts -import WarpAPI from 'oz-agent-sdk'; +import OzAPI from 'oz-agent-sdk'; import pino from 'pino'; const logger = pino(); -const client = new WarpAPI({ - logger: logger.child({ name: 'WarpAPI' }), +const client = new OzAPI({ + logger: logger.child({ name: 'OzAPI' }), logLevel: 'debug', // Send all messages to pino, allowing it to filter }); ``` @@ -320,10 +320,10 @@ globalThis.fetch = fetch; Or pass it to the client: ```ts -import WarpAPI from 'oz-agent-sdk'; +import OzAPI from 'oz-agent-sdk'; import fetch from 'my-fetch'; -const client = new WarpAPI({ fetch }); +const client = new OzAPI({ fetch }); ``` ### Fetch options @@ -331,9 +331,9 @@ const client = new WarpAPI({ fetch }); If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.) ```ts -import WarpAPI from 'oz-agent-sdk'; +import OzAPI from 'oz-agent-sdk'; -const client = new WarpAPI({ +const client = new OzAPI({ fetchOptions: { // `RequestInit` options }, @@ -348,11 +348,11 @@ options to requests: **Node** [[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)] ```ts -import WarpAPI from 'oz-agent-sdk'; +import OzAPI from 'oz-agent-sdk'; import * as undici from 'undici'; const proxyAgent = new undici.ProxyAgent('http://localhost:8888'); -const client = new WarpAPI({ +const client = new OzAPI({ fetchOptions: { dispatcher: proxyAgent, }, @@ -362,9 +362,9 @@ const client = new WarpAPI({ **Bun** [[docs](https://bun.sh/guides/http/proxy)] ```ts -import WarpAPI from 'oz-agent-sdk'; +import OzAPI from 'oz-agent-sdk'; -const client = new WarpAPI({ +const client = new OzAPI({ fetchOptions: { proxy: 'http://localhost:8888', }, @@ -374,10 +374,10 @@ const client = new WarpAPI({ **Deno** [[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)] ```ts -import WarpAPI from 'npm:oz-agent-sdk'; +import OzAPI from 'npm:oz-agent-sdk'; const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } }); -const client = new WarpAPI({ +const client = new OzAPI({ fetchOptions: { client: httpClient, }, diff --git a/SECURITY.md b/SECURITY.md index 431ac4b..221f548 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -16,7 +16,7 @@ before making any information public. ## Reporting Non-SDK Related Security Issues If you encounter security issues that are not directly related to SDKs but pertain to the services -or products provided by Warp API, please follow the respective company's security reporting guidelines. +or products provided by Oz API, please follow the respective company's security reporting guidelines. --- diff --git a/package.json b/package.json index 9b590c2..b6148a9 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "oz-agent-sdk", "version": "1.0.0-alpha.7", - "description": "The official TypeScript library for the Warp API API", - "author": "Warp API <>", + "description": "The official TypeScript library for the Oz API API", + "author": "Oz API <>", "types": "dist/index.d.ts", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index 9097dd9..cffca6d 100644 --- a/src/client.ts +++ b/src/client.ts @@ -52,7 +52,7 @@ export interface ClientOptions { /** * Override the default base URL for the API, e.g., "https://api.example.com/v2/" * - * Defaults to process.env['WARP_API_BASE_URL']. + * Defaults to process.env['OZ_API_BASE_URL']. */ baseURL?: string | null | undefined; @@ -106,7 +106,7 @@ export interface ClientOptions { /** * Set the log level. * - * Defaults to process.env['WARP_API_LOG'] or 'warn' if it isn't set. + * Defaults to process.env['OZ_API_LOG'] or 'warn' if it isn't set. */ logLevel?: LogLevel | undefined; @@ -119,9 +119,9 @@ export interface ClientOptions { } /** - * API Client for interfacing with the Warp API API. + * API Client for interfacing with the Oz API API. */ -export class WarpAPI { +export class OzAPI { apiKey: string; baseURL: string; @@ -137,10 +137,10 @@ export class WarpAPI { private _options: ClientOptions; /** - * API Client for interfacing with the Warp API API. + * API Client for interfacing with the Oz API API. * * @param {string | undefined} [opts.apiKey=process.env['WARP_API_KEY'] ?? undefined] - * @param {string} [opts.baseURL=process.env['WARP_API_BASE_URL'] ?? https://app.warp.dev/api/v1] - Override the default base URL for the API. + * @param {string} [opts.baseURL=process.env['OZ_API_BASE_URL'] ?? https://app.warp.dev/api/v1] - Override the default base URL for the API. * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls. * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation. @@ -149,13 +149,13 @@ export class WarpAPI { * @param {Record} opts.defaultQuery - Default query parameters to include with every request to the API. */ constructor({ - baseURL = readEnv('WARP_API_BASE_URL'), + baseURL = readEnv('OZ_API_BASE_URL'), apiKey = readEnv('WARP_API_KEY'), ...opts }: ClientOptions = {}) { if (apiKey === undefined) { - throw new Errors.WarpAPIError( - "The WARP_API_KEY environment variable is missing or empty; either provide it, or instantiate the WarpAPI client with an apiKey option, like new WarpAPI({ apiKey: 'My API Key' }).", + throw new Errors.OzAPIError( + "The WARP_API_KEY environment variable is missing or empty; either provide it, or instantiate the OzAPI client with an apiKey option, like new OzAPI({ apiKey: 'My API Key' }).", ); } @@ -166,14 +166,14 @@ export class WarpAPI { }; this.baseURL = options.baseURL!; - this.timeout = options.timeout ?? WarpAPI.DEFAULT_TIMEOUT /* 1 minute */; + this.timeout = options.timeout ?? OzAPI.DEFAULT_TIMEOUT /* 1 minute */; this.logger = options.logger ?? console; const defaultLogLevel = 'warn'; // Set default logLevel early so that we can log a warning in parseLogLevel. this.logLevel = defaultLogLevel; this.logLevel = parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ?? - parseLogLevel(readEnv('WARP_API_LOG'), "process.env['WARP_API_LOG']", this) ?? + parseLogLevel(readEnv('OZ_API_LOG'), "process.env['OZ_API_LOG']", this) ?? defaultLogLevel; this.fetchOptions = options.fetchOptions; this.maxRetries = options.maxRetries ?? 2; @@ -699,10 +699,10 @@ export class WarpAPI { } } - static WarpAPI = this; + static OzAPI = this; static DEFAULT_TIMEOUT = 60000; // 1 minute - static WarpAPIError = Errors.WarpAPIError; + static OzAPIError = Errors.OzAPIError; static APIError = Errors.APIError; static APIConnectionError = Errors.APIConnectionError; static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError; @@ -721,9 +721,9 @@ export class WarpAPI { agent: API.Agent = new API.Agent(this); } -WarpAPI.Agent = Agent; +OzAPI.Agent = Agent; -export declare namespace WarpAPI { +export declare namespace OzAPI { export type RequestOptions = Opts.RequestOptions; export { diff --git a/src/core/api-promise.ts b/src/core/api-promise.ts index b53ba25..c536939 100644 --- a/src/core/api-promise.ts +++ b/src/core/api-promise.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { type WarpAPI } from '../client'; +import { type OzAPI } from '../client'; import { type PromiseOrValue } from '../internal/types'; import { APIResponseProps, defaultParseResponse } from '../internal/parse'; @@ -11,13 +11,13 @@ import { APIResponseProps, defaultParseResponse } from '../internal/parse'; */ export class APIPromise extends Promise { private parsedPromise: Promise | undefined; - #client: WarpAPI; + #client: OzAPI; constructor( - client: WarpAPI, + client: OzAPI, private responsePromise: Promise, private parseResponse: ( - client: WarpAPI, + client: OzAPI, props: APIResponseProps, ) => PromiseOrValue = defaultParseResponse, ) { diff --git a/src/core/error.ts b/src/core/error.ts index e51ff19..846e826 100644 --- a/src/core/error.ts +++ b/src/core/error.ts @@ -2,13 +2,13 @@ import { castToError } from '../internal/errors'; -export class WarpAPIError extends Error {} +export class OzAPIError extends Error {} export class APIError< TStatus extends number | undefined = number | undefined, THeaders extends Headers | undefined = Headers | undefined, TError extends Object | undefined = Object | undefined, -> extends WarpAPIError { +> extends OzAPIError { /** HTTP status for the response that caused the error */ readonly status: TStatus; /** HTTP headers for the response that caused the error */ diff --git a/src/core/resource.ts b/src/core/resource.ts index 03e4ee3..9e468b4 100644 --- a/src/core/resource.ts +++ b/src/core/resource.ts @@ -1,11 +1,11 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import type { WarpAPI } from '../client'; +import type { OzAPI } from '../client'; export abstract class APIResource { - protected _client: WarpAPI; + protected _client: OzAPI; - constructor(client: WarpAPI) { + constructor(client: OzAPI) { this._client = client; } } diff --git a/src/index.ts b/src/index.ts index 3cc852f..19e2b42 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +1,12 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { WarpAPI as default } from './client'; +export { OzAPI as default } from './client'; export { type Uploadable, toFile } from './core/uploads'; export { APIPromise } from './core/api-promise'; -export { WarpAPI, type ClientOptions } from './client'; +export { OzAPI, type ClientOptions } from './client'; export { - WarpAPIError, + OzAPIError, APIError, APIConnectionError, APIConnectionTimeoutError, diff --git a/src/internal/parse.ts b/src/internal/parse.ts index 4466091..1de6a06 100644 --- a/src/internal/parse.ts +++ b/src/internal/parse.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import type { FinalRequestOptions } from './request-options'; -import { type WarpAPI } from '../client'; +import { type OzAPI } from '../client'; import { formatRequestDetails, loggerFor } from './utils/log'; export type APIResponseProps = { @@ -13,7 +13,7 @@ export type APIResponseProps = { startTime: number; }; -export async function defaultParseResponse(client: WarpAPI, props: APIResponseProps): Promise { +export async function defaultParseResponse(client: OzAPI, props: APIResponseProps): Promise { const { response, requestLogID, retryOfRequestLogID, startTime } = props; const body = await (async () => { // fetch refuses to read the body when the status code is 204. diff --git a/src/internal/shims.ts b/src/internal/shims.ts index e822b3f..da9c269 100644 --- a/src/internal/shims.ts +++ b/src/internal/shims.ts @@ -16,7 +16,7 @@ export function getDefaultFetch(): Fetch { } throw new Error( - '`fetch` is not defined as a global; Either pass `fetch` to the client, `new WarpAPI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`', + '`fetch` is not defined as a global; Either pass `fetch` to the client, `new OzAPI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`', ); } diff --git a/src/internal/uploads.ts b/src/internal/uploads.ts index 667295c..700d7a4 100644 --- a/src/internal/uploads.ts +++ b/src/internal/uploads.ts @@ -1,6 +1,6 @@ import { type RequestOptions } from './request-options'; import type { FilePropertyBag, Fetch } from './builtin-types'; -import type { WarpAPI } from '../client'; +import type { OzAPI } from '../client'; import { ReadableStreamFrom } from './shims'; export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | DataView; @@ -74,7 +74,7 @@ export const isAsyncIterable = (value: any): value is AsyncIterable => */ export const maybeMultipartFormRequestOptions = async ( opts: RequestOptions, - fetch: WarpAPI | Fetch, + fetch: OzAPI | Fetch, ): Promise => { if (!hasUploadableValue(opts.body)) return opts; @@ -85,7 +85,7 @@ type MultipartFormRequestOptions = Omit & { body: unknow export const multipartFormRequestOptions = async ( opts: MultipartFormRequestOptions, - fetch: WarpAPI | Fetch, + fetch: OzAPI | Fetch, ): Promise => { return { ...opts, body: await createForm(opts.body, fetch) }; }; @@ -98,7 +98,7 @@ const supportsFormDataMap = /* @__PURE__ */ new WeakMap> * This function detects if the fetch function provided supports the global FormData object to avoid * confusing error messages later on. */ -function supportsFormData(fetchObject: WarpAPI | Fetch): Promise { +function supportsFormData(fetchObject: OzAPI | Fetch): Promise { const fetch: Fetch = typeof fetchObject === 'function' ? fetchObject : (fetchObject as any).fetch; const cached = supportsFormDataMap.get(fetch); if (cached) return cached; @@ -124,7 +124,7 @@ function supportsFormData(fetchObject: WarpAPI | Fetch): Promise { export const createForm = async >( body: T | undefined, - fetch: WarpAPI | Fetch, + fetch: OzAPI | Fetch, ): Promise => { if (!(await supportsFormData(fetch))) { throw new TypeError( diff --git a/src/internal/utils/base64.ts b/src/internal/utils/base64.ts index 079cbce..88871fc 100644 --- a/src/internal/utils/base64.ts +++ b/src/internal/utils/base64.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { WarpAPIError } from '../../core/error'; +import { OzAPIError } from '../../core/error'; import { encodeUTF8 } from './bytes'; export const toBase64 = (data: string | Uint8Array | null | undefined): string => { @@ -18,7 +18,7 @@ export const toBase64 = (data: string | Uint8Array | null | undefined): string = return btoa(String.fromCharCode.apply(null, data as any)); } - throw new WarpAPIError('Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined'); + throw new OzAPIError('Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined'); }; export const fromBase64 = (str: string): Uint8Array => { @@ -36,5 +36,5 @@ export const fromBase64 = (str: string): Uint8Array => { return buf; } - throw new WarpAPIError('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined'); + throw new OzAPIError('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined'); }; diff --git a/src/internal/utils/log.ts b/src/internal/utils/log.ts index 11a9515..e70ef91 100644 --- a/src/internal/utils/log.ts +++ b/src/internal/utils/log.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { hasOwn } from './values'; -import { type WarpAPI } from '../../client'; +import { type OzAPI } from '../../client'; import { RequestOptions } from '../request-options'; type LogFn = (message: string, ...rest: unknown[]) => void; @@ -24,7 +24,7 @@ const levelNumbers = { export const parseLogLevel = ( maybeLevel: string | undefined, sourceName: string, - client: WarpAPI, + client: OzAPI, ): LogLevel | undefined => { if (!maybeLevel) { return undefined; @@ -60,7 +60,7 @@ const noopLogger = { let cachedLoggers = /* @__PURE__ */ new WeakMap(); -export function loggerFor(client: WarpAPI): Logger { +export function loggerFor(client: OzAPI): Logger { const logger = client.logger; const logLevel = client.logLevel ?? 'off'; if (!logger) { diff --git a/src/internal/utils/path.ts b/src/internal/utils/path.ts index 57e8883..6d586d8 100644 --- a/src/internal/utils/path.ts +++ b/src/internal/utils/path.ts @@ -1,4 +1,4 @@ -import { WarpAPIError } from '../../core/error'; +import { OzAPIError } from '../../core/error'; /** * Percent-encode everything that isn't safe to have in a path without encoding safe chars. @@ -72,7 +72,7 @@ export const createPathTagFunction = (pathEncoder = encodeURIPath) => return acc + spaces + arrows; }, ''); - throw new WarpAPIError( + throw new OzAPIError( `Path parameters result in path with invalid segments:\n${invalidSegments .map((e) => e.error) .join('\n')}\n${path}\n${underline}`, diff --git a/src/internal/utils/values.ts b/src/internal/utils/values.ts index f3c3d4c..8a72d61 100644 --- a/src/internal/utils/values.ts +++ b/src/internal/utils/values.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { WarpAPIError } from '../../core/error'; +import { OzAPIError } from '../../core/error'; // https://url.spec.whatwg.org/#url-scheme-string const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i; @@ -39,7 +39,7 @@ export function isObj(obj: unknown): obj is Record { export const ensurePresent = (value: T | null | undefined): T => { if (value == null) { - throw new WarpAPIError(`Expected a value to be given but received ${value} instead.`); + throw new OzAPIError(`Expected a value to be given but received ${value} instead.`); } return value; @@ -47,10 +47,10 @@ export const ensurePresent = (value: T | null | undefined): T => { export const validatePositiveInteger = (name: string, n: unknown): number => { if (typeof n !== 'number' || !Number.isInteger(n)) { - throw new WarpAPIError(`${name} must be an integer`); + throw new OzAPIError(`${name} must be an integer`); } if (n < 0) { - throw new WarpAPIError(`${name} must be a positive integer`); + throw new OzAPIError(`${name} must be a positive integer`); } return n; }; @@ -59,14 +59,14 @@ export const coerceInteger = (value: unknown): number => { if (typeof value === 'number') return Math.round(value); if (typeof value === 'string') return parseInt(value, 10); - throw new WarpAPIError(`Could not coerce ${value} (type: ${typeof value}) into a number`); + throw new OzAPIError(`Could not coerce ${value} (type: ${typeof value}) into a number`); }; export const coerceFloat = (value: unknown): number => { if (typeof value === 'number') return value; if (typeof value === 'string') return parseFloat(value); - throw new WarpAPIError(`Could not coerce ${value} (type: ${typeof value}) into a number`); + throw new OzAPIError(`Could not coerce ${value} (type: ${typeof value}) into a number`); }; export const coerceBoolean = (value: unknown): boolean => { diff --git a/tests/api-resources/agent/agent.test.ts b/tests/api-resources/agent/agent.test.ts index afe70d8..5870223 100644 --- a/tests/api-resources/agent/agent.test.ts +++ b/tests/api-resources/agent/agent.test.ts @@ -1,8 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import WarpAPI from 'oz-agent-sdk'; +import OzAPI from 'oz-agent-sdk'; -const client = new WarpAPI({ +const client = new OzAPI({ apiKey: 'My API Key', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); @@ -32,7 +32,7 @@ describe('resource agent', () => { }, { path: '/_stainless_unknown_path' }, ), - ).rejects.toThrow(WarpAPI.NotFoundError); + ).rejects.toThrow(OzAPI.NotFoundError); }); // Prism tests are disabled diff --git a/tests/api-resources/agent/runs.test.ts b/tests/api-resources/agent/runs.test.ts index 302865a..efa28c3 100644 --- a/tests/api-resources/agent/runs.test.ts +++ b/tests/api-resources/agent/runs.test.ts @@ -1,8 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import WarpAPI from 'oz-agent-sdk'; +import OzAPI from 'oz-agent-sdk'; -const client = new WarpAPI({ +const client = new OzAPI({ apiKey: 'My API Key', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); @@ -57,7 +57,7 @@ describe('resource runs', () => { }, { path: '/_stainless_unknown_path' }, ), - ).rejects.toThrow(WarpAPI.NotFoundError); + ).rejects.toThrow(OzAPI.NotFoundError); }); // Prism tests are disabled diff --git a/tests/api-resources/agent/schedules.test.ts b/tests/api-resources/agent/schedules.test.ts index ca5b3b4..ea36bce 100644 --- a/tests/api-resources/agent/schedules.test.ts +++ b/tests/api-resources/agent/schedules.test.ts @@ -1,8 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import WarpAPI from 'oz-agent-sdk'; +import OzAPI from 'oz-agent-sdk'; -const client = new WarpAPI({ +const client = new OzAPI({ apiKey: 'My API Key', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/index.test.ts b/tests/index.test.ts index 692a397..84f2586 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -3,7 +3,7 @@ import { APIPromise } from 'oz-agent-sdk/core/api-promise'; import util from 'node:util'; -import WarpAPI from 'oz-agent-sdk'; +import OzAPI from 'oz-agent-sdk'; import { APIUserAbortError } from 'oz-agent-sdk'; const defaultFetch = fetch; @@ -20,7 +20,7 @@ describe('instantiate client', () => { }); describe('defaultHeaders', () => { - const client = new WarpAPI({ + const client = new OzAPI({ baseURL: 'http://localhost:5000/', defaultHeaders: { 'X-My-Default-Header': '2' }, apiKey: 'My API Key', @@ -54,14 +54,14 @@ describe('instantiate client', () => { beforeEach(() => { process.env = { ...env }; - process.env['WARP_API_LOG'] = undefined; + process.env['OZ_API_LOG'] = undefined; }); afterEach(() => { process.env = env; }); - const forceAPIResponseForClient = async (client: WarpAPI) => { + const forceAPIResponseForClient = async (client: OzAPI) => { await new APIPromise( client, Promise.resolve({ @@ -87,7 +87,7 @@ describe('instantiate client', () => { error: jest.fn(), }; - const client = new WarpAPI({ + const client = new OzAPI({ logger: logger, logLevel: 'debug', apiKey: 'My API Key', @@ -98,7 +98,7 @@ describe('instantiate client', () => { }); test('default logLevel is warn', async () => { - const client = new WarpAPI({ apiKey: 'My API Key' }); + const client = new OzAPI({ apiKey: 'My API Key' }); expect(client.logLevel).toBe('warn'); }); @@ -111,7 +111,7 @@ describe('instantiate client', () => { error: jest.fn(), }; - const client = new WarpAPI({ + const client = new OzAPI({ logger: logger, logLevel: 'info', apiKey: 'My API Key', @@ -130,8 +130,8 @@ describe('instantiate client', () => { error: jest.fn(), }; - process.env['WARP_API_LOG'] = 'debug'; - const client = new WarpAPI({ logger: logger, apiKey: 'My API Key' }); + process.env['OZ_API_LOG'] = 'debug'; + const client = new OzAPI({ logger: logger, apiKey: 'My API Key' }); expect(client.logLevel).toBe('debug'); await forceAPIResponseForClient(client); @@ -147,11 +147,11 @@ describe('instantiate client', () => { error: jest.fn(), }; - process.env['WARP_API_LOG'] = 'not a log level'; - const client = new WarpAPI({ logger: logger, apiKey: 'My API Key' }); + process.env['OZ_API_LOG'] = 'not a log level'; + const client = new OzAPI({ logger: logger, apiKey: 'My API Key' }); expect(client.logLevel).toBe('warn'); expect(warnMock).toHaveBeenCalledWith( - 'process.env[\'WARP_API_LOG\'] was set to "not a log level", expected one of ["off","error","warn","info","debug"]', + 'process.env[\'OZ_API_LOG\'] was set to "not a log level", expected one of ["off","error","warn","info","debug"]', ); }); @@ -164,8 +164,8 @@ describe('instantiate client', () => { error: jest.fn(), }; - process.env['WARP_API_LOG'] = 'debug'; - const client = new WarpAPI({ + process.env['OZ_API_LOG'] = 'debug'; + const client = new OzAPI({ logger: logger, logLevel: 'off', apiKey: 'My API Key', @@ -184,8 +184,8 @@ describe('instantiate client', () => { error: jest.fn(), }; - process.env['WARP_API_LOG'] = 'not a log level'; - const client = new WarpAPI({ + process.env['OZ_API_LOG'] = 'not a log level'; + const client = new OzAPI({ logger: logger, logLevel: 'debug', apiKey: 'My API Key', @@ -197,7 +197,7 @@ describe('instantiate client', () => { describe('defaultQuery', () => { test('with null query params given', () => { - const client = new WarpAPI({ + const client = new OzAPI({ baseURL: 'http://localhost:5000/', defaultQuery: { apiVersion: 'foo' }, apiKey: 'My API Key', @@ -206,7 +206,7 @@ describe('instantiate client', () => { }); test('multiple default query params', () => { - const client = new WarpAPI({ + const client = new OzAPI({ baseURL: 'http://localhost:5000/', defaultQuery: { apiVersion: 'foo', hello: 'world' }, apiKey: 'My API Key', @@ -215,7 +215,7 @@ describe('instantiate client', () => { }); test('overriding with `undefined`', () => { - const client = new WarpAPI({ + const client = new OzAPI({ baseURL: 'http://localhost:5000/', defaultQuery: { hello: 'world' }, apiKey: 'My API Key', @@ -225,7 +225,7 @@ describe('instantiate client', () => { }); test('custom fetch', async () => { - const client = new WarpAPI({ + const client = new OzAPI({ baseURL: 'http://localhost:5000/', apiKey: 'My API Key', fetch: (url) => { @@ -243,7 +243,7 @@ describe('instantiate client', () => { test('explicit global fetch', async () => { // make sure the global fetch type is assignable to our Fetch type - const client = new WarpAPI({ + const client = new OzAPI({ baseURL: 'http://localhost:5000/', apiKey: 'My API Key', fetch: defaultFetch, @@ -251,7 +251,7 @@ describe('instantiate client', () => { }); test('custom signal', async () => { - const client = new WarpAPI({ + const client = new OzAPI({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', apiKey: 'My API Key', fetch: (...args) => { @@ -283,7 +283,7 @@ describe('instantiate client', () => { return new Response(JSON.stringify({}), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new WarpAPI({ + const client = new OzAPI({ baseURL: 'http://localhost:5000/', apiKey: 'My API Key', fetch: testFetch, @@ -295,59 +295,59 @@ describe('instantiate client', () => { describe('baseUrl', () => { test('trailing slash', () => { - const client = new WarpAPI({ baseURL: 'http://localhost:5000/custom/path/', apiKey: 'My API Key' }); + const client = new OzAPI({ baseURL: 'http://localhost:5000/custom/path/', apiKey: 'My API Key' }); expect(client.buildURL('/foo', null)).toEqual('http://localhost:5000/custom/path/foo'); }); test('no trailing slash', () => { - const client = new WarpAPI({ baseURL: 'http://localhost:5000/custom/path', apiKey: 'My API Key' }); + const client = new OzAPI({ baseURL: 'http://localhost:5000/custom/path', apiKey: 'My API Key' }); expect(client.buildURL('/foo', null)).toEqual('http://localhost:5000/custom/path/foo'); }); afterEach(() => { - process.env['WARP_API_BASE_URL'] = undefined; + process.env['OZ_API_BASE_URL'] = undefined; }); test('explicit option', () => { - const client = new WarpAPI({ baseURL: 'https://example.com', apiKey: 'My API Key' }); + const client = new OzAPI({ baseURL: 'https://example.com', apiKey: 'My API Key' }); expect(client.baseURL).toEqual('https://example.com'); }); test('env variable', () => { - process.env['WARP_API_BASE_URL'] = 'https://example.com/from_env'; - const client = new WarpAPI({ apiKey: 'My API Key' }); + process.env['OZ_API_BASE_URL'] = 'https://example.com/from_env'; + const client = new OzAPI({ apiKey: 'My API Key' }); expect(client.baseURL).toEqual('https://example.com/from_env'); }); test('empty env variable', () => { - process.env['WARP_API_BASE_URL'] = ''; // empty - const client = new WarpAPI({ apiKey: 'My API Key' }); + process.env['OZ_API_BASE_URL'] = ''; // empty + const client = new OzAPI({ apiKey: 'My API Key' }); expect(client.baseURL).toEqual('https://app.warp.dev/api/v1'); }); test('blank env variable', () => { - process.env['WARP_API_BASE_URL'] = ' '; // blank - const client = new WarpAPI({ apiKey: 'My API Key' }); + process.env['OZ_API_BASE_URL'] = ' '; // blank + const client = new OzAPI({ apiKey: 'My API Key' }); expect(client.baseURL).toEqual('https://app.warp.dev/api/v1'); }); test('in request options', () => { - const client = new WarpAPI({ apiKey: 'My API Key' }); + const client = new OzAPI({ apiKey: 'My API Key' }); expect(client.buildURL('/foo', null, 'http://localhost:5000/option')).toEqual( 'http://localhost:5000/option/foo', ); }); test('in request options overridden by client options', () => { - const client = new WarpAPI({ apiKey: 'My API Key', baseURL: 'http://localhost:5000/client' }); + const client = new OzAPI({ apiKey: 'My API Key', baseURL: 'http://localhost:5000/client' }); expect(client.buildURL('/foo', null, 'http://localhost:5000/option')).toEqual( 'http://localhost:5000/client/foo', ); }); test('in request options overridden by env variable', () => { - process.env['WARP_API_BASE_URL'] = 'http://localhost:5000/env'; - const client = new WarpAPI({ apiKey: 'My API Key' }); + process.env['OZ_API_BASE_URL'] = 'http://localhost:5000/env'; + const client = new OzAPI({ apiKey: 'My API Key' }); expect(client.buildURL('/foo', null, 'http://localhost:5000/option')).toEqual( 'http://localhost:5000/env/foo', ); @@ -355,17 +355,17 @@ describe('instantiate client', () => { }); test('maxRetries option is correctly set', () => { - const client = new WarpAPI({ maxRetries: 4, apiKey: 'My API Key' }); + const client = new OzAPI({ maxRetries: 4, apiKey: 'My API Key' }); expect(client.maxRetries).toEqual(4); // default - const client2 = new WarpAPI({ apiKey: 'My API Key' }); + const client2 = new OzAPI({ apiKey: 'My API Key' }); expect(client2.maxRetries).toEqual(2); }); describe('withOptions', () => { test('creates a new client with overridden options', async () => { - const client = new WarpAPI({ + const client = new OzAPI({ baseURL: 'http://localhost:5000/', maxRetries: 3, apiKey: 'My API Key', @@ -390,7 +390,7 @@ describe('instantiate client', () => { }); test('inherits options from the parent client', async () => { - const client = new WarpAPI({ + const client = new OzAPI({ baseURL: 'http://localhost:5000/', defaultHeaders: { 'X-Test-Header': 'test-value' }, defaultQuery: { 'test-param': 'test-value' }, @@ -409,7 +409,7 @@ describe('instantiate client', () => { }); test('respects runtime property changes when creating new client', () => { - const client = new WarpAPI({ + const client = new OzAPI({ baseURL: 'http://localhost:5000/', timeout: 1000, apiKey: 'My API Key', @@ -442,20 +442,20 @@ describe('instantiate client', () => { test('with environment variable arguments', () => { // set options via env var process.env['WARP_API_KEY'] = 'My API Key'; - const client = new WarpAPI(); + const client = new OzAPI(); expect(client.apiKey).toBe('My API Key'); }); test('with overridden environment variable arguments', () => { // set options via env var process.env['WARP_API_KEY'] = 'another My API Key'; - const client = new WarpAPI({ apiKey: 'My API Key' }); + const client = new OzAPI({ apiKey: 'My API Key' }); expect(client.apiKey).toBe('My API Key'); }); }); describe('request building', () => { - const client = new WarpAPI({ apiKey: 'My API Key' }); + const client = new OzAPI({ apiKey: 'My API Key' }); describe('custom headers', () => { test('handles undefined', async () => { @@ -474,7 +474,7 @@ describe('request building', () => { }); describe('default encoder', () => { - const client = new WarpAPI({ apiKey: 'My API Key' }); + const client = new OzAPI({ apiKey: 'My API Key' }); class Serializable { toJSON() { @@ -559,7 +559,7 @@ describe('retries', () => { return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new WarpAPI({ + const client = new OzAPI({ apiKey: 'My API Key', timeout: 10, fetch: testFetch, @@ -593,7 +593,7 @@ describe('retries', () => { return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new WarpAPI({ + const client = new OzAPI({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4, @@ -621,7 +621,7 @@ describe('retries', () => { capturedRequest = init; return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new WarpAPI({ + const client = new OzAPI({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4, @@ -654,7 +654,7 @@ describe('retries', () => { capturedRequest = init; return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new WarpAPI({ + const client = new OzAPI({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4, @@ -687,7 +687,7 @@ describe('retries', () => { capturedRequest = init; return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new WarpAPI({ + const client = new OzAPI({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4, @@ -721,7 +721,7 @@ describe('retries', () => { return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new WarpAPI({ apiKey: 'My API Key', fetch: testFetch }); + const client = new OzAPI({ apiKey: 'My API Key', fetch: testFetch }); expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 }); expect(count).toEqual(2); @@ -751,7 +751,7 @@ describe('retries', () => { return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new WarpAPI({ apiKey: 'My API Key', fetch: testFetch }); + const client = new OzAPI({ apiKey: 'My API Key', fetch: testFetch }); expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 }); expect(count).toEqual(2); diff --git a/tests/stringifyQuery.test.ts b/tests/stringifyQuery.test.ts index dbd4bdc..3eb6667 100644 --- a/tests/stringifyQuery.test.ts +++ b/tests/stringifyQuery.test.ts @@ -1,8 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { WarpAPI } from 'oz-agent-sdk'; +import { OzAPI } from 'oz-agent-sdk'; -const { stringifyQuery } = WarpAPI.prototype as any; +const { stringifyQuery } = OzAPI.prototype as any; describe(stringifyQuery, () => { for (const [input, expected] of [ From 14a7cc8d1067efd7942f4efce5b61b54bead94b3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 8 Feb 2026 16:26:12 +0000 Subject: [PATCH 2/2] release: 1.0.0-alpha.8 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ package.json | 2 +- src/version.ts | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 77c7211..2e2ea5f 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.0.0-alpha.7" + ".": "1.0.0-alpha.8" } diff --git a/CHANGELOG.md b/CHANGELOG.md index cb2c2c4..4f0a3e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.0.0-alpha.8 (2026-02-08) + +Full Changelog: [v1.0.0-alpha.7...v1.0.0-alpha.8](https://github.com/warpdotdev/oz-sdk-typescript/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) + +### Features + +* **api:** manual updates ([51bba74](https://github.com/warpdotdev/oz-sdk-typescript/commit/51bba74cf406ac231d328f5d084788a9902e478f)) + ## 1.0.0-alpha.7 (2026-02-08) Full Changelog: [v1.0.0-alpha.6...v1.0.0-alpha.7](https://github.com/warpdotdev/oz-sdk-typescript/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) diff --git a/package.json b/package.json index b6148a9..f2d3b28 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oz-agent-sdk", - "version": "1.0.0-alpha.7", + "version": "1.0.0-alpha.8", "description": "The official TypeScript library for the Oz API API", "author": "Oz API <>", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 49faf26..0d4128f 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '1.0.0-alpha.7'; // x-release-please-version +export const VERSION = '1.0.0-alpha.8'; // x-release-please-version