# Changelog

All notable changes to `@railx/sdk` are recorded here. The package follows semantic versioning and targets the public RailX V0 API documented at [railx.dev/docs](https://railx.dev/docs).

## 0.6.3 — 2026-09-13

Targets API `v0`.

### Documentation

- Improve npm search metadata with exact Stock Token, tokenized-stock, Robinhood Chain, TypeScript, RWA, trading API, and AI-agent terms.
- Add common integration use cases and a direct path from the SDK to the official MCP server.
- Add the public issue tracker to package metadata.

## 0.6.2 — 2026-09-12

Targets API `v0`.

### Fixed

- Preserve structured timeout and cancellation errors while reading response bodies, including safe timeout retries.
- Reject malformed success envelopes instead of returning undefined data.
- Require a finite, non-negative integer retry count.
- Correct the Node.js requirement to 20.3 or newer for combined timeout and cancellation signals.
- Include source files so published source maps resolve within the package.

### Documentation

- Align the introduction with the public Stock Tokens message and explain all three plan verdicts, policy configuration, and caller-supplied idempotency keys.

## 0.6.1

Targets API `v0`.

### Documentation

- Corrected the trade-plan example to read `plan.signing.unsignedTransactions`.
- Made the first trade example runnable with a test key and the funded sandbox fixture wallet.
- Aligned the README with the RailX Stock Token infrastructure positioning.

Runtime behavior and the API contract are unchanged.

## 0.6.0

Targets API `v0`.

### Added

- Added a 30-second default request timeout with client-level and per-request overrides.
- Added per-request `AbortSignal` support across every SDK method.
- Added structured `REQUEST_TIMEOUT` and `REQUEST_ABORTED` errors.
- Published the SDK's behavioral test suite in the public source repository.

### Changed

- Rewrote the public README around installation, the first trade, the sandbox, and the SDK's safety behavior.
- Made the public quality and release workflows run the test suite before packaging or publishing.

## 0.5.1

Targets API `v0`.

### Changed

- Reissued the SDK from a clean, RailX-authored public repository history with verified npm provenance.

## 0.5.0

Targets API `v0`.

### Added

- Added human-readable and base-unit maximum-input and minimum-output bounds to every quote and trade plan.

## 0.4.1

Targets API `v0`.

### Changed

- Moved the public source repository to the dedicated RailX identity at `railxdev/sdk`.
- Made the SDK TypeScript configuration standalone so the public repository builds independently from the private product monorepo.

## 0.4.0

Targets API `v0`. This is the first public release under the final RailX package identity.

### Changed

- Adopted the final `@railx/sdk` package identity.
- Renamed the public client to `RailXClient`, its options and response metadata types to `RailXClientOptions` and `RailXResponseInfo`, and structured failures to `RailXApiError`.
- Switched project-key examples and response metadata to `railx_test_`, `railx_live_`, and `x-railx-*`.

### Migration

Replace imports from `@rail/markets` with `@railx/sdk`, instantiate `RailXClient`, and update any direct header reads to the `x-railx-*` names. Previously issued project keys remain accepted by the V0 server during the preview migration.

## 0.3.0

Targets API `v0`. Not yet published to a registry.

### Added

- Corporate-action list types and `client.corporateActions.list()` with symbol, type, status, and limit filters.
- Explicit `exact_input` and `exact_output` trade intents for quotes and plans.
- Human-readable and base-unit output amounts on normalized quotes.
- Explainable `allow`, `warn`, and `block` trade-plan verdict types, including the immutable project-policy version and structured safety or policy checks.

### Compatibility

- The legacy V0 exact-input request remains accepted. New integrations should use the discriminated `intent` shape.
- Existing plan calls require no client change. A blocked plan contains no steps or unsigned transactions; a warning uses `review_required` and keeps its transactions for human review.

## 0.2.0

Targets API `v0`. Not yet published to a registry.

### Added

- `types.ts` as the single source of the wire contract, shared with the server and exported from the package root and from `@railx/sdk/types`.
- Full typed responses for every endpoint: `AssetList`, `CanonicalAsset`, `PriceObservation`, `Portfolio`, `Quote`, `TradePlan`, `SimulationResult`, `HealthReport`, and `ApiIndex`.
- `system.index()` and `system.health()`.
- `scenario` option to force a sandbox scenario on test keys via `x-railx-scenario`.
- `retries` option: safe GET requests are retried on retryable errors, honoring `Retry-After`. POST requests are never retried.
- `client.lastResponse` with request ID, environment, plan, sandbox flag, minute-limit, and monthly-allowance metadata from the most recent response.
- `readResponseInfo(response)` helper.
- `API_VERSION` and `SDK_VERSION` constants.

### Changed

- Non-JSON responses now produce a `RailXApiError` with code `API_ERROR` instead of a raw parse failure.

## 0.1.0

Initial repository-local client with `assets`, `prices`, `portfolios`, `quotes`, `trades`, and `transactions` groups and structured `RailXApiError`.
