# Changelog

## 0.13.0 (2026-11-20)

- Custom objective `key`s are validated before the scan is sent: 1-128 characters of letters, digits, `.`, `_`, `:` or `-`, and unique within the scan. A key that breaks these rules fails `createScan` with an error instead of starting a scan. A key equal to a predefined objective ID fails `createScan` with a 400 error.
- **Breaking:** `CustomObjective.categoryId` is removed. The backend always filed custom objectives under the Custom category, so the field had no effect.
- `createScan` rejects a custom objective whose `name` is blank or longer than 200 characters, or whose `additionalContext` is longer than 1500 characters. The server applies the same limits, which match the dashboard.
- Add `severity` and `additionalContext` to the `CustomObjective` type in `api-surface.yaml`, matching the client types.
- Add custom datasets. `uploadDataset` uploads a dataset of scripted conversations from a CSV file in the dataset template's format or from a list of tests, with an optional `description` shown in scan results, `listDatasets` lists the datasets the API key reaches, `getDataset` gets one, `updateDataset` renames one and `deleteDataset` deletes one. Renaming and deleting need the API key's user to be the dataset's creator, with write access to its folder, or a folder admin. Uploading to a folder-scoped key's folder needs write access to that folder. Listing, getting and scanning a dataset need the API key's user to have a role in its folder. A dataset's tests can't be changed after upload. Tests with the same `conversationId` form one conversation. Pass the dataset's id as `createScan`'s `datasetId` to send each conversation's prompts once, unchanged and in order, in its own session, and judge it as a prompt injection attempt. Each result's `conversationId` names the conversation it ran. A dataset can't be deleted while a scan using it is unfinished.
- Add `runsWithDirectAttacks` and `runsWithIndirectAttacks` to custom objectives. Set one to `false` to skip the objective for that attack mode. Direct covers `static` and `crescendo`, and indirect covers `tool-response-poisoning`. Unset runs the objective in every mode. Setting both to `false` is rejected. `createScan` rejects an objective that the chosen strategy excludes.
- The built-in Safety, Security, and Responsible objectives now run only in direct attacks. `createScan` rejects them for `tool-response-poisoning`.
- Add `singleTurn` to `createOrGetTarget` and `updateTarget`, and `Target.singleTurn`. Set it for an agent that keeps no conversation state between calls. `static` scans then send one prompt per session, and `createScan` fails with a 400 error for `crescendo` and `tool-response-poisoning`, which need more than one turn. The flag is stored on the target.

## 0.12.0 (2026-10-19)

- Add agent threat modeling. `inferTopology` infers a target's topology from its ground truth and assesses it for weaknesses, and `generateObjectives` generates an attack objective per weakness, whose `key`s can be passed to `createScan`. Both run server-side and return once done, typically within seconds. `getTopology` and `getGeneratedObjectives` read the stored results. Requires agent threat modeling to be enabled for the account.

## 0.11.0 (2026-10-05)

- **Breaking:** `session.setConversationId` is renamed to `session.setSessionId`, and the `conversationId` option of `interceptTool` to `sessionId`. `setSessionId` binds the scan session to your own session id, so activity reported by `interceptTool` joins the scan.
- Add `session.relaySessionId`, Red's id for the relay session. `session.id` stays as a deprecated alias.
- Add `session.sessionId`, which reads back the id set with `session.setSessionId` (`undefined` until set).
- Support the `tool-response-poisoning` strategy. It tests indirect prompt injection: a benign request leads your agent to call a tool, and Red plants malicious content in the result `interceptTool` returns. `interceptTool` returns your real result outside these scans. This is the first version that can run them.

## 0.10.0 (2026-10-02)

- Add `responseTimeoutSeconds` to `createOrGetTarget` and `updateTarget`. It sets how long Red waits for your handler to answer each prompt sent to that target, in whole seconds from 1 to 480 (8 minutes). Targets without it use the default, now 300 seconds (5 minutes) instead of 295.
- Fix scans and recon stopping early against slow targets. The SDK stopped polling after 3 minutes without a new message, even while it was still waiting on the target's reply, so later turns were never delivered and timed out. The idle timeout now only counts time with no message in flight.
- Add `SessionMessage.signal`, an `AbortSignal` that aborts when Red stops waiting for that reply. Pass it to the calls that produce the reply so they stop too. A reply sent after that is dropped, the session ends, and `scan.run()` no longer waits for a handler that never returns.
- Add tool tracing. `interceptTool` reports each tool call and its result to Red during a scan (observe-only — it returns the result unchanged), and `session.setConversationId` binds the scan session to your conversation id so the reported activity joins the scan. Off unless `LAKERA_RED_TOOL_INTERCEPT` is set.

## 0.9.0 (2026-09-03)

- `ScanResultEntry.evaluation` is now typed (`Evaluation`: `attackSuccessIndicator`, `attackSuccessScore` 0–5, `explanation`) instead of `unknown`, so callers can apply their own success thresholds.
- Add `ScanResultEntry.isSuccessful` — server-computed verdict at the platform's default success threshold, matching the dashboard.

## 0.8.0 (2026-08-14)

- `scan.dashboardLink` now reflects the API key's platform: scans created with a Check Point Infinity Portal key link to `https://portal.checkpoint.com/dashboard/airedteaming#/scans/<scanId>`, while other keys continue to link to `https://red.lakera.ai`. The link is built server-side and returned by the backend.

## 0.7.0 (2026-07-27)

- **Breaking:** The recon profile now lives on the target. Pass `appContext` (or `appContextFile`) to `createOrGetTarget`, or omit it and pass a handler to run recon once at target creation. `createScan` no longer takes `appContext`/`appContextFile` — it references the target by name and reuses its stored profile.
- **Breaking:** `createTarget` is renamed to `createOrGetTarget` to reflect that it reuses an existing relay target with the same name instead of always creating a new one.

## 0.6.0 (2026-07-22)

- **Breaking:** `ReconContext.allowedActions` and `forbiddenActions` are now `string[]` (previously `string`). The lists are joined into a newline-separated string before being sent. Applies to both `appContext` and `appContextFile` (YAML) inputs.

## 0.5.0 (2026-07-09)

- Add `customObjectives` to `CreateScanOptions` — pass fully-defined inline objectives without prior catalog writes. Custom objectives can be combined with `objectives` (standard IDs) in the same scan.
- Add `language` to `CreateScanOptions` — specify the language for attack generation (e.g. `"fr"`, `"de"`). Defaults to `"en"` if omitted.

## 0.4.0 (2026-06-19)

- Add `getDashboardLink` helper — returns the Lakera Red dashboard URL for a scan.

## 0.3.0 (2026-06-03)

- Retry HTTP 429 responses in `fetchWithRetry` with exponential back-off.
- Add relay API support and contract tests.

## 0.2.0 (2026-05-22)

- Add examples helper (`npx lakera-red-sdk`) with `init-examples` and `list-examples` to copy bundled examples into your project
- Logging improvements

## 0.1.0 (2026-05-18)

- Initial release of Lakera Red SDK.
