@hunt-labs/bytekit-mcp 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,19 @@ today, see [README.md](./README.md), which remains the authoritative usage guide
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.2.8] - 2026-08-19
14
+
15
+ ### Changed
16
+
17
+ - **The generated scrape contract's billing factor vocabulary gained `phase1_render`** (#3141).
18
+ `BillingFactorName` is a closed union copied verbatim into `src/scrape-contract.generated.ts`,
19
+ and screenshots and recordings bill on a basis the byte-scrape factors cannot name — Phase 1
20
+ proxy wire bytes times a 1.5 render-overhead multiplier. A capture's billing node carries that
21
+ one factor and none of the byte-scrape names; the two vocabularies never mix on a single node.
22
+ This release is a regeneration of the checked-in contract only, with no behavior change in the
23
+ server itself: the MCP tools do not call the capture endpoints whose responses now carry the
24
+ node.
25
+
13
26
  ## [0.2.7] - 2026-08-18
14
27
 
15
28
  ### Changed
@@ -272,7 +272,7 @@
272
272
  "changelog": {
273
273
  "title": "Changelog",
274
274
  "section": "General",
275
- "body": "# Changelog\n\nRelease history for the ByteKit API and SDKs\n\n_No releases yet. Check back after the first version ships._"
275
+ "body": "# Changelog\n\nRelease history for the ByteKit SDKs, CLI, and MCP server\n\nEach section below is the `CHANGELOG.md` kept alongside that client’s source in the ByteKit\nrepository. Entries record what a release changed, including names and options it retired.\n\n## @hunt-labs/bytekit-sdk\n\nTypeScript SDK, published on npm.\n\n### [Unreleased]\n\n### [0.8.0] - 2026-08-19\n\n#### Removed\n\n- **BREAKING: `billing_multiplier` and `billed_bytes` are gone from the scrape success\n envelope** (#3143). Read `billing` instead — a `BillingNode` that names every factor\n applied to the charge, the multiplier they compose to, and the resulting billed bytes:\n\n ```ts\n // before\n const spend = res.billed_bytes; // flat, base-endpoint only\n // after\n const spend = res.billing?.billed_bytes;\n const why = res.billing?.factors; // [{ name: 'endpoint', value: 1.5, reason: 'scrape_md' }, …]\n ```\n\n This is a correction, not a rename: the two surfaces reported **different numbers for the\n same charge**. The flat pair carried the BASE-endpoint composition, so a markdown cache hit\n read `0.5` / `400` while the real charge — and the `X-Billing-Multiplier` header — was\n `0.75` / `600`; an html-only miss read the per-format credits estimate `1.5` / `150` against\n an endpoint factor of `1.0` / `100`. The flat pair also never carried the `clean_markdown`\n ×3 surcharge, so on a successful clean it under-reported the amount billed by two thirds.\n `billing.multiplier` composes every applied factor behind exactly one rounding, so it is the\n number that predicts your invoice.\n\n `billing` is optional and is **absent** on resources that completed before the billing node\n existed. A pre-node row omits the field rather than reporting a zero node, because a zero\n node would assert that a real past charge was zero. Test the node for presence\n (`res.billing !== undefined`, or equivalently a plain truthiness check — `billing` is an\n object or `undefined`, and an object is always truthy, so the two are the same test here).\n The hazard is a condition that reaches _into_ the node: `if (res.billing?.billed_bytes)`\n silently skips a genuine zero-byte charge, because `0` is falsy. Check that the node is\n present, then read `billed_bytes` from it.\n\n ```ts\n // wrong — a real 0-byte charge is falsy and disappears\n if (res.billing?.billed_bytes) record(res.billing.billed_bytes);\n // right — presence first, value second\n if (res.billing) record(res.billing.billed_bytes); // 0 is a charge, not an absence\n ```\n\n Two endpoints deliberately carry no node: `/v1/search` is billed per credit and reports\n `credits_used`, and a single `/v1/fetch` reports its charge through response headers only.\n The `/v1/logs` row field named `billing_multiplier` is a **different field** and is not the\n envelope field this release removed. It carries the BASE settled `credits_charged` factor,\n not the composed real-endpoint value the `X-Billing-Multiplier` header reports — a markdown\n cache hit reads `0.5` on the logs row and `0.75` on the header.\n\n#### Changed\n\n- Generated `ScrapeErrorEnvelope` types now describe terminal asynchronous `scrape.failed`\n webhook delivery (#1856). No runtime SDK behavior or API shape changed.\n\n#### Fixed\n\n- **`GET /v1/logs` entries now carry `billing_multiplier`, as a JSON number** (#3022). The\n gateway had been serializing that value under an undeclared key `credits`, and as the raw\n Postgres `NUMERIC(10,2)` string (`\"1.50\"`), while the OpenAPI spec — and therefore the\n generated types in `src/generated/api.d.ts` — declared `billing_multiplier?: number | null`.\n Anything typed against this package read `undefined` for the field.\n\n **Breaking at the wire level:** the undeclared `credits` key is gone from every `/v1/logs`\n entry. Code that reached past the generated types to read `credits` must read\n `billing_multiplier`. No SDK method exposes this endpoint, so the only change inside this\n package is the regenerated type description.\n\n- **`change_threshold` (on `monitors.create`/`monitors.list`/`monitors.get`/\n `monitors.update` responses) and `change_pct` (on `monitors.captures.list` entries)\n now serialize as JSON numbers, not strings** (#3021). Both are Postgres `NUMERIC(5,2)`\n columns; the gateway passed the raw driver string through unconverted (`\"5.00\"` /\n `\"7.25\"`) while the OpenAPI spec's _request_ schemas already declared `number` — only\n the _response_ schemas had been (incorrectly) edited to match the buggy string output.\n This release fixes the gateway serializer and corrects the two response schemas to\n `number` / `number | null`, so spec and runtime now agree.\n\n **Breaking at the wire level:** `client.monitors.create()`, `client.monitors.list()`,\n `client.monitors.get()`, and `client.monitors.update()` now return a JS number for\n `change_threshold` instead of a string (screenshot-type monitors only); the create\n response's `MonitorCreateResponse` and every other monitor route serialize through the\n same `MonitorResponse` schema, so all four are affected identically.\n `client.monitors.captures.list()` now returns a JS number for `change_pct` instead of a\n string. Code doing `parseFloat(monitor.change_threshold)` or template-literal\n interpolation keeps working; strict `typeof x === 'string'` checks or string methods\n (`.trim()`, `.padStart()`) will now throw. `change_pct` is `null` (not `0`) when there is\n no prior capture to diff against, unchanged from before. No SDK method-level shape\n changed otherwise — the only change inside this package is the regenerated type\n description.\n\n### [0.7.4] - 2026-08-19\n\n#### Changed\n\n- **`gen:version` no longer runs as part of `build`** (#3144). `scripts/gen-version.ts` writes\n `src/version.ts`, a _tracked_ source file, and it was chained into the `build` script. That made\n a build silently rewrite committed source whenever the file disagreed with the manifest: local\n runs went green on a tree CI could fail, the resulting ` M src/version.ts` was indistinguishable\n from routine build noise, and in CI the outcome depended on whether Turbo's build cache hit\n (restoring `dist/**` without re-running the generator) or missed. `build` now starts at\n `rm -rf dist ...`, so building this package touches nothing tracked. This changes `prepack` /\n `prepublishOnly` behavior too: both call `build`, so the publish path now reads the committed\n `src/version.ts` rather than regenerating it, and the committed value is what ships.\n- **New `gen:version-check` script**, `pnpm gen:version && git diff --exit-code src/version.ts`,\n mirroring the existing `gen:types-check` in the same manifest. It runs in `.woodpecker/ci.yaml`'s\n `types-drift` step, so a manifest bump without the matching `src/version.ts` regeneration now\n fails a named PR check instead of reaching `staging`. `src/__tests__/version-parity.test.ts`\n stays in place as the in-suite assertion; the gate is what makes its failure reachable before\n merge rather than after.\n\nNo runtime or type changes. `SDK_VERSION` and the `X-ByteKit-Client: sdk_ts/<version>` affix\nbehave exactly as before.\n\n### [0.7.3] - 2026-08-18\n\n#### Changed\n\n- **`XFetchContentLength`'s description no longer calls the header a wire-byte count** (#3133).\n `X-Fetch-Content-Length` is the byte length of the response body actually served: on a\n passthrough `/v1/fetch` (no `format`) that is the relayed upstream payload, so it does equal\n the upstream wire bytes — but with `format=html` or `format=markdown` the gateway overwrites\n it with the transformed document's length, which is typically far smaller than what is billed.\n The old description therefore read as a billing discrepancy on every transform request. Billing\n is unchanged and has always used the upstream compressed wire bytes reported by `X-Raw-Bytes` /\n `X-Billable-Bytes`. Generated-type comments only; no type or runtime behavior changes.\n\n### [0.7.2] - 2026-08-17\n\n#### Changed\n\n- **`ScrapeResponses.202`'s headers no longer advertise `X-Raw-Bytes`, `X-Billable-Bytes`, or\n `X-Billing-Multiplier`** (#3068). The gateway's async `/v1/scrape` path only ever emitted\n `X-Scrape-ID` and `X-Scrape-Status: queued` on a 202 — a queued scrape has no finalized byte\n charge yet — but `docs/api/openapi.yaml` documented the billing-transparency trio there too,\n so `src/generated/api.d.ts` typed three response headers the runtime never sends. This corrects\n the generated type to match the gateway's actual behavior; it does not change any runtime\n behavior. The synchronous `200` response, and `/v1/screenshots`' `202` (which does finalize a\n charge before responding), are unaffected.\n\n### [0.7.1] - 2026-08-11\n\n#### Changed\n\n- **Generated types follow the spec's corrected error and format vocabularies** (#2959). Two\n vocabulary corrections in `docs/api/openapi.yaml` flow through `src/generated/api.d.ts`:\n - `ScrapeErrorEnvelope.error.code` no longer lists `quota_exhausted`. The API has emitted\n `quota_exceeded` since #1539 and there is no throw site for `quota_exhausted` anywhere in\n the gateway, so this removes a code that has never been sent — not one that stops being\n sent. A consumer switching on it was matching a branch that could not be reached; the\n live code for an exceeded quota is `quota_exceeded`. `invalid_url`, which the API does\n emit, is unchanged and still listed.\n - `createBulk`'s `formats` now spells the raw-HTML value `raw_html`, matching `ScrapeRequest`\n and `createScrapeBulk`. `/v1/bulk` previously accepted only the internal `rawHtml`\n spelling and the spec documented that; it now accepts both, so the one endpoint that\n disagreed with the rest of the surface no longer does. `rawHtml` keeps working.\n\n#### Added\n\n- **`ByteKitError.headers` — the failing response's headers, so you can write your own backoff**\n (#2957). This SDK performs exactly one `fetch` per call and never retries, deliberately, so that\n retry policy stays the caller's. But the policy was unwritable: `ByteKitError` carried no\n headers and `requestWithResponse` returns headers only on 2xx — which a rate-limited request\n never reaches — so `Retry-After` and the `X-RateLimit-*` family were unreachable through the SDK\n at every entry point. `err.headers` closes that:\n\n ```ts\n if (err instanceof ByteKitError && err.status === 429) {\n const waitMs = Number(err.headers?.get('Retry-After') ?? 1) * 1000;\n }\n ```\n\n It is the runtime's own `Headers` object rather than a snapshot, so `get()` stays\n case-insensitive whatever casing the wire used. **Strictly additive**: it is optional and last\n on the constructor, follows the same `declare` discipline `details` uses, and an error\n constructed without one carries no `headers` key at all — `'headers' in err`, spreads and\n `JSON.stringify` are unchanged for every pre-existing construction, as are `status`, `code`,\n `message`, `details` and both 2xx return shapes. Only **response** headers are exposed;\n `Authorization` rides on the request and is never reachable through it.\n `ByteKitConnectionError` is unchanged — no response, no headers to carry.\n\n#### Fixed\n\n- **`screenshots.getWithResponse`'s docstring no longer promises headers that endpoint never\n emits** (#2957). The JSDoc — the one an IDE surfaces on hover, and the one the published SDK\n reference is generated from — claimed the documented `X-Screenshot-*` / `X-Raw-Bytes` /\n `X-Billable-Bytes` / `X-Billing-Multiplier` headers \"are on `headers`\". They are not:\n `GET /v1/screenshots/{id}` is declared with **no** `X-*` response headers, which is what\n `ByteKit.requestWithResponse`'s own doc comment and the README have said all along, and what a\n live GET confirms. Documentation only — no signature, return type or runtime behavior changed.\n `screenshots.createWithResponse` (`POST /v1/screenshots`) really does emit that family, and its\n docstring still says so.\n\n- **README documents the `signal`-vs-`timeoutMs` precedence and the `requestTimeoutMs` escape\n hatch** (#2957). Passing your own `AbortSignal` silently disables the constructor's `timeoutMs`\n — the signal becomes the request's only abort source, so a client built with `timeoutMs: 200`\n waits indefinitely if the signal never fires. That precedence was documented on\n `RequestOptions.signal` in the types, where only a reader already inspecting the option would\n meet it, and nowhere in the README. A new \"Timeouts and cancellation\" section states it with the\n full four-row precedence table and shows `requestTimeoutMs` composed alongside a caller signal\n (the request then aborts on whichever fires first). No behavior changed — the precedence is what\n it always was.\n\n- **`ScrapeWarning.code` now carries all 12 codes the server can emit** (#2948). The generated\n union in `src/generated/api.d.ts` listed 10. `low_quality_extraction` and\n `fragment_menu_stripped` — added to the server-side emitter union by #1701 — never reached\n `docs/api/openapi.yaml`, so every regeneration since faithfully reproduced the gap and the\n exported type was non-exhaustive: a `switch` over `warning.code` that TypeScript proved\n exhaustive would silently fall through on a warning the API really returns. Widening the spec\n and regenerating fixes the type; no runtime code changed. The other 10 codes are unaffected.\n\n- **Gateway wire-type correction: `billing_multiplier` is a JSON number on `scrape.get()` again**\n (#2954). `GET /v1/scrape/{id}` (and `GET /v1/scrape/bulk/{id}` items) were serializing\n `billing_multiplier` as a JSON string (e.g. `\"0.50\"`) instead of a number — the pg driver\n returns the underlying `NUMERIC(10,2)` column as a string, and the gateway's GET serializer\n passed it through unconverted, while `POST /v1/scrape`'s create-path value (computed in JS) was\n already correct. Fixed upstream in the gateway; this SDK required no code change, only removal\n of the `KNOWN DRIFT (#2426)` JSDoc on `ScrapeResource.get()` that documented the workaround —\n the static `number` type this SDK has shipped all along is accurate again. A caller that was\n defensively coercing with `Number(...)` per the old note does not need to change anything; a\n caller relying on the exact string form `\"0.50\"` (rather than doing arithmetic) will now see\n `0.5`.\n\n#### Changed\n\n- **Alignment release — no consumer-visible change _in the alignment itself_** (the `#2948` type\n widening above is a separate, deliberate change under this same version). `0.7.0` published to npm at\n `2026-08-11T21:17:42.790Z`. Two doc comments, in `src/client.ts` and `src/version.ts`, were\n reworded **after** the commit that introduced the `0.7.0` version string — they had re-spelled\n the `X-ByteKit-Client` header name in prose, which issue #2905's pre-merge gate 1 counts. No\n exported function, type, or runtime behavior differs from `0.7.0`.\n\n This release exists because `check-release-drift` (#2680) is version-gated and anchors on the\n commit that introduced a version, not on the commit whose tree was actually published. Once\n `0.7.0` reached npm, any shipped-file change after that anchor reads as post-release drift.\n Bumping moves the anchor past those comments. The published `0.7.0` artifact is **not** stale in\n any way a consumer can observe — the divergence is comment text only.\n\n- **Corrected a false legacy-name claim carried since the rename (#2950).** The `0.7.0`-era note\n below said the prior `rapidcrawl`/`@rapidcrawl/sdk` name \"remains installable at its last\n version but is deprecated.\" Verified 2026-08-13: both `rapidcrawl` and `@rapidcrawl/sdk` return\n npm `404` (\"is not in this registry\"), and `npm deprecate` against either fails with the same\n `404` — there is no published version left for a deprecation notice to attach to, so the claim\n never held. No registry stub or deprecation was possible to publish; root `CLAUDE.md` carried\n the same false claim and is corrected alongside this entry. Users of the old names should\n install `@hunt-labs/bytekit-sdk` directly. No exported function, type, or runtime behavior\n changes.\n\n### [0.7.0] - 2026-08-11\n\n#### Added\n\n- **Every outbound request now carries `X-ByteKit-Client: sdk_ts/<version>`.** The SDK identifies\n itself with the sanctioned `client_surface` marker (issue #2905, slice 2 of #2701), so requests\n made through `@hunt-labs/bytekit-sdk` are distinguishable from raw API calls in ByteKit's own\n analytics instead of all resolving to `api_direct`. `sdk_ts` is a member of the closed\n `client_surface` vocabulary declared in issue #2904; the version affix is this package's own\n version, baked in at build time from `package.json`.\n\n Set at exactly ONE place — the header literal inside the private transport every request funnels\n through — so it rides on the JSON path, the raw `/v1/fetch` path and every resource method\n alike. **Nothing else about a request changed:** same `Authorization` and `Content-Type`, same\n body bytes, same client-side abort budget, same error taxonomy, same return shapes. The marker\n carries no caller data and cannot be set, overridden or read by callers — there is no\n `headers` option on `ByteKitOptions` or `RequestOptions`.\n\n Minor rather than patch because the wire format of every request changes, even though no\n documented API does. A gateway that does not yet recognize the header ignores it.\n\n- `SDK_VERSION` — an internal, build-time-generated constant (`src/version.ts`, written by\n `pnpm gen:version` from `package.json` and gated by `src/__tests__/version-parity.test.ts`).\n It backs the marker's version affix. **Not part of the public export surface**;\n `package.json`'s `version` field remains the only version consumers should read.\n\n#### Unchanged\n\n- **Still ZERO runtime dependencies.** The `client_surface` vocabulary lives in an internal,\n unpublished workspace package, so the emitted value is a string literal here and the binding to\n that registry is a test-only import. `dependencies` stays empty, asserted by\n `src/__tests__/package-manifest.test.ts`.\n\n### [0.6.2] - 2026-08-11 [NEVER PUBLISHED]\n\n**This version was cut but NEVER PUBLISHED — npm `latest` went from 0.6.1 straight to 0.7.0.**\nThe two documentation/regeneration changes below reached consumers in the **0.7.0** artifact,\nwhich contains all of them. Nothing under this heading is missing from 0.7.0, and nothing is\ninstallable at 0.6.2: `npm i @hunt-labs/bytekit-sdk@0.6.2` fails.\n\nWhy it was stranded: 0.6.2 was cut for two `src/generated/api.d.ts` regenerations, and the next\nchange (issue #2905's new outbound request header) altered the wire format of every request —\nadditive behavior that belongs at a MINOR, not a patch. Folding it into the still-unpublished\n0.6.2 would have shipped a new request header to consumers pinning `^0.6.1` unannounced, so 0.7.0\nwas cut instead and this heading annotated per `ci/scripts/check-release-drift.sh`'s\nreconciliation form (#2680).\n\n#### Documentation\n\n- **`AccountSessionResponse.has_activity` now documents what it actually means.** The generated\n type's JSDoc previously said the flag was true once the account had \"ever recorded billable\n activity\", which read as \"ever made a request\". It is true only once a request has\n **successfully completed and been charged credits** — a request that failed does not flip it,\n even when its bandwidth was billed (issue #2890). The doc comment also now states the\n all-time (never windowed) scope and the up-to-one-rollup lag, so a caller polling it after a\n first request knows `false` can mean \"not visible yet\" rather than \"never made a request\".\n Regenerated from `docs/api/openapi.yaml`; the emitted TYPE is unchanged\n (`has_activity: boolean`), so this release is source-compatible in both directions.\n\n#### Changed\n\n- Regenerated `src/generated/api.d.ts` from `docs/api/openapi.yaml` after issue #2904 declared the\n optional `X-ByteKit-Client` request header as `components.parameters.ClientSurfaceMarker`. The\n regeneration is ADDITIVE and touches no method signature: one entry appears under\n `components[\"parameters\"]`, because the parameter is deliberately `$ref`-ed from no operation.\n **No consumer-visible change** — no exported function, type or runtime behavior differs from\n 0.6.1. The entry exists because `check-release-drift` (#2680) requires a version bump for any\n post-release change to a shipped file, and the publish pipeline is version-gated.\n\n Documented under 0.6.2 alongside the #2890 regeneration above, rather than under a 0.6.3 of its\n own, because 0.6.2 has been CUT BUT NOT PUBLISHED (npm `latest` is 0.6.1). Both regenerations\n therefore ship in the same single artifact. Numbering this 0.6.3 would leave 0.6.2 documented and\n unpublishable — the version-gated pipeline would publish 0.6.3 and skip it — which is precisely\n the phantom-version class #2680 exists to kill, and `check-release-drift` rejects it by name.\n\n### [0.6.1] - 2026-08-10\n\n#### Changed\n\n- Version-alignment release after the 2026-08-10 publish rescue: the published 0.6.0 artifact was built from the `main` promotion HEAD, which already contained every change documented under the 0.6.0 heading — but that commit postdates the one that introduced the 0.6.0 version string, so the `check-release-drift` gate (#2680) correctly reported shipped drift on every subsequent CI run (#2829). 0.6.1 realigns manifest ↔ registry ↔ version-introducing commit. **No consumer-visible change relative to the published 0.6.0.**\n\n### [0.6.0] - 2026-08-07\n\n#### Added\n\n- **`ByteKitError.details`** — the API error envelope's structured rejection reason is now\n reachable from the thrown error. A `422 validation_error` carries\n `{ formErrors, fieldErrors }`, so a caller can finally read WHICH request field was\n rejected rather than only that the request was invalid; a `400 invalid_url` carries a flat\n `{ url, field, reason }`. Typed as `ByteKitErrorDetails | undefined` where\n `ByteKitErrorDetails = Record<string, unknown>` (also exported), deliberately loose because\n the contents vary by error code — narrow the member you read. Strictly ADDITIVE: `details`\n is an optional FOURTH constructor argument, so existing three-argument\n `new ByteKitError(status, code, message)` construction is unchanged, and `status` / `code` /\n `message` are byte-identical. Populated only from the canonical `{ error: { … } }`\n envelope — a flat vendor-masked body (`/v1/search` `502 {\"error\":\"search_provider_error\"}`)\n carries no structured detail and grows none. `http_status` and `failed_at` are deliberately\n NOT exposed: `http_status` would duplicate the existing `status` property, and a duplicated\n field that can disagree with its twin is a bug surface. (#2685)\n\n- A `tsc --noEmit`-checked parity pin in `src/types.ts` ties the hand-authored search types\n (`SearchOpts`, `SearchResult`, `SearchResultImage`, `SearchResponse` — the SDK's only\n hand-authored request/response types) to the generated `operations['createSearch']`\n request and `200` response. It asserts key-set and optionality parity in both directions\n and assignability in each meaningful direction, so a future spec change that search's\n types do not follow fails the build instead of shipping. Value types are erased before the\n parity comparison, so a deliberate hand-authored refinement (a branded id, a narrowed\n union) cannot trip it. Type-level only — the assertions erase at emit and add nothing to\n `dist/`. (#2678)\n\n#### Fixed\n\n- **README: the `fetch` sample's `res.cache` type is corrected to include `null`.** The\n documented type read `\"hit\" | \"miss\" | \"bypass\"`, but `FetchResult.cache` is\n `FetchCacheStatus | null` (null when the response carried no recognizable `X-Fetch-Cache`\n header) — the one strict-`tsc` error a real consumption file copied from the README ever\n produced. The line is now a TYPED ASSIGNMENT rather than a comment, so the README compile\n guard (`src/__tests__/readme-compiles.test.ts`) typechecks it: comment-vs-type drift on\n this field now fails the build instead of shipping. Documentation only — no runtime or type\n change. (#2685)\n\n- **CHANGELOG: the `[0.1.0]` heading's malformed `- 2026` date is now `- 2026-04-24`**, the\n commit date of `caf17e56b`, which introduced `packages/sdk-typescript/package.json` at\n version `0.1.0`. Every other heading in this file already carried a full ISO date; this one\n broke the Keep a Changelog `## [x.y.z] - YYYY-MM-DD` form. (#2685)\n\n- **Test-only: nine SDK test files mocked wire bodies the API can never send.** A\n `monitors.create` 200 (the operation declares 201 as its only success arm), a scrape 200\n carrying `data: { markdown }` (the envelope has no `data` member — content lives under\n `formats`), a `screenshots.getWithResponse` mock asserting `X-Screenshot-*` headers that\n `GET /v1/screenshots/{id}` declares on no arm, error bodies omitting the `Error` schema's\n required `status: 'failed'` / `http_status` / `failed_at`, and twelve `402`/`429` arms on\n operations that declare neither status. Each is rewritten to a spec-valid shape with a\n comment naming the arm it now matches, and every test keeps its original assertion target.\n No shipped code changed. (#2685)\n\n- **`SearchResult.snippet` is now optional (`snippet?: string`) — BREAKING AT COMPILE TIME.**\n `type: 'images'` search results omit `snippet` entirely (the spec has always declared a\n result's `required` set as `[position, title, url]`), but the SDK typed it as a required\n `string`. `hit.snippet.length` therefore compiled under strict TypeScript and threw\n `TypeError: Cannot read properties of undefined` on every images hit — the TypeScript twin\n of the Python SDK's #2579 images `KeyError`. **Consumers reading `.snippet` unguarded now\n see `string | undefined`** and must narrow it (`if (typeof hit.snippet === 'string')` or\n `hit.snippet ?? ''`), exactly as they already do for `date`. No runtime behavior and no\n wire bytes change: the field was already absent from those payloads. `web`/`news` results\n are unaffected — they still carry `snippet`, and a narrowed read yields the same string.\n (#2678)\n\n- **Path parameters are now percent-encoded.** Every id-bearing method built its request path\n with a raw template literal, so a crafted or interpolated id silently retargeted the\n request: `scrape.get('sc_/../../account')` addressed `GET /v1/account` once WHATWG URL\n parsing collapsed the `../` segments, and `monitors.get('mon_x?admin=1#frag')` turned the id\n into a real query string plus fragment. The branded id types constrain only the PREFIX of an\n id, never its tail, so they were never a defence. An id now travels as one percent-encoded\n path segment — a malformed one 404s server-side instead of reaching a different resource.\n Ports the Python SDK's #2593 fix. (#2677)\n\n#### Changed\n\n- Request paths are assembled by a single internal `buildPath()` helper in `client.ts` rather\n than by per-resource template literals. It encodes SEGMENTS only — every fixed segment and\n every `/` separator stays literal — and encodes each value exactly once, so an id that\n already contains a `%` is not double-encoded. **A well-formed id (`sc_<hex>`, `mon_<hex>`, …)\n produces a byte-identical URL to before**, on every id-bearing method: encoding is a no-op\n for those characters, so no existing call changes on the wire. (#2677)\n\n- Four of the guards shipped above could not fail on the change they appeared to protect, and\n now can. `buildPath()`'s two `TypeError` throws — the fail-loud that replaced the\n compile-time checking a template literal used to give — each survived its own removal with\n the whole suite green, and are now pinned by tests separated by input shape rather than by\n message text. The in-suite path-helper gate read its directory non-recursively while the\n shell grep it reproduces is `-r`, so an offender one directory down was invisible to it; it\n now walks the whole of `src/`, a strict superset of the shell gate's set. The `images`\n search-result literal's key ABSENCE (no `snippet`, no `date`) was held only by a\n one-directional subtype check, which an extra key cannot break; it is now pinned by explicit\n key-absence assertions plus an exact key-set assertion. And the spec's `error.details` —\n read at one site in `client.ts` off a hand-written inline type — is now tied to the\n generated schema by a PRESENCE pin, so dropping the field from `docs/api/openapi.yaml` fails\n the build. Every pin is key-level, never value-level, so a deliberate hand-authored value\n refinement still cannot trip it. Test- and type-level only: no runtime behavior, no exported\n type, and nothing in `dist/` changes. (#2793)\n\n### [0.5.0] - 2026-07-29\n\n#### Added\n\n- `src/generated/api.d.ts` now models the `400` responses that the gateway's new\n request-body-size guards can return. `operations['stripeWebhook']['responses']` gains a\n `400` with this route's bespoke `{ error?: string }` body, and\n `operations['retryWebhookDelivery']['responses']` gains a `400` carrying the unified\n `components['schemas']['Error']` envelope. Both are purely additive — no existing member\n changed shape — so every current call site still compiles. (#2640)\n\n#### Changed\n\n- Regenerated `src/generated/api.d.ts` against the merged spec. Beyond the two added `400`\n members above, the delta is JSDoc only: every guarded endpoint's description now carries a\n `**Limits:**` block stating its byte ceiling and the `request_too_large` error code\n (#2640), and `POST /v1/bulk`'s description documents `defaults.type` inheritance and the\n 422 on unrecognized keys (#2643). No runtime code changed. (#2640, #2643)\n\n### [0.4.0] - 2026-07-24\n\n#### Added\n\n- `RequestOptions` (per-call `requestTimeoutMs` + caller `signal`) is now accepted by\n **every** resource method, not just `scrape.create` / `scrape.get`. It is always a\n trailing optional parameter — on `screenshots.create` it is the third positional, after\n `params` — so every existing call site compiles and serializes byte-identically. Per-call\n options continue to beat the constructor's `timeoutMs` default; omitting them leaves the\n constructor default in force exactly as before. (#2547)\n- `ApiResponse<T>` (`{ data, headers, status }`), a generic `client.requestWithResponse<T>()`\n transport, and three typed siblings — `sitemap.getWithResponse`,\n `screenshots.createWithResponse`, `screenshots.getWithResponse` — make the documented\n `X-Raw-Bytes`, `X-Billable-Bytes`, `X-Billing-Multiplier` and `X-Screenshot-*` response\n headers reachable. This surface is purely **additive**: it issues the identical request\n with the identical options as the base method, and no existing return type changes.\n (#2547)\n- `MonitorStatus` and `ScrapeCookie` are exported from the package entrypoint. (#2547)\n\n#### Changed (**BREAKING** at compile time)\n\n- `ScrapeOpts.cookies` is now `ScrapeCookie[]`, derived from the spec's `Cookie` schema\n (`name` and `value` required; `domain`, `path`, `secure`, `httpOnly` optional), instead of\n an open bag of untyped records. A cookie missing `name` used to compile and fail as a 422\n on the wire; it is a compile error now. Serialization is unchanged. (#2547)\n- `ListMonitorsParams.status` is now the spec enum\n (`'active' | 'processing' | 'paused' | 'cancelled' | 'suspended'`), derived from the\n generated `listMonitors` query type, instead of `string`. A typo like `'activee'` used to\n compile and 422; it is a compile error now. The serialized query string is unchanged.\n (#2547)\n\n#### Fixed\n\n- `timeoutMs` / `requestTimeoutMs` (and a caller-supplied `signal`) now cover the\n **response body read**, not just the time to first byte of headers. The abort budget was\n armed for `fetch` and cleared the moment headers arrived, after which `request()`'s\n `response.text()`, `requestRaw()`'s `response.arrayBuffer()`, and the error-body\n `response.json()` on a non-2xx all read the body unbounded — so a server that answered\n with headers and then stalled its body hung the caller forever. A mid-body abort now\n surfaces as `ByteKitConnectionError` with `code: 'timeout'` (budget) or `'aborted'`\n (caller signal) instead of a bare `TypeError: terminated`.\n\n The default is **unchanged at 120 s**, and the precedence table for\n `signal` / `requestTimeoutMs` / `timeoutMs` is untouched. One consequence worth planning\n for: a legitimately large body (a multi-MB `/v1/fetch` document) now counts against that\n same budget, where previously only the wait for headers did. (#2546)\n\n- The README's webhook-retry sample used an invalid delivery id prefix (`whd_`) that its own\n branded type rejects. The sample is corrected, and a new test compiles every TypeScript\n sample in the README against the SDK's sources so a non-compiling sample can no longer\n ship. (#2547)\n\n#### Fixed (**BREAKING** at compile time)\n\n- `fetch.get` no longer accepts the eleven markdown-tuning options (`markdown_mode`,\n `markdown_query`, `markdown_links`, `markdown_images`, `with_links_summary`,\n `with_images_summary`, `markdown_compact`, `markdown_filter_images`,\n `markdown_include_media`, `markdown_include_warnings`, `markdown_include_stats`).\n The spec's `GET /v1/fetch` declares only `url`, `format`, `country`, `timeout_ms`\n and `cache_ttl`, so those options were silently dropped by the query builder — a\n caller asking for `markdown_mode: 'llm'` compiled and received default article-mode\n markdown. They are now compile errors instead of silent no-ops; use `fetch.create`\n (POST), which accepts and serializes all of them unchanged. `FetchGetOpts` is now\n derived from the generated `getFetch` query type, so future spec drift fails\n `tsc --noEmit` rather than reaching production. (#2539)\n\n### [0.3.0] - 2026-07-21\n\n#### Removed (**BREAKING**)\n\n- The deprecated `RapidCrawl`, `RapidCrawlError`, and `RapidCrawlConnectionError`\n exports and the `RapidCrawlOptions` type alias (kept as a one-minor-version\n bridge in #2421) are removed. Import the `ByteKit*` names instead. (#2473)\n- The `RecordingId` type export is removed. Recordings are deactivated\n (`/v1/recordings` returns 410), so the branded id had no reachable use.\n Breaking in theory only — unused in practice. (#2481)\n\n#### Fixed\n\n- `fetch.create` / `fetch.get` no longer throw a bare `SyntaxError` on every\n non-JSON body. `/v1/fetch` returns the fetched content AS the response body\n (metadata in `X-Fetch-*` headers), but both methods routed through the\n JSON-parsing transport. They now use a raw-capable transport and resolve to a\n typed `FetchResult` — raw `body`, byte-exact `bytes`, plus `id`,\n `creditsCharged`, `cache`, `custom`, `contentType`, and `headers` parsed from\n the `X-Fetch-*` metadata. (#2466)\n- A trailing slash on the constructor `baseUrl` (e.g. `\"https://api.bytekit.com/\"`)\n no longer produces double-slash request URLs — it is normalized once, preserving\n a path-carrying baseUrl. (#2481)\n- `SearchResult.date` is now optional (`string | null | undefined`): `images`\n search results omit the field entirely. (#2481)\n\n#### Added\n\n- New `usage` resource (`get`, `daily`, `byEndpoint` — `GET /v1/usage`,\n `/v1/usage/daily`, `/v1/usage/by-endpoint`) and `webhooks` resource (`list`,\n `retry` — `GET /v1/webhook-deliveries`, `POST /v1/webhook-deliveries/{id}/retry`),\n with their request/response types exported. (#2471)\n- `ScrapeOpts` and `FetchOpts` now cover the full documented request field set\n (10 previously missing `ScrapeRequest` fields; 11 markdown-tuning\n `FetchRequest` fields), plus the `'text'` markdown-links mode. A compile-time\n drift guard keeps them aligned with the generated OpenAPI schema. (#2475)\n- `monitors`, `sitemap`, `bulk`, and `fetch.bulk` methods are now fully typed from\n the generated OpenAPI `operations` (previously `Record<string, unknown>` in /\n `Promise<unknown>` out); their request/response types are re-exported. (#2481)\n- `monitors.list` accepts typed query params and returns a typed response\n (`ListMonitorsParams` / `ListMonitorsResponse`, both exported). (#2480)\n\n#### Changed (**BREAKING**)\n\n- `fetch.get` now rejects a `custom` option at compile time: `GET /v1/fetch` has\n no `custom` query param, so the value was silently dropped before. Use\n `fetch.create` (POST) to echo a `custom` payload. (#2481)\n- `FetchOpts.format` is narrowed from `string` to the spec union\n `'markdown' | 'html'`; off-spec values now fail to compile. (#2475)\n\n### [0.2.2] - 2026-07-16\n\n#### Changed\n\n- Re-release of 0.2.1. The 0.2.1 artifacts never reached npm — the prod publish's\n `publish-sdk` step failed on a CI test-isolation flake (`cjs-require.test.ts`\n rebuilding the shared `dist`), which is now fixed. No consumer-facing changes\n beyond 0.2.1.\n\n### [0.2.1] - 2026-07-16 [NEVER PUBLISHED]\n\n> **Never published to npm.** This version was cut in-tree but no `@hunt-labs/bytekit-sdk@0.2.1`\n> tarball exists — `npm i @hunt-labs/bytekit-sdk@0.2.1` fails. Everything below shipped to users in\n> **0.2.2**, which is the first published release containing it. Reconciled by issue #2680; the\n> `release-drift` CI gate now blocks a new phantom heading from being introduced.\n\n#### Changed\n\n- Primary exports renamed `RapidCrawl`→`ByteKit`, `RapidCrawlError`→`ByteKitError`,\n `RapidCrawlOptions`→`ByteKitOptions`. The old names remain as deprecated,\n identity-preserving aliases (`RapidCrawl === ByteKit`), so existing imports keep\n working. (#2421)\n\n#### Fixed\n\n- `request()` now returns `undefined` on `204 No Content` / empty-body responses\n instead of throwing a JSON-parse error — `account.apiKeys.revoke()` now resolves\n as its `Promise<void>` contract declares. (#2450)\n\n#### Removed\n\n- `client.recordings` (the `/v1/recordings` endpoint is permanently `410`\n deactivated). (#2421)\n\n### [0.2.0] - 2026-07-15\n\nThis is a breaking release. Four runtime behavior changes affect code written\nagainst 0.1.0 — read each one before upgrading.\n\n#### Changed (breaking)\n\n- **Default client-side timeout (120s).** Requests now abort after 120000 ms by\n default (`DEFAULT_TIMEOUT_MS` in `src/client.ts`); 0.1.0 had no client-side\n timeout and would hang indefinitely. A slow request now rejects with\n `RapidCrawlConnectionError` carrying `code: 'timeout'`. Override per client via\n `new RapidCrawl({ apiKey, timeoutMs })`.\n- **Network failures throw `RapidCrawlConnectionError`.** Every `fetch()` rejection\n is now wrapped by `toConnectionError()` and re-thrown as `RapidCrawlConnectionError`.\n 0.1.0 surfaced undici's bare `TypeError: fetch failed`. Code that matched on a bare\n `TypeError` to detect a network failure will no longer match — catch\n `RapidCrawlConnectionError` instead.\n- **Constructor throws on an empty `apiKey`.** `new RapidCrawl({ apiKey: '' })` (or a\n missing key) now throws a `TypeError` immediately instead of silently sending\n `Authorization: Bearer undefined`. Ensure `apiKey` is populated (e.g. from\n `process.env.BYTEKIT_API_KEY`) before constructing the client.\n- **Request-body types narrowed to the OpenAPI schema.** Request payloads are now\n typed from spec-derived types generated from the OpenAPI schema\n (`src/generated/api.d.ts`) rather than `Record<string, unknown>`. Payloads that\n previously compiled by virtue of the loose index type may now be rejected by the\n type checker; align them with the documented request shape.\n\n#### Changed\n\n- Package renamed to `@hunt-labs/bytekit-sdk` (the `@bytekit` npm scope was\n unobtainable). ~~The prior `rapidcrawl`/`@rapidcrawl/sdk` name remains installable at\n its last version but is deprecated.~~ **Corrected in 0.7.1 (see above): that claim\n does not hold — both names 404 on npm and there is no published version left to\n deprecate.**\n- Generated API types (`dist/generated/api.d.ts`) are now shipped in the tarball so\n consumers get the typed request/response surface without regenerating from the spec.\n\n#### Added\n\n- Publish-ready packaging metadata: types-first `exports`, `engines`, `keywords`,\n `homepage`, `bugs`, `README.md`, `LICENSE`, and an MIT `license` field.\n\n### [0.1.0] - 2026-04-24\n\n#### Added\n\n- Initial release of the ByteKit TypeScript SDK — a typed client for the ByteKit API\n (scrape, screenshot, search, and related endpoints), published under the original\n `@rapidcrawl/sdk` name.\n\n## bytekit-sdk\n\nPython SDK, published on PyPI. Import name: `bytekit`.\n\n### Unreleased\n\n### 0.4.0\n\n_Release cut 2026-08-19._\n\n#### Removed\n\n- **BREAKING: `billing_multiplier` and `billed_bytes` are gone from\n `ScrapeSuccessEnvelope`** (#3143). Read `billing` instead — a `BillingNode` that names every\n factor applied to the charge, the multiplier they compose to, and the resulting billed bytes:\n\n ```python\n # before\n spend = res.billed_bytes # flat, base-endpoint only\n # after\n spend = res.billing.billed_bytes # guard on isinstance(res.billing, BillingNode)\n why = res.billing.factors # [BillingFactor(name=\"endpoint\", value=1.5, reason=\"scrape_md\"), ...]\n ```\n\n This is a correction, not a rename: the two surfaces reported **different numbers for the\n same charge**. The flat pair carried the BASE-endpoint composition, so a markdown cache hit\n read `0.5` / `400` while the real charge — and the `X-Billing-Multiplier` header — was\n `0.75` / `600`; an html-only miss read the per-format credits estimate `1.5` / `150` against\n an endpoint factor of `1.0` / `100`. The flat pair also never carried the `clean_markdown`\n x3 surcharge, so on a successful clean it under-reported the amount billed by two thirds.\n `billing.multiplier` composes every applied factor behind exactly one rounding, so it is the\n number that predicts your invoice.\n\n `billing` is `UNSET` on resources that completed before the billing node existed. A pre-node\n row omits the field rather than reporting a zero node, because a zero node would assert that\n a real past charge was zero. Test with `isinstance(res.billing, BillingNode)`, never with a\n truthiness check — a legitimate zero-byte charge is a value, not an absence.\n\n Two endpoints deliberately carry no node: `/v1/search` is billed per credit and reports\n `credits_used`, and a single `/v1/fetch` reports its charge through response headers only.\n The `/v1/logs` row field named `billing_multiplier` is a **different field** and is not the\n envelope field this release removed. It carries the BASE settled `credits_charged` factor,\n not the composed real-endpoint value the `X-Billing-Multiplier` header reports — a markdown\n cache hit reads `0.5` on the logs row and `0.75` on the header.\n\n#### Changed\n\n- Generated `ScrapeErrorEnvelope` documentation now describes terminal asynchronous\n `scrape.failed` webhook delivery (#1856). No runtime SDK behavior or API shape changed.\n\n#### Fixed\n\n- **`GET /v1/logs` entries now carry `billing_multiplier`, as a JSON number** (#3022). The\n gateway had been serializing that value under an undeclared key `credits`, and as the raw\n Postgres `NUMERIC(10,2)` string (`\"1.50\"`), while the OpenAPI spec declared\n `billing_multiplier` as a number.\n\n **Breaking at the wire level:** the undeclared `credits` key is gone from every `/v1/logs`\n entry. Code reading `credits` off a logs response must read `billing_multiplier`. No SDK\n method exposes this endpoint, so nothing inside this package changed.\n\n- **`change_threshold` on `MonitorResponse`/`MonitorCreateResponse` and `change_pct` on\n `CaptureResponse` are now typed `float`, not `str`** (#3021). Both are Postgres\n `NUMERIC(5,2)` columns; the gateway passed the raw driver string through unconverted\n (`\"5.00\"` / `\"7.25\"`) while the OpenAPI spec's request schemas already declared `number`\n — only the response schemas had been (incorrectly) edited to match the buggy string\n output. This release fixes the gateway serializer and corrects the two response schemas,\n so spec and runtime now agree.\n\n **Breaking at the wire level:** `bytekit.api.monitors.create_monitor`,\n `bytekit.api.monitors.get_monitor`, `bytekit.api.monitors.list_monitors`, and\n `bytekit.api.monitors.update_monitor` now return `float` for `change_threshold` instead\n of `str` (screenshot-type monitors only, `create_monitor`/`update_monitor` included since\n both also serialize through the same `MonitorCreateResponse`/`MonitorResponse` schemas);\n `bytekit.api.monitors.list_monitor_captures` now returns `float` for `change_pct` instead\n of `str`. `change_pct` is `None` (not `0.0`) when there is no prior capture to diff\n against, unchanged from before. Only the generated model description changed inside this\n package.\n\n### 0.3.9\n\n_Release cut 2026-08-11._\n\n\n\n#### Changed\n\n- **The declared `httpx` floor is raised from `>=0.24.0` to `>=0.28.0`** (#2998). The SDK's own\n tests assert the exact request and response bytes it puts on the wire, and those bytes changed\n in httpx 0.28.0, which switched to compact JSON separators (`b'{\"a\":\"b\"}'`; every release up to\n and including 0.27.2 emits `b'{\"a\": \"b\"}'`). The old floor therefore promised an install the\n suite cannot run green: on httpx 0.24–0.27 the dependency resolves, and 12 assertions then fail\n with a message naming neither httpx nor a version. Raising the floor was chosen over loosening\n the assertions, because the compact form is the wire format the SDK actually emits and pinning\n it is the reason those tests exist. **No runtime behaviour of this package changes** — only what\n `pip` will resolve. httpx 0.28.0 declares `requires-python >=3.8`, so this excludes no Python\n version the SDK supports (`requires-python = \">=3.10\"`).\n\n- **Generated vocabularies follow the spec's corrected error and format enums** (#2959).\n `ScrapeErrorEnvelopeErrorCode` no longer carries `QUOTA_EXHAUSTED`: the API has emitted\n `quota_exceeded` since #1539 and no gateway throw site produces `quota_exhausted`, so this\n removes a member that has never arrived over the wire — not one that stops arriving. Code\n matching on it was matching a branch that could not be reached; the live code for an exceeded\n quota is `quota_exceeded`. `INVALID_URL`, which the API does emit, is unchanged.\n\n `CreateBulkBodyDefaultsFormatsItem` and `CreateBulkBodyItemsItemFormatsItem` rename\n `RAWHTML = \"rawHtml\"` to `RAW_HTML = \"raw_html\"`, matching `ScrapeRequest` and\n `/v1/scrape/bulk`. `/v1/bulk` accepted only the internal spelling and the spec documented\n that; it now accepts both, so the one endpoint that disagreed with the rest of the surface no\n longer does. `rawHtml` keeps working on the wire.\n\n#### Fixed\n\n- **An invalid `type` or `date_range` passed to `client.search(...)` now raises an error you can\n act on** (#2958). `search(type=\"bogus\")` raised a bare `ValueError: 'bogus' is not a valid\nCreateSearchBodyType` straight out of a generated enum constructor — it named a class you never\n imported, it did not say which values would have worked, and the method's `Raises:` section\n listed only `UnexpectedStatus`, so the error was undocumented as well as unhelpful. The message\n now names the parameter, the value it rejected and every value it accepts, and it is raised\n before any request is sent, so a typo can never be billed.\n\n The type hints for both arguments narrowed from `Optional[str]` to a `Literal` union with the\n generated enum class, which makes a wrong CONSTANT a type error at the call site rather than a\n runtime surprise. **This is hints-only: any `str` is still accepted at runtime**, so code that\n computes the value — from argv, a config file, a database column — keeps working unchanged.\n Enum members (`CreateSearchBodyType.IMAGES`) type-check as before.\n\n- **A successful 200 carrying an extraction-quality warning no longer fails to parse** (#2948).\n `ScrapeWarningCode` was generated from a spec enum that listed 10 of the 12 codes the server\n emits; `low_quality_extraction` and `fragment_menu_stripped` (added server-side by #1701) were\n missing. `ScrapeWarning.from_dict` builds the code with `ScrapeWarningCode(...)`, which raises\n `ValueError` on an unknown member, and #2684's `bytekit_parse` guard then turned that into the\n two-tier contract — so a **successful, billed 200** reached the caller as\n `errors.UnexpectedStatus` under the default `raise_on_unexpected_status=True`, and as\n `response.parsed is None` under the opt-out. Both codes are now in the spec and the enum, so\n such a response parses normally. Callers who added a defensive `except UnexpectedStatus` around\n scrape calls for this reason can drop it. The other 10 codes are unaffected.\n\n#### Changed\n\n- **Connection failures are documented.** Every `Raises:` section named `httpx.TimeoutException`\n and stopped there, and the README's error-handling section did the same. Its transport sibling\n `httpx.ConnectError` — DNS failure, connection refused, TLS handshake failure — is just as\n reachable and is caught nowhere, so `except (UnexpectedStatus, httpx.TimeoutException)` written\n from the documented surface left an uncaught exception waiting for the first flaky network.\n Both client-class docstrings, `search()`'s `Raises:` section and a new README\n **Transport errors** table now name both. No behavior changed: neither exception was ever\n caught, and neither is now.\n\n- **README: two first-use traps.** `get_fetch` takes `url_query=`, not `url=` (it travels as the\n `url` query parameter), and `AuthenticatedClient.search(...)` is synchronous — calling it\n inside a coroutine blocks the event loop, with `create_search.asyncio` as the async\n alternative. Both are now documented with runnable examples.\n\n- **The sdist no longer ships a legacy-brand name.** `bytekit-sdk==0.3.8` carried one occurrence\n of the pre-cutover project name — inside a `.gitignore` this package does not own and its build\n configuration does not list. hatchling force-includes the nearest ignore file into an sdist,\n which here means the repository's, so the string reached PyPI while a search of the package\n itself came back clean. The line is corrected, and the BUILT tarball is now grepped on every\n test run rather than the source tree. Nothing you install changes; the artifact simply stops\n advertising a name and a command that no longer exist.\n\n- **A release can no longer be published while its own changelog denies it exists.** The `0.3.8`\n sdist shipped with its `## 0.3.8` section still carrying the cut-time placeholder that denies\n publication: it was written when the release was cut, was never updated when the release\n actually happened, and nothing existed to notice. The publish step now refuses to upload a\n version whose section still carries that placeholder. This entry documents the fix for readers\n of the artifact; the guard itself lives in the repository. (The placeholder's own wording is\n deliberately not quoted here — the guard reads this section, and quoting it would trip the very\n check being described.)\n\n- **Alignment release — the published `0.3.8` artifact already carries this content.** `0.3.8`\n published to PyPI at `2026-08-11T21:18:32.641Z` (sdist `bytekit_sdk-0.3.8.tar.gz`), built from\n the promotion HEAD, so it contains every change documented under `0.3.8` — including the two\n review fix-ups to the injected `client_surface` converter (non-mapping `headers=` values, and\n case-insensitive override precedence). Verified by downloading the published sdist and reading\n `src/bytekit/client.py`. **Nothing about the installed package changes _through this alignment_**\n — the `#2948` enum fix above is a separate, deliberate change riding the same unpublished version.\n\n This release exists because `check-release-drift` (#2680) is version-gated and anchors on the\n commit that introduced a version, not on the commit whose tree was actually published. Those two\n fix-ups landed **after** the commit that introduced `0.3.8`, so once `0.3.8` reached PyPI the\n gate read them as post-release drift. Bumping moves the anchor past them. This mirrors the\n `0.3.6` version-alignment release cut after the 2026-08-10 publish rescue.\n\n### 0.3.8\n\n_Published to PyPI 2026-08-11 (`21:18:32.641Z`)._\n\n#### Added\n\n- **Every request now carries an `X-ByteKit-Client` header identifying this SDK and its\n version** — `X-ByteKit-Client: sdk_python/<version>`, sent by default from both `Client` and\n `AuthenticatedClient`, on the synchronous and the asynchronous httpx client alike. It lets\n ByteKit tell traffic that came through the Python SDK apart from direct API calls; before\n this release those were indistinguishable. The version half resolves from the installed\n distribution's metadata (the same source as `bytekit.__version__`), so it can never drift\n from `pyproject.toml`.\n\n **A caller-supplied header of the same name wins**, whether it is passed to the constructor\n (`Client(headers={\"X-ByteKit-Client\": \"…\"})`) or merged in later\n (`client.with_headers({\"X-ByteKit-Client\": \"…\"})`) — the marker is a telemetry dimension, not\n an authentication or authorization control, and ByteKit treats an unrecognized value exactly\n as it treats a missing one. Unrelated caller headers leave the marker intact.\n\n The override is matched **case-insensitively**, as HTTP header names are, so\n `x-bytekit-client` and `X-BYTEKIT-CLIENT` override just as `X-ByteKit-Client` does — including\n through `httpx.Headers`, which lowercases every key it is given. Exactly one\n `X-ByteKit-Client` header goes on the wire either way; you will never see your override and\n the default sent together.\n\n Nothing else about request construction changed: `AuthenticatedClient` still stamps its auth\n header, `with_headers` still merges caller keys over defaults, the cookies, timeout, verify\n and redirect settings of both clients are untouched, and `headers=` still accepts everything\n it accepted before — a dict, `None`, a list or tuple of pairs, an `httpx.Headers`.\n\n#### Fixed\n\n- **A `headers` dict you pass to a client is no longer written into by the SDK.** Previously the\n client kept your mapping by reference and stamped `Authorization: Bearer <your token>` into it\n when it built its httpx client, so a dict you still held — and might log, reuse for a second\n client, or share across threads — silently acquired your API key. The client now copies what\n you pass, so your object is left exactly as you gave it and two clients built from one dict\n can no longer contaminate each other's credentials. Nothing about the headers the client\n _sends_ changed.\n\n### 0.3.7 [NEVER PUBLISHED]\n\n> **Never published to PyPI.** This version was cut in-tree but no `bytekit-sdk` 0.3.7 artifact\n> exists — `pip install bytekit-sdk==0.3.7` fails. Everything below shipped to users in **0.3.8**,\n> which is the first published release containing it.\n\n#### Documentation\n\n- **`AccountSessionResponse.has_activity` now documents what it actually means.** The generated\n model's attribute docstring previously said the flag was true once the account had \"ever\n recorded billable activity\", which read as \"ever made a request\". It is true only once a\n request has **successfully completed and been charged credits** — a request that failed does\n not flip it, even when its bandwidth was billed (issue #2890). The docstring also now states\n the all-time (never windowed) scope and the up-to-one-rollup lag, so a caller polling it\n after a first request knows `False` can mean \"not visible yet\" rather than \"never made a\n request\". Regenerated from `docs/api/openapi.yaml`; the attribute's TYPE is unchanged\n (`has_activity: bool`), so this release is source-compatible in both directions.\n\n### 0.3.6\n\n#### Documentation\n\n- No README change ships in 0.3.6. The README's Error handling documentation reached PyPI\n inside the published 0.3.5 artifact (2026-08-10 publish rescue) and stays documented under\n the 0.3.5 heading, which is the version whose wheel actually carries it.\n\n#### Changed\n\n- Version-alignment release after the 2026-08-10 publish rescue: the published 0.3.5 artifact was built from the `main` promotion HEAD, which already contained every change documented under the 0.3.5 heading — but that commit postdates the one that introduced the 0.3.5 version string, so the `check-release-drift` gate (#2680) correctly reported shipped drift on every subsequent CI run (#2829). 0.3.6 realigns manifest ↔ registry ↔ version-introducing commit. **No consumer-visible change relative to the published 0.3.5.**\n\n### 0.3.5\n\n#### Breaking\n\n- **`AuthenticatedClient` takes no positional arguments.** `token`, `prefix` and\n `auth_header_name` are now keyword-only, joining `base_url`, `timeout`,\n `raise_on_unexpected_status` and the rest — so `AuthenticatedClient(...)` accepts keywords\n only. Before 0.3.0 the first positional argument was `base_url`, which made\n `AuthenticatedClient(\"https://api-stg.bytekit.com\", \"sk_live_…\")` a documented call. When\n 0.3.0 made `base_url` a defaulted keyword argument, that call stopped meaning what it said\n and started **binding the URL to `token` and the API key to `prefix`** — sending\n `Authorization: sk_live_… https://api-stg.bytekit.com` to the _default_ host,\n `https://api.bytekit.com`, with nothing raised and nothing warned. It now raises\n `TypeError`. Migration is mechanical:\n `AuthenticatedClient(base_url=\"https://api-stg.bytekit.com\", token=\"sk_live_…\")`. Keyword\n construction — the form the README, the docs site and every example already use — is\n entirely unchanged, including `prefix=`/`auth_header_name=` overrides and the\n `with_headers`/`with_cookies`/`with_timeout` helpers. The unauthenticated `Client` was\n already keyword-only and is unaffected.\n\n#### Fixed\n\n- **A schema-drifted response body no longer crashes with a bare `KeyError`.** A generated\n model's `from_dict` trusts the `required` keys the OpenAPI spec declared when the client\n was generated, so a server that renamed, dropped or retyped a field leaked the generator's\n own internal exception straight to the caller — `KeyError: 'schema_version'` from\n `create_scrape`, `KeyError: 'period_start'` from `get_usage`, `KeyError: 'data'` from\n `list_monitors`, plus `TypeError`/`ValueError` for non-object and nested-drift bodies. It\n happened on a **documented** status (a `200`/`202`), in **both** raise modes, and no row of\n the documented error table covered it, so a caller who handled that table faithfully still\n had no branch for it. Schema drift now takes exactly the same two arms as a non-JSON body:\n `errors.UnexpectedStatus` (carrying `.status_code` and the raw `.content`, with the\n original parse failure attached as `__cause__`) in the default mode, and `None` under\n `raise_on_unexpected_status=False`. Deliberately **no new exception type** — a new class\n would be one every existing `except errors.UnexpectedStatus` silently fails to catch, i.e.\n the same untyped crash in a different costume. Bodies that match the documented schema\n parse exactly as before, and a genuinely optional key that is absent still yields `UNSET`.\n- **`client.search()` never returns a silent `None`.** Its 200 body is parsed through the\n same shared guard the generated operations use, which honors\n `raise_on_unexpected_status` — so an opt-out client got `None` handed back from a non-JSON\n 200 or a schema-drifted one, contradicting both the method's non-`Optional` return\n annotation and its own docstring. `search()` now raises `errors.UnexpectedStatus` in\n **both** raise modes. `raise_on_unexpected_status` configures the generated two-tier\n contract, whose signatures are `Optional[...]`; `search()` was never part of it — it\n already raises on documented error statuses that the generated `create_search` returns as\n a typed `Error` model. A well-formed 200 still returns the parsed\n `CreateSearchResponse200` in either mode.\n- **A non-IANA HTTP status no longer crashes every operation with a bare `ValueError`.**\n Each generated operation built its `Response` with\n `status_code=HTTPStatus(response.status_code)` evaluated _before_ the response was\n parsed, so any status outside Python's `http.HTTPStatus` — Cloudflare's `520`–`530`\n family, nginx's `499` — raised `ValueError: 520 is not a valid HTTPStatus` from inside\n the SDK. This happened in **both** raise modes: the default\n `raise_on_unexpected_status=True` never got to raise its `errors.UnexpectedStatus`, and\n `raise_on_unexpected_status=False`, which promises `None`, raised the `ValueError` too.\n `api.bytekit.com` is served through Cloudflare, so this was exactly the edge/CDN failure\n class the typed-error contract exists for. All 29 operations now behave as documented:\n `errors.UnexpectedStatus` (carrying `.status_code` and the raw `.content`) in the default\n mode, a `Response` with `.parsed is None` in the opt-out mode. The hand-written\n `client.search()` wrapper was never affected and is unchanged.\n\n#### Changed\n\n- **`Response.status_code` is a plain `int` for a status `http.HTTPStatus` does not know.**\n This is the contract decision behind the fix above, recorded here because it is the one\n observable difference in the typed surface. Concretely:\n - Every status the stdlib enum **does** know — documented by the API or not, `200` as\n much as `503` — still comes back as a real `http.HTTPStatus` member, so\n `response.status_code.phrase`, `.name`, and identity comparisons such as\n `response.status_code is HTTPStatus.OK` keep working exactly as before.\n - A status the enum does **not** know (`499`, `520`, `521`, `522`, `530`, …) comes back\n as the plain `int` the wire carried. `int` comparisons (`response.status_code == 520`,\n `>= 500`) work; enum-only attributes (`.phrase`, `.name`) do not exist on it. The\n alternatives were rejected deliberately: a synthetic `IntEnum` member would invent a\n `.phrase`/`.name` no registry backs, and raising before the `Response` is constructed\n is the bug itself — it is precisely what `raise_on_unexpected_status=False` promises\n not to do.\n - The **declared** annotation on `Response.status_code` is unchanged (`HTTPStatus`), so\n this release adds no type errors to existing consumer code; widening it to\n `Union[HTTPStatus, int]` would make `.phrase`/`.name` a type error on _every_ response,\n including the IANA ones, which is a far larger break than the residual it would close.\n Reach for `.phrase`/`.name` only after an `isinstance(..., HTTPStatus)` check if you\n handle edge statuses off a non-raising client.\n\n In the default (raising) mode this is largely invisible: a non-IANA status raises\n `errors.UnexpectedStatus` before any `Response` is returned, and\n `UnexpectedStatus.status_code` has always been a plain `int`.\n\n#### Documentation\n\n- The \"Error handling\" example in the README now requests `formats=[…MARKDOWN]` explicitly.\n Run literally, its success arm printed `<bytekit.types.Unset object at 0x…>`: the snippet\n built `ScrapeRequest(url=...)` with no `formats`, so the server applied its `raw_html`\n default and `result.formats.markdown` was legitimately unset. The same class of defect\n 0.3.3 fixed in the quick start, in the block directly beneath it. The README's error table\n gains the schema-drift row, a note that `search()` is outside the two-tier contract, and a\n migration note for the keyword-only constructor.\n\n### 0.3.4\n\n#### Breaking\n\n- **`CreateBulkBody`, `CreateBulkBodyDefaults`, `CreateBulkBodyItemsItem`, and\n `CreateFetchBulkBodyUrlsItemType1` lost their additional-properties mapping API.**\n `docs/api/openapi.yaml`'s `/v1/bulk` request schema declares `additionalProperties: false`\n on the top-level body, `items[]`, and `defaults` (issue #2641), and `/v1/fetch/bulk`'s\n per-item override schema inside `urls[]` declares the same (issue #2648), matching the\n gateway's own `.strict()` validators. The code generator responds to\n `additionalProperties: false` by omitting the catch-all mapping it otherwise attaches to\n every generated model, so these four models no longer expose `additional_properties`, the\n `additional_keys` property, `__getitem__`, `__setitem__`, `__delitem__`, or `__contains__`.\n Code that did `body[\"some_key\"] = value`, `\"some_key\" in body`, or read\n `body.additional_keys` on any of these four models will now raise\n `AttributeError`/`TypeError` instead. Use the model's declared `attrs` fields directly\n instead (e.g. `CreateBulkBodyItemsItem(url=..., type=...)`,\n `CreateFetchBulkBodyUrlsItemType1(url=..., format_=...)`); the server itself now rejects\n unrecognized keys on these endpoints with `422 validation_error`, so the removed escape\n hatch could never have reached the API successfully anyway. This is scoped to the four\n `create_bulk_body*` / `create_fetch_bulk_body_urls_item_type_1` models — no other generated\n model is affected.\n\n- If you are upgrading from 0.3.2 or earlier, note that **0.3.3 also carried a breaking model\n removal** that went undocumented at the time — see the \"Breaking\" entry under 0.3.3 below\n (`CreateFetchBulkBodyMetadata` and `CreateScrapeBulkBodyItemsItemMetadata`).\n\n### 0.3.3 [NEVER PUBLISHED]\n\n> **Never published to PyPI.** This version was cut in-tree but no `bytekit-sdk` 0.3.3 artifact\n> exists — `pip install bytekit-sdk==0.3.3` fails. Everything below shipped to users in **0.3.4**,\n> which is the first published release containing it. Reconciled by issue #2680; the\n> `release-drift` CI gate now blocks a new phantom heading from being introduced.\n\n#### Breaking\n\n- **`CreateFetchBulkBodyMetadata` and `CreateScrapeBulkBodyItemsItemMetadata` were removed;\n both fields now use the shared `Metadata` model.** This landed with the default-stripping\n traversal fix listed under \"Fixed\" below (issue #2592) and was not recorded at the time.\n Once server defaults stopped being materialized into the request-direction schemas, the two\n per-body `metadata` objects became structurally identical to the shared `Metadata`\n component, and the code generator emits one model per distinct schema — so\n `bytekit.models.create_fetch_bulk_body_metadata` and\n `bytekit.models.create_scrape_bulk_body_items_item_metadata` no longer exist and importing\n either raises `ModuleNotFoundError`. `CreateFetchBulkBody.metadata` and\n `CreateScrapeBulkBodyItemsItem.metadata` are now typed `Union[Unset, Metadata]`. The wire\n format is **unchanged** — the same JSON object is sent either way — so the migration is\n purely at the import site: `from bytekit.models.metadata import Metadata`, then\n `Metadata(...)` (or `Metadata.from_dict({...})`) wherever you constructed one of the two\n removed classes.\n\n#### Security\n\n- **Path parameters are now percent-encoded.** All 13 operations that interpolate an id into\n their URL (`get_scrape`, `get_screenshot`, `get_bulk`, `delete_bulk`,\n `list_bulk_screenshots`, `get_scrape_bulk`, `get_fetch_bulk`, `get_monitor`,\n `update_monitor`, `delete_monitor`, `list_monitor_captures`, `get_sitemap`,\n `retry_webhook_delivery`) previously interpolated the value raw, so an id containing `/`,\n `?`, `#` or traversal segments could retarget the request to a **different path on the same\n authenticated host** — e.g. a `DELETE /v1/bulk/{id}` becoming a delete against another\n resource. Values are now encoded with `quote(str(value), safe=\"\")`. This is **not** a\n breaking change for any id the API issues: hex and `sc_`/`ss_`/`mon_`/`sm_`/`bulk_`-prefixed\n ids contain no reserved characters, so the resulting URL is byte-identical to before.\n No id-format validation was added — the client does not reject id shapes.\n\n#### Fixed\n\n- **Reusing one client across several `asyncio.run(...)` calls no longer raises\n `RuntimeError: Event loop is closed`.** An `httpx.AsyncClient`'s connection pool belongs to\n the event loop that created it, and the SDK cached its internal async client\n unconditionally. It now tracks which loop that client was built on and transparently\n rebuilds it when the running loop changes, re-applying `base_url`, headers, timeout,\n `httpx_args` and authentication. Behavior is unchanged when no loop is running, and a client\n you supply via `set_async_httpx_client(...)` is **never** rebuilt or closed — it stays yours\n to manage. See the README's new \"Clients and event loops\" section.\n- **The README quick start now prints markdown instead of an `Unset` placeholder.** It\n requested no `formats`, so the server applied its `raw_html` default and\n `result.formats.markdown` was legitimately unset. It now asks for\n `formats=[ScrapeRequestFormatsItem.MARKDOWN]` — note `formats` takes enum members, not plain\n strings.\n- **`client.search(type=\"images\")` no longer crashes with a bare `KeyError: 'snippet'`.**\n The OpenAPI spec's search result-item schema declared `snippet` as `required` while its\n own description said the key is omitted for `images` results — a self-contradiction the\n code generator trusted literally, so `CreateSearchResponse200ResultsItem.from_dict`\n unconditionally did `d.pop(\"snippet\")`. `snippet` (like `date`) is now `Union[Unset, str]`,\n matching the real gateway behavior (`web`/`news` results still always carry `snippet`;\n `images` results omit it entirely) — fixed at the spec level (`docs/api/openapi.yaml`) and\n regenerated, not patched in the generated model. (Issue #2579.)\n- **Server defaults are no longer materialized into request wire bodies/query strings\n for inline request bodies and `$ref`'d parameters.** `scripts/filter-spec.ts`'s\n default-stripping traversal previously only followed `$ref`'d request-body component\n schemas, so `ScrapeRequest`/`FetchRequest` were clean but every other request-direction\n shape kept baking in server defaults: `/v1/search`'s fully-inline body (`type`,\n `limit`, `country`, `language`, `date_range`), all three bulk endpoints' bodies and\n their nested `Defaults`/`ItemsItem` models, and `$ref`'d query parameters\n (`GET /v1/fetch`'s `country`/`timeout_ms`/`cache_ttl`, `list_monitors`'\n `limit`/`status`, `list_webhook_deliveries`'/`list_monitor_captures`' `limit`,\n `create_screenshot`'s `async`). The traversal now walks inline request bodies AND\n parameters (both operation-level and shared path-item-level, `$ref`'d or inline)\n before generation, so an omitted optional field always serializes to nothing and\n the server's own default applies — caller-supplied values are unaffected and still\n serialize exactly as given (issue #2592).\n- `tests/test_no_materialized_defaults.py` rewritten to enumerate every\n request-direction model and operation parameter programmatically (walking the\n generated `bytekit.api`/`bytekit.models` trees) instead of sampling two known-clean\n models, so a newly introduced leaker is caught automatically.\n\n#### Changed\n\n- **The source distribution no longer ships `tests/`.** The bundled suite could not be\n collected from an unpacked sdist: 12 of its 27 modules require the repository's codegen\n scripts or the canonical OpenAPI spec, neither of which belongs in a published\n distribution, and three of them build distributions of the package itself. Nothing\n importable was removed — the **wheel is unchanged**, `py.typed` included, so\n `pip install bytekit-sdk` is unaffected.\n\n#### Internal\n\n- CI now proves the committed client is reproducible from the canonical OpenAPI spec, and that\n the generation chain is deterministic (generating twice yields byte-identical output). This\n closes the gap where a spec change could land with a TypeScript-only regeneration and leave\n the Python client silently stranded on an older spec.\n- `ruff` is now pinned to an exact version alongside the code generator. The generator runs\n `ruff` over everything it emits, so it — not the generator alone — determines the committed\n bytes; the generator itself accepts any `ruff<0.13`, which meant a fresh install could\n reformat the whole tree. Bumping the pin is a deliberate, reviewed reformat.\n- The PEP 561 `py.typed` marker is now emitted by the post-generation injector rather than\n hand-maintained inside the generated tree (the generator omits it under `--meta none`).\n\n### 0.3.2\n\n#### Added\n\n- **`bytekit.__version__`** reports the installed distribution version, resolved at import\n time from `importlib.metadata` (so it can never drift from `pyproject.toml`'s\n `[project].version`). When the package is imported from a source tree with no installed\n distribution it reads `0.0.0.dev0` rather than raising. The dead version override in\n `sdk-python-config.yaml` — inert under `--meta none` and contradicting the real\n version — has been removed, leaving one authoritative version.\n\n#### Fixed\n\n- **`AuthenticatedClient.search()` is now visible to type checkers.** It was attached to the\n class after creation, so despite the package shipping a `py.typed` marker, `mypy` and\n `pyright` reported `\"AuthenticatedClient\" has no attribute \"search\"`. It is now declared as a\n real method in the class body that delegates to the same implementation: **runtime behavior,\n arguments, return type and raised errors are unchanged** — only the static surface is fixed.\n\n### 0.3.1 [NEVER PUBLISHED]\n\n> **Never published to PyPI.** This version was cut in-tree but no `bytekit-sdk` 0.3.1 artifact\n> exists — `pip install bytekit-sdk==0.3.1` fails. Everything below shipped to users in **0.3.2**,\n> which is the first published release containing it. Reconciled by issue #2680; the\n> `release-drift` CI gate now blocks a new phantom heading from being introduced.\n\n#### Fixed\n\n- **The \"never a bare `json.JSONDecodeError`\" guarantee is now package-wide across all\n generated operations**, not only the `AuthenticatedClient.search()` wrapper. Every\n generated operation previously called `response.json()` unconditionally on a\n DOCUMENTED status, so a `500`/`502` serving an HTML load-balancer page raised a bare\n `json.JSONDecodeError` from inside the SDK. All operations now parse documented\n statuses through a shared guard: a non-JSON body raises the typed\n `errors.UnexpectedStatus` (or returns `None` when\n `raise_on_unexpected_status=False`), carrying the status code and the raw body.\n- **`errors.UnexpectedStatus.code` / `.message` are now populated for generated\n operations too**, from the documented `Error` envelope — previously they were always\n `None` outside `search()`. A string-valued `error` (the masked search-provider `502`)\n still never enriches, so the upstream provider's identity is never surfaced.\n- Behavior on JSON bodies is unchanged: JSON success bodies still parse into their typed\n success models, documented JSON error bodies are still **returned** as typed `Error`\n models rather than raised, and `raise_on_unexpected_status` semantics are untouched.\n The documented non-JSON success paths — `get_fetch`/`post_fetch`'s raw-text `200` and\n `delete_monitor`'s empty `204` — are likewise unaffected.\n- **README error documentation corrected.** The quick-start example wrapped a call in\n `try/except UnexpectedStatus` and then read `response.formats.markdown`, but a\n documented `4xx` _returns_ a typed `Error` model without raising — so the documented\n example failed with `AttributeError: 'Error' object has no attribute 'formats'`. The\n README now documents the real two-tier contract, and the snippet is executed by\n `tests/test_readme_examples.py` so it cannot silently drift again.\n\n#### Documentation\n\n- Removed the contributor-only `Publishing`, `Regenerating`, and `Development` sections\n from the published README (the PyPI long description) — they described internal CI\n mechanics and a monorepo-contributor workflow that do not belong on a public package\n index. The regeneration/development knowledge is preserved in-repo in\n `packages/sdk-python/CLAUDE.md` (not shipped in the distribution).\n- Added a `## License` section and a `LICENSE` file, matching the npm sibling packages.\n\n### 0.3.0\n\n#### Breaking\n\n- **PyPI distribution renamed `bytekit` -> `bytekit-sdk`.** PyPI administratively\n denylists the bare name `bytekit`, so the package installs as\n `pip install bytekit-sdk`. The **import name is unchanged** — `import bytekit`\n still works, and no module path moved. Nothing was ever published under the old\n distribution name, so there is no migration for existing installs.\n- **`raise_on_unexpected_status` now defaults to `True`.** Undocumented response\n statuses now raise `errors.UnexpectedStatus` instead of silently returning `None`.\n Callers that relied on the old `None`-return behavior must pass\n `raise_on_unexpected_status=False` explicitly to opt out.\n- **`base_url` is now a keyword-only argument.** It gained a default\n (`https://api.bytekit.com`), and to satisfy attrs field ordering it became\n keyword-only. Any caller passing `base_url` positionally must switch to the\n `base_url=` keyword form. (`base_url=` was already the documented usage.)\n\n#### Added\n\n- `AuthenticatedClient(token=...)` now works out of the box against production:\n `base_url` defaults to `https://api.bytekit.com`.\n- Finite default request timeout of `120s` (`httpx.Timeout(120.0)`) — requests no\n longer hang indefinitely. Override with `timeout=`.\n- `errors.UnexpectedStatus` now carries optional `.code` / `.message` attributes.\n The `AuthenticatedClient.search()` wrapper populates them from the documented\n `Error` envelope, and safely raises a typed error (never a bare\n `json.JSONDecodeError`) on a non-JSON documented-status body such as an HTML 502.\n\n## @hunt-labs/bytekit-cli\n\nCommand-line client, published on npm. Binary: `bytekit`.\n\n### [Unreleased]\n\n### [0.8.1] - 2026-08-13\n\n#### Fixed\n\n- **`bytekit search` explains a malformed `200` instead of leaking a `TypeError`.** A server\n answering `200 {\"ok\":true}` — a proxy, a stub, a future envelope change — drove the human-mode\n renderer into `Error: response.results is not iterable`, which named an internal expression\n rather than the field the body was missing. It now reports, on one line and with no stack trace,\n `search: the response carries no \"results\" array — the server returned an unexpected 200 body. Re-run with --json to inspect it.`\n and exits `1`. A `results` value that is present but not an array is caught by the same gate: a\n **string** was previously iterated CHARACTER BY CHARACTER, printing one garbled row per character\n and exiting `0`. Unchanged: an empty `results: []` is still a successful zero-hit search that\n prints nothing and exits `0`; valid responses render byte-identically; and `--json` never reaches\n the renderer, so it keeps dumping the raw body at exit `0` — which is how you inspect an\n unexpected body.\n\n#### Added\n\n- **`screenshots … -o <file>` now says so when the filename contradicts the captured format.**\n `--format` is omitted far more often than not and the server default is **jpeg**, so\n `bytekit screenshots create --url … -o shot.png` wrote JPEG bytes into a `.png`-named file\n silently, at exit `0`; `screenshots get` has no `--format` flag at all, so it could not even be\n told what it was downloading. Both now print one advisory line to **stderr** —\n `Note: the screenshot was captured as jpeg, but shot.png names .png. The file holds jpeg bytes — pass --format png to capture it as png.`\n The captured format is read from the artifact URL's own path, which is the only place the CLI can\n observe it. **Advisory, not enforcement:** the bytes written and the exit code are unchanged, and\n the note goes to stderr, so `-o -` pipelines and stdout redirects stay byte-identical. It stays\n silent unless both the destination and the artifact name a recognized image format and the two\n differ — `.jpg` and `.jpeg` are the same format, and an extension-less destination, a non-image\n extension, `-o -`, or an artifact URL with no usable extension all make no claim to contradict. A\n not-ready poll is untouched: it still prints its bare id and poll note at exit `2`.\n\n#### Changed\n\n- **The README now documents the whole flag surface, and says which reference wins.** Every flag\n worked and every flag appeared in `--help`; the README simply framed subsets as exhaustive, so\n `bulk create`'s `--webhook-secret` / `--defaults` / `--metadata`, `scrape bulk create`'s\n `--custom`, `sitemap create`'s `--webhook-url` / `--webhook-secret` / `--cache-ttl` /\n `--compact` / `--process` / `--metadata`, `monitors create` and `monitors update`'s `--cron`\n (required with `--interval-type cron`) and `--metadata` plus the rest of `update`'s surface,\n `fetch create`'s ten markdown flags and `--custom`, and `screenshots create`'s `--headers` /\n `--cookies` / `--metadata` were all undocumented. All of them are documented now, and a note at\n the top of the README states that `--help` is the authoritative flag reference. **Required flags\n are marked as such** — `--file` and `--webhook-url` on all three bulk creators, `--url` /\n `--interval-type` / `--webhook-url` on `monitors create`, and `--url` on `scrape create`,\n `screenshots create`, `sitemap create` and both `fetch` verbs — so no reader mistakes one for\n optional. Note in particular that a **bulk job has no poll-only mode**: `--webhook-url` is\n mandatory there, unlike on `sitemap create` where omitting it really does mean poll-only. A test\n asserts the parity in the direction that matters — every flag the parser accepts must appear in\n the README — so this cannot drift again silently. No command, flag or behavior changed.\n\n- **Alignment-release note, carried forward from this version's original cut.** `0.8.0` published\n to npm at `2026-08-11T21:18:01.304Z`. Doc comments in `src/client.ts` and\n `src/package-version.ts` were reworded **after** the commit that introduced the `0.8.0` version\n string — they had re-spelled the `X-ByteKit-Client` header name in prose, which issue #2906's\n pre-merge gate 1 counts. No command, flag, exit code, or runtime behavior differs from `0.8.0`\n on account of _those_ comments.\n\n `0.8.1` was cut for that reason because `check-release-drift` (#2680) is version-gated and\n anchors on the commit that introduced a version, not on the commit whose tree was actually\n published. Once `0.8.0` reached npm, any shipped-file change after that anchor reads as\n post-release drift. Bumping moves the anchor past those comments. `0.8.1` had not yet reached\n npm when the entries above landed, so they ride this same pending release rather than stranding\n it as a never-published version.\n\n- **Corrected a false legacy-name claim carried since the rename (#2950).** The `0.8.0`-era note\n below said the prior `rapidcrawl-cli` name \"remains installable at its last version but is\n deprecated.\" Verified 2026-08-13: `rapidcrawl-cli` returns npm `404` (\"is not in this\n registry\"), and `npm deprecate rapidcrawl-cli@'*'` fails with the same `404` — there is no\n published version left for a deprecation notice to attach to, so the claim never held. No\n registry stub or deprecation was possible to publish (npm has nothing to act on); root\n `CLAUDE.md` carried the same false claim and is corrected alongside this entry. Users of the old\n name should install `@hunt-labs/bytekit-cli` directly. No command, flag, or runtime behavior\n changes.\n\n### [0.8.0] - 2026-08-11\n\n#### Added\n\n- **Every outgoing request now carries `X-ByteKit-Client: cli/<version>`.** The CLI identifies\n itself with the sanctioned `client_surface` marker (issue #2906, slice 3 of #2701), so `bytekit`\n usage is distinguishable in ByteKit's own analytics from both raw API calls (`api_direct`) and\n programmatic `@hunt-labs/bytekit-sdk` usage (`sdk_ts`) instead of being counted as one of them.\n `cli` is a member of the closed `client_surface` vocabulary declared in issue #2904; the version\n affix is this package's own version, resolved from `package.json` at runtime — the same value\n `bytekit --version` prints.\n\n Set at exactly ONE place — the header literal inside the private transport core all three CLI\n transports funnel through — so it rides on every command, on the JSON path, on the raw\n `/v1/fetch` path, and on the 429 retry attempt alike. **Nothing else about a request changed:**\n same `Authorization` and `Content-Type`, same body bytes, same per-attempt abort budget, same\n single-retry 429 behavior, same error taxonomy, same exit codes and output shapes. The marker\n carries no user data and cannot be set, overridden or read from the command line — `--headers`\n is a _scrape_ option that travels in the request body to the captured site, and never touches\n the CLI's own request headers.\n\n Minor rather than patch because the wire format of every request changes, even though no\n documented command behavior does. A gateway that does not yet recognize the header ignores it.\n\n### [0.7.1] - 2026-08-10\n\n#### Changed\n\n- Version-alignment release after the 2026-08-10 publish rescue: the published 0.7.0 artifact was built from the `main` promotion HEAD, which already contained every change documented under the 0.7.0 heading — but that commit postdates the one that introduced the 0.7.0 version string, so the `check-release-drift` gate (#2680) correctly reported shipped drift on every subsequent CI run (#2829). 0.7.1 realigns manifest ↔ registry ↔ version-introducing commit. **No consumer-visible change relative to the published 0.7.0.**\n\n### [0.7.0] - 2026-08-07\n\n#### Breaking\n\n- **A not-ready `screenshots get -o` / `screenshots create -o` now exits `2` and prints the bare\n `ss_` id, instead of exiting `1` with `not ready yet: screenshot is pending`.** The two poll\n commands disagreed: `scrape get --raw` on a still-queued scrape already wrote the bare `sc_` id\n to stdout and exited `2` — a distinct, scriptable \"accepted but not ready\" signal — while the\n screenshots side reported the same state as a failure and threw the handle away, so a polling\n script could branch on \"queued\" for one command and not the other. The screenshots branch now\n mirrors scrape exactly: bare `ss_` id on stdout, a poll note on stderr, exit `2`, and (as before)\n no file written. A script that treated any non-zero exit as \"this screenshot failed\" now sees `2`\n for a job that is merely still running — branch on the code (`2` = poll again, `1` = failed)\n rather than on non-zero. Three states deliberately do **not** move: a terminally `failed`\n screenshot stays exit `1` with its error surfaced (it will never complete, so a \"poll again\"\n signal would loop a script forever), an envelope carrying no `ss_` id stays exit `1` (there is no\n handle to hand back), and `--json` keeps the envelope at exit `0`.\n- **`--json` on a `fetch` command now emits `X-Fetch-ID` and `X-Fetch-URL`, not `X-Fetch-Id` and\n `X-Fetch-Url`.** The metadata keys were derived by a generic segment-wise Title-Caser, which\n lowercases every non-initial character of a segment — so the two acronym-bearing headers came out\n in a spelling the API reference never uses, and a `jq '.\"X-Fetch-ID\"'` filter written from the\n docs returned `null`. All 16 `X-Fetch-*` keys now match the spec names byte-for-byte. The\n **values** are unchanged, the non-`X-Fetch-*` headers stay filtered out, and every other key\n (`X-Fetch-Waf-Vendor`, `X-Fetch-Duration-Ms`, `X-Fetch-Fast-Path`, …) is spelled exactly as\n before. A consumer reading `.[\"X-Fetch-Id\"]` must switch to `.[\"X-Fetch-ID\"]`.\n\n#### Fixed\n\n- **A `screenshots get -o` / `screenshots create -o` poll only says \"poll again\" for a `pending` or\n `processing` screenshot.** The not-ready predicate decided from the presence of an `image_url`,\n an `id` and a nested error alone — `status` was read only to phrase the message — so a\n `completed` screenshot whose `image_url` never materialized, a status outside the closed enum,\n and the flat `error_code`/`error_message` failed shape all received exit `2` and \"no image\n artifact is available yet. Poll it with: …\" for a job that would never complete. Those states now\n exit `1`: a terminal failure prints `screenshot failed: …`, and any other artifact-less state\n prints `no image artifact available: screenshot is <status>`. Genuine `pending` / `processing`\n polls keep the bare `ss_` id, the poll note and exit `2` exactly as before — **including** a\n poll whose envelope carries an `error_code` from an attempt that failed and is being retried,\n since the status, not the error, decides whether polling can still help. `--json` still prints\n the envelope at exit `0`.\n- **A terminally failed screenshot reported through the spec's flat `error_code`/`error_message`\n fields now reaches stderr.** Only the nested `{error:{code,message}}` envelope was read, so the\n shape `ScreenshotResponse` actually declares surfaced neither code nor message. It now prints\n `screenshot failed: <message> (<code>)` — the formatting `scrape get --raw` already uses for a\n failed scrape. The nested envelope's own message is unchanged.\n- **`scrape get --raw` on a terminally failed scrape now reports why it failed.** It printed\n `--raw: response contains no formats` — technically true of a `ScrapeErrorEnvelope`, and the one\n diagnostic that cannot explain anything — while the envelope's own `error.code` and\n `error.message` never reached the caller. Both now go to stderr (exit `1`, unchanged). The\n failure is reported ahead of the format diagnostics, so an envelope carrying both a failure and\n an empty `formats: {}` still says why it failed rather than pointing at a `--format` choice that\n cannot help.\n- **An empty-formats success now names the warning that explains it.** A completed scrape whose\n persisted artifact could not be rehydrated comes back with `formats: {}` and an\n `artifact_unavailable` warning; `--raw` rendered that as `--raw requires --format when the\nresponse contains multiple formats`, which is false on both counts. It now names the warning's\n code and message, or says plainly that the formats map is empty when no warning explains it.\n- **Error paths no longer risk losing their own diagnostic.** `handleError` and the missing-API-key\n path each wrote to stderr and then immediately hard-`process.exit(1)`. Node's stderr is\n asynchronous when it points at a pipe, and `process.exit` discards whatever is still queued — so\n the one line a script greps was the line most at risk of being thrown away, which is exactly the\n defect this package's flush policy exists to prevent. Both now set `process.exitCode` and let the\n process end naturally once stderr has drained. The exit codes and the rendered messages are\n byte-identical.\n- `--headers`, `--custom` and `--metadata` said `must be valid JSON (a object)` on a malformed\n value; the article now agrees — `an object` / `an array`.\n- The `[0.6.0]` link reference, missing from the bottom of this file, is restored.\n\n### [0.6.0] - 2026-07-29\n\n#### Breaking\n\n- **`screenshots create --async` now exits `2` in human mode instead of `0`.** The queued 202 is\n not a completed capture — there is no artifact yet — and every other queued path in the CLI\n already signalled that with exit code `2` (`scrape create --async`). A script that relied on\n exit `0` to mean \"the screenshot is ready\" was reading a false success; under `set -e` such a\n script now stops at the queue step, which is the intended correction. The envelope itself is\n unchanged and still printed. Two carve-outs: **`--json` keeps exit `0`** (the envelope is a\n complete machine-readable payload — identical to `scrape create --async --json`), and\n `--async -o <file>` also exits `2` while still writing no file (it prints the queued envelope\n and skips the download, as before). Poll with `bytekit screenshots get <id>`.\n- **A `--file` per-item key outside a bulk endpoint's own strict schema now fails the whole\n create with a `422`** instead of silently succeeding with that key ignored. In 0.5.x, `--file`\n never read anything but `url` from a JSON line — every other key was dropped client-side\n before the request was ever built. As of 0.6.0 those keys ride to the server (`items` on\n `bulk create` / `scrape bulk create`; inside `urls` on `fetch bulk create`), and `/v1/bulk` /\n `/v1/scrape/bulk` reject any key their `.strict()` per-item schema doesn't recognize. A file\n that worked in 0.5.x purely because its extra keys were quietly discarded may now `422` — see\n each command's `--file` help for the keys actually honored on that endpoint.\n- **`fetch bulk create --file` per-item keys outside `url`/`format`/`country`/`cache_ttl` now\n fail the whole create with a `422`** instead of silently succeeding with that key ignored.\n `/v1/fetch/bulk`'s per-item override schema (inside `urls[]`) is now `.strict()` on the\n gateway (issue #2648), matching the `/v1/bulk` / `/v1/scrape/bulk` posture above. The\n `--file` help text for `fetch bulk create` is now uniform with `bulk create` /\n `scrape bulk create` and no longer enumerates keys — this entry is where the honored set\n (`url`, `format`, `country`, `cache_ttl`) is documented instead.\n\n#### Added\n\n- **Per-item bulk configuration on all three bulk creates** (`bulk create`, `scrape bulk create`,\n `fetch bulk create`). A `--file` line may now be a JSON object carrying `url` plus per-item\n fields instead of only a bare URL; such a file is sent as `items` on `/v1/bulk` and\n `/v1/scrape/bulk`, and as a heterogeneous `urls` array on `/v1/fetch/bulk` (which has no\n `items` property). A line whose only key is `url` still normalizes to a bare URL string, so a\n file of url-only lines produces a byte-identical request to before. A JSON line with a missing\n or non-string `url` is now rejected locally with a usage error (exit `1`) instead of being sent\n to the server as a URL. (See Breaking, above, for the per-item strict-schema behavior change\n this enables.)\n- `--defaults`, `--webhook-secret` and `--metadata` on all three bulk creates, plus `--custom` on\n `scrape bulk create` only (`/v1/bulk` and `/v1/fetch/bulk` have no top-level `custom`, so the\n flag would be rejected or stripped there). `--defaults` is forwarded verbatim; the server owns\n precedence and unknown-key handling.\n- The full markdown-tuning surface on `fetch create`: `--markdown-query`, `--markdown-links`,\n `--markdown-images`, `--with-links-summary`, `--with-images-summary`, `--markdown-compact`,\n `--markdown-filter-images`, `--markdown-include-media`, `--markdown-include-warnings`,\n `--markdown-include-stats`, and `--custom`.\n- Webhook delivery and processing flags on `sitemap create`: `--webhook-url`, `--webhook-secret`,\n `--cache-ttl`, `--compact`, `--process`, `--metadata`. Webhook-driven sitemap crawls were\n previously unreachable from the shell.\n- `--headers`, `--cookies` and `--metadata` on `screenshots create`.\n- `--metadata` on `monitors create`, and `--metadata` + `--url` on `monitors update`. `--type`\n remains deliberately absent from `update` — it is immutable server-side.\n\n### [0.5.1] - 2026-07-28 [NEVER PUBLISHED]\n\n> **Never published to npm.** This version was cut in-tree but no `@hunt-labs/bytekit-cli@0.5.1`\n> tarball exists — `npm i @hunt-labs/bytekit-cli@0.5.1` fails. Everything below shipped to users in\n> **0.6.0**, which is the first published release containing it. Reconciled by issue #2680; the\n> `release-drift` CI gate now blocks a new phantom heading from being introduced.\n\n#### Fixed\n\n- **Corrects the scope of the 0.5.0 \"stalled body\" fix claim.** `screenshots create`/`get -o`\n downloads the `image_url` artifact bytes with a bare `globalThis.fetch` call\n (`lib/download-artifact.ts`) that sat entirely outside the transport seam `sendWithRetry` owns —\n no abort signal, no connection-error taxonomy. The 0.5.0 entry below (\"The per-attempt request\n timeout now covers the response body read... a server that answered with headers and then\n stalled its body... hung the CLI forever\", #2546) reads as if it covered every response body; it\n only ever covered API-call bodies read through the JSON/raw transports. A stalled artifact host\n (headers, then a body that never completes) still hung the CLI indefinitely until now. The\n download path now shares the same per-attempt abort budget and `ByteKitConnectionError` timeout\n taxonomy as the API transport (`createAttemptBudget` / `toConnectionError`, exported from\n `client.ts` — no second timeout implementation), with the same 120 s per-attempt default and no\n retry (artifact GETs are not the API's 429 domain). Partial-file policy: the response is\n buffered fully in memory before any write, so an aborted download never leaves a\n partial/truncated file at the `-o` destination. **User-visible consequence:** a legitimately\n slow (but not stalled) large artifact download now hard-fails after 120 s instead of waiting\n indefinitely, and there is currently no CLI flag to raise that budget for a single command.\n (#2587)\n- While in the file: the 429-retry path left its (unread) response body undrained before sleeping\n and retrying — undici cannot reclaim the underlying socket for connection-pool reuse until a body\n is fully read. The body is now drained with `response.text()` on that path, bounded by its own\n short (2 s) cap independent of the 120 s per-attempt budget, so a 429 whose body stalls can no\n longer delay the retry by anywhere near the full attempt budget (or, with the budget disabled,\n forever). **Correction to an intermediate `Unreleased` draft of this same fix:** that draft's cap\n only bounded how long the _retry_ waited — it resolved on schedule but never touched the\n abandoned `response.text()` call itself, which kept reading against a live socket indefinitely.\n Because every CLI success path exits via a soft `process.exitCode` (#2544) rather than\n `process.exit()`, that orphaned read kept the whole process alive forever — strictly worse than\n having no drain at all, and on the exact class of hang this ticket exists to eliminate. The cap\n now also **aborts** the request when it fires, so the abandoned read is actually torn down, not\n merely ignored; this holds even when the per-attempt timeout itself is disabled\n (`timeoutMs <= 0`). **User-visible consequence:** a 429 with a stalled body still costs the retry\n at most ~2 s, exactly as before, but the CLI process now reliably exits afterward instead of\n hanging forever regardless of that visible latency. The same discard-drain on the\n artifact-download's non-2xx path is removed outright rather than capped: that path throws\n straight into `process.exit(1)`, so there is no subsequent request in the process for a reclaimed\n socket to serve, and the drain there bought nothing. (#2587)\n\n### [0.5.0] - 2026-07-24\n\n#### Note\n\n- The `0.3.1` and `0.4.0` versions below document real, tagged changes but were\n never published to npm — the registry's version history jumps straight from\n `0.3.0` to `0.5.0`. Don't go looking for those tarballs; the changes they\n describe ship for the first time in this release.\n\n#### Added\n\n- Surface parity round 2 (#2545): every `x-sdk-scope: v0.1` endpoint the SDK\n exposes now has a CLI command, and the high-value request fields are reachable\n by flags. Each new flag follows the omit-when-absent rule — absent → the key is\n left out of the request, so a server default is never materialized.\n - **New command groups:** `usage get | daily | by-endpoint` (billing-period\n usage reporting), `webhook-deliveries list | retry <id>` (inspect and requeue\n deliveries), and `bulk cancel <id>` (stop an in-flight bulk job).\n - **Monitor pause/resume:** `monitors update --status paused` / `--status active`.\n `monitors create`/`update` also gain `--change-threshold` (float), `--notify-on`,\n `--webhook-secret`, and the JSON-object flags `--webhook-headers`, `--options`,\n `--scrape-options`. `--type` is **create-only** (a monitor's type is immutable).\n - **`scrape create` multi-format `--format`:** repeatable AND comma-separated —\n `--format raw_html --format markdown` and `--format raw_html,markdown` both send\n `formats: [\"raw_html\",\"markdown\"]`. Raw output (`--raw`/`-o`) requires exactly one\n format. New scrape flags: `--cache-ttl`, `--markdown-query`, `--cookies`,\n `--headers`, `--delay-ms`, `--events`, `--token-encoding`, `--custom`,\n `--remove-base64-images` / `--no-remove-base64-images` (tri-state), and the\n `--markdown-*` / `--with-*-summary` family.\n - **`scrape get --raw` / `-o` / `--format`:** retrieve a completed queued scrape's\n body from the shell (a still-queued job prints the id and exits `2`).\n - **`screenshots create`:** `--block-ads`/`--no-block-ads`,\n `--block-cookie-banners`/`--no-block-cookie-banners`, `--scroll`/`--no-scroll`\n (tri-state pairs), `--wait-for-selector`, `--delay-ms`, `--dark-mode`,\n `--device-scale-factor`, `--include-html`, `--country`, `--language`.\n - **`fetch create` / `fetch get`:** `--country`, `--timeout-ms`, `--cache-ttl`\n (both verbs); `--markdown-mode` (create only).\n - **`sitemap create`:** `--strategy`, `--max-depth`, `--max-urls`.\n\n#### Fixed\n\n- `--json` no longer emits the literal text `undefined` — which is not valid JSON —\n for a response with no body. `JSON.stringify(undefined)` returns the _value_\n `undefined`, so `bytekit monitors delete <id> --json | jq .` failed with a parse\n error on every delete, and `--json -o <file>` on the same response crashed with\n `ERR_INVALID_ARG_TYPE` instead of writing anything. Every `--json` code path now\n serializes through one helper. (#2544)\n- `scrape create --async --raw` (and the bare `-o` form) no longer risks losing the\n `sc_` id it writes. The id went to stdout immediately followed by a hard\n `process.exit(2)`; Node documents `process.stdout` as **asynchronous** when it\n points at a pipe, so anything still queued at that moment is discarded — exactly\n the `sc_id=$(bytekit scrape create … --async --raw)` capture the flag exists for.\n The queued signal is now a soft `process.exitCode`, so the process ends naturally\n once stdout has drained. The exit code is unchanged. (#2544)\n- The per-attempt request timeout now covers the **response body read**, not just the\n time to first byte of headers. The abort budget was armed for `fetch` and cleared the\n moment headers arrived, after which reading the body was unbounded — so a server that\n answered with headers and then stalled its body (including a non-2xx whose error body\n never finished) hung the CLI forever. The budget now spans headers **and** body on both\n transports (`request` and the `/v1/fetch` raw path), and a mid-body abort surfaces as\n the usual `ByteKitConnectionError` with `code: 'timeout'`.\n\n The default is **unchanged at 120 s**, and the budget is still **per attempt** — the\n single 429 retry and its backoff sleep still get a fresh full budget. One consequence\n worth planning for: a legitimately large body (a multi-MB `/v1/fetch` document) now\n counts against that same 120 s, where previously only the wait for headers did. (#2546)\n\n#### Documented\n\n- **Output contract:** with `--json`, a `204 No Content` response (e.g.\n `monitors delete`) renders as JSON `null`. Human mode still prints nothing for\n the same response. (#2544)\n- **Exit codes** now have their own README section. In particular exit code `2` —\n \"accepted but still queued\", emitted by `scrape create --async` in raw and human\n modes — was previously documented nowhere despite being observable since 0.3.0.\n It is deliberately neither `0` (a content-body success) nor `1` (an error). (#2544)\n- Corrected two false README claims about `scrape` output: a bare `-o` implies\n `--raw` and writes the requested format's **body** (it does not write \"the same\n text rendering the terminal would show\"), and `--async --raw` prints the **bare\n `sc_` id** on stdout with a note on stderr (it does not print the queued job\n envelope). (#2544)\n\n### [0.4.0] - 2026-07-23 [NEVER PUBLISHED]\n\n> **Never published to npm.** This version was cut in-tree but no `@hunt-labs/bytekit-cli@0.4.0`\n> tarball exists — `npm i @hunt-labs/bytekit-cli@0.4.0` fails. Everything below shipped to users in\n> **0.5.0**, which is the first published release containing it. Reconciled by issue #2680; the\n> `release-drift` CI gate now blocks a new phantom heading from being introduced.\n\n#### Removed (**BREAKING**)\n\n- The entire `bytekit account api-keys` command group — `create`, `list`, `get`,\n `update`, `reveal`, and `revoke`. Every one of these subcommands was\n structurally unreachable: they target `/v1/account/api-keys*`, which the API\n mounts behind a **Clerk dashboard session** and marks `x-internal` in the\n OpenAPI spec. The CLI's only credential is a bearer `sk_` API key, which can\n never satisfy a session verifier, so all six returned `401 unauthorized` in\n every published version. Running one now exits `1` with\n `error: unknown command 'api-keys'`.\n\n Key management was deliberately NOT moved onto bearer auth. The reveal\n operation returns the **live plaintext** of any key on the account, and there\n is no per-key scope or permission model, so accepting API-key auth there would\n turn any leaked key into a self-perpetuating credential factory.\n\n **Replacement:** manage API keys from the dashboard at\n [app.bytekit.com](https://app.bytekit.com). (#2536)\n\n### [0.3.1] - 2026-07-22 [NEVER PUBLISHED]\n\n> **Never published to npm.** This version was cut in-tree but no `@hunt-labs/bytekit-cli@0.3.1`\n> tarball exists — `npm i @hunt-labs/bytekit-cli@0.3.1` fails. Everything below shipped to users in\n> **0.5.0**, which is the first published release containing it (0.4.0 was never published either —\n> see its heading above). Reconciled by issue #2680; the `release-drift` CI gate now blocks a new\n> phantom heading from being introduced.\n\n#### Fixed\n\n- `bytekit fetch get` / `fetch create` print the fetched content again. **0.3.0's\n claim that fetch \"prints the raw body by default, or the `X-Fetch-*` metadata\n as JSON with `--json`\" was not true of the shipped artifact**: the CLI replaced\n only `client.request`, but SDK 0.3.0 moved `/v1/fetch` onto `client.requestRaw`,\n so the CLI's raw-body branch was unreachable and every fetch fell through to the\n generic key/value printer — emitting `body: …`, a JSON map of every byte under\n `bytes:`, and `headers: {}`. The CLI now overrides BOTH transport seams and\n renders the SDK's real `FetchResult`. Binary content is byte-exact in every\n mode. (#2535)\n- Fetch commands honor the CLI's single 429 retry again. Riding the\n un-overridden SDK transport also bypassed the retry, the per-attempt 120 s\n timeout, and the connection-error taxonomy; all three now apply to fetch\n exactly as they do to the JSON commands. (#2535)\n\n#### Added\n\n- `-o, --output <file>` on `fetch get` / `fetch create`: writes the fetched body\n bytes to a file, byte-for-byte (with `--json`, writes the `X-Fetch-*` metadata\n object instead). (#2535)\n\n### [0.3.0] - 2026-07-21\n\n#### Removed (**BREAKING**)\n\n- The legacy `RAPIDCRAWL_API_KEY` and `RAPIDCRAWL_BASE_URL` environment-variable\n fallbacks (kept as a one-minor-version bridge in #2421) are removed. Use\n `BYTEKIT_API_KEY` and `BYTEKIT_BASE_URL` (or the `--key` / `--base-url` flags).\n (#2473)\n\n#### Fixed\n\n- `bytekit fetch get` / `fetch create` no longer crash on non-JSON bodies. The\n transport JSON-parsed every 2xx response, but `/v1/fetch` returns the fetched\n content AS the body. The fetch command now prints the raw body by default, or\n the `X-Fetch-*` metadata as JSON with `--json`; `fetch bulk` and every other\n command still parse JSON. (#2467)\n- `204 No Content` / empty-body responses (e.g. `monitors delete`,\n `account api-keys revoke`) no longer throw a JSON-parse error, including after\n a 429 retry. (#2467, #2468)\n- `search --type images` no longer prints an `undefined` snippet line for\n results that omit the field. (#2479)\n\n#### Added\n\n- `scrape create` accepts the full `ScrapeRequest` surface: `--country`,\n `--timeout-ms`, `--markdown-mode`, `--async`, `--webhook-url`,\n `--token-budget`, `--clean-markdown`, `--include-tags`, `--exclude-tags`,\n `--mobile`. Each flag is omitted from the request when absent. (#2480)\n- `screenshots create` accepts `--device`, `--viewport WxH`, `--format`,\n `--quality`, `--wait-until`, `--clip x,y,w,h`, and `--async`; `-o <file>`\n on `screenshots create`/`get` downloads the captured image bytes (`-o -` for\n stdout). `-o` cannot be combined with `--json` on screenshots. (#2480)\n- `monitors list` accepts `--limit`, `--cursor`, and `--status` query\n filters. (#2480)\n- `account api-keys reveal <ak_id>`: prints the key masked by default\n (`sk_live_…2345`); pass `--show` for the full plaintext. (#2480)\n- Per-attempt transport timeout (120s, mirroring the SDK default): a hung\n request now fails with `code: 'timeout'` instead of hanging forever. Network\n failures are mapped onto the SDK's connection-error taxonomy\n (`timeout` / `aborted` / `connection`), and error output renders the API or\n connection error code. (#2479)\n- A queued async job (HTTP 202) under `--raw` prints the job envelope with its\n `sc_` id instead of an empty body. (#2479)\n\n#### Changed (**BREAKING**)\n\n- `fetch --format` is validated locally against the spec union\n `'markdown' | 'html'`; off-spec values are rejected with a clear error before\n a request is sent (previously forwarded as-is). (#2475)\n\n### [0.2.2] - 2026-07-16\n\n#### Changed\n\n- Re-release of 0.2.1. The 0.2.1 artifacts never reached npm — the prod publish's\n `publish-sdk` step failed on a CI test-isolation flake (`cjs-require.test.ts`\n rebuilding the shared `dist`), which is now fixed. No consumer-facing changes\n beyond 0.2.1.\n\n### [0.2.1] - 2026-07-16 [NEVER PUBLISHED]\n\n> **Never published to npm.** This version was cut in-tree but no `@hunt-labs/bytekit-cli@0.2.1`\n> tarball exists — `npm i @hunt-labs/bytekit-cli@0.2.1` fails. Everything below shipped to users in\n> **0.2.2**, which is the first published release containing it. Reconciled by issue #2680; the\n> `release-drift` CI gate now blocks a new phantom heading from being introduced.\n\n#### Changed\n\n- `BYTEKIT_API_KEY` / `BYTEKIT_BASE_URL` are now the primary environment\n variables (precedence: flag > `BYTEKIT_*` > legacy `RAPIDCRAWL_*`).\n `RAPIDCRAWL_API_KEY` / `RAPIDCRAWL_BASE_URL` continue to work as silent\n fallbacks. `--help` text, the missing-key error, and the README now reference\n `BYTEKIT_*`. (#2421)\n\n#### Removed\n\n- The `recordings` command (the endpoint is permanently `410` deactivated). (#2421)\n\n### [0.2.0] - 2026-07-15\n\nAdditive, lower-risk release — no breaking changes to existing commands.\n\n#### Added\n\n- `scrape create --raw` / `-o, --output <file>`: write the raw response body to\n stdout or a file (#2425).\n- Local `search --limit` validation via a commander `argParser`, so an invalid limit\n is rejected before a request is sent (#2425).\n- One automatic retry on HTTP 429, honoring a clamped `Retry-After` header, in the\n CLI transport (#2425).\n\n#### Fixed\n\n- Entrypoint guard canonicalized so the `bytekit` bin runs correctly when invoked\n through an npm/npx symlink (#2418).\n\n#### Changed\n\n- Package renamed to `@hunt-labs/bytekit-cli` (the `@bytekit` npm scope was\n unobtainable); the `bin` name stays `bytekit`. ~~The prior `rapidcrawl-cli` name\n remains installable at its last version but is deprecated.~~ **Corrected in\n 0.8.1 (see below): that claim does not hold — `rapidcrawl-cli` 404s on npm and\n there is no published version left to deprecate.**\n- Consumer call sites propagate the SDK's narrowed, spec-derived request types (#2426).\n- Publish-ready packaging metadata: dropped `main`, unpinned the SDK dependency to\n `workspace:^`, added `engines`, `keywords`, `homepage`, `bugs`, `README.md`,\n `LICENSE`, and an MIT `license` field.\n\n### [0.1.0] - 2026-07-13\n\n#### Added\n\n- Initial release of the ByteKit CLI, wrapping the ByteKit SDK as shell\n subcommands, published under the original `rapidcrawl-cli` name.\n\n## @hunt-labs/bytekit-mcp\n\nMCP server, published on npm.\n\n### [Unreleased]\n\n### [0.2.8] - 2026-08-19\n\n#### Changed\n\n- **The generated scrape contract's billing factor vocabulary gained `phase1_render`** (#3141).\n `BillingFactorName` is a closed union copied verbatim into `src/scrape-contract.generated.ts`,\n and screenshots and recordings bill on a basis the byte-scrape factors cannot name — Phase 1\n proxy wire bytes times a 1.5 render-overhead multiplier. A capture's billing node carries that\n one factor and none of the byte-scrape names; the two vocabularies never mix on a single node.\n This release is a regeneration of the checked-in contract only, with no behavior change in the\n server itself: the MCP tools do not call the capture endpoints whose responses now carry the\n node.\n\n### [0.2.7] - 2026-08-18\n\n#### Changed\n\n- **The generated scrape contract now carries the `billing` node** (#3139). `ScrapeSuccessEnvelope`\n gained an optional `billing` object with `raw_bytes`, an ordered `factors` list of\n `name`/`value`/`reason` entries, `multiplier` and `billed_bytes`. The factor list explains\n exactly how a scrape's charge was composed — endpoint factor, cache-hit discount, clean-markdown\n surcharge — and multiplies out to the `X-Billing-Multiplier` on the same response. The existing\n flat `billing_multiplier` / `billed_bytes` pair is unchanged and still emitted beside it; this\n release is a regeneration of the checked-in contract only, with no behavior change in the server\n itself.\n\n### [0.2.6] - 2026-08-12\n\n#### Changed\n\n- **`scrape_url` now sends the public `raw_html` format spelling on the wire** (#2959). It\n previously translated the `raw_html` an agent asks for into the gateway's internal `rawHtml`\n before calling the API. That request only succeeded because the gateway happens to accept both\n spellings — nothing in the published API contract promised it, so this server depended on an\n undocumented leniency it could not see. It now sends what the spec documents.\n\n **No change to what the tool accepts:** `raw_html` and the legacy `rawHtml` are both still\n valid `formats` values, and results are rendered identically. The bundled `libraries/typescript`\n doc page also gained the `search`, `usage` and `webhooks` resources it had been omitting.\n\n#### Added\n\n- The published docs bundle now includes the five billing guides linked from the pricing page:\n balance, bandwidth, credits, spending, and top-ups. The guides describe the source-backed\n charging, expiry, rollover, and quota behavior. (#2960)\n\n#### Fixed\n\n- A validation failure from the API now reaches the agent as `validation_error: <message>` from\n every tool, instead of a bare `Invalid request body. ({\"formErrors\":[],\"fieldErrors\":{…}})`\n with the error code stripped off. `scrape_url` and `screenshot_url` are the two tools\n affected: the client's 422 handling rendered a screenshot's failed-capture body as\n `code: message` but passed a validation envelope's message through verbatim, so which\n spelling an agent saw depended on the HTTP status the endpoint happened to pick — the same\n vocabulary already rendered `validation_error: …` on a 400. The field details are unchanged,\n and so are `web_search`'s render, the concurrency-limit advice, and the 401/402 guidance\n messages. (#2955)\n- The hosted `/mcp` endpoint now rejects a missing or invalid API key with a JSON-RPC error body\n (`{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-32000,…},\"id\":null}`, HTTP 401) rather than the REST\n capture envelope, so an MCP host that parses `/mcp` responses as JSON-RPC can read the failure\n it is most likely to hit. Every other transport-level failure on that endpoint already spoke\n JSON-RPC (405 on GET/DELETE, `-32700` on a malformed body, 406 on `Accept`). The ByteKit code\n (`invalid_api_key`) is preserved on JSON-RPC's `data` member, and the capture endpoints' 401\n envelope is untouched. (#2955)\n- The 26 SDK reference pages in the docs bundle (`sdk/python/*`, `sdk/typescript/*`) no longer\n open with their title and description twice, so `get_doc` and `search_docs` stop spending\n tokens on a duplicated preamble and search snippets stop reading doubled. The docs site's\n LLM markdown composer prepended a synthesized `# <title>` + description block\n unconditionally, on top of the generator-authored SDK bodies that already carry their own\n H1 and intro paragraph; it now yields the title block to a body that leads with an H1. The\n other 77 bundled pages are byte-identical. `sdk/python/client`'s body heading was also\n aligned to its page title (`# Client Reference` → `# Client`), the one SDK page where the\n two disagreed. (#2953)\n- The screenshot render's signed-URL note no longer presents the plan's artifact-retention\n date (`expires_at`, ~30 days out) as the signed image URL's expiry. The URL is a B2-signed\n link that dies ~10 minutes after issue (`X-Amz-Expires=600`) regardless of retention; the\n note now always states that ~600s signature expiry, so an agent following it no longer\n stashes a link that reads as good for weeks and is already dead. `expires_at` itself is\n untouched — it remains correct for plan retention everywhere else. (#2947)\n- An unknown flag (e.g. `--bogus-flag`) or the space-form `--timeout-ms -5` (which\n `node:util`'s `parseArgs` itself rejects as an ambiguous option value, before it ever\n reaches the existing `--timeout-ms` validation) no longer crashes with a raw\n `node:internal/util/parse_args` stack trace. Both now render the same one-line\n `Error: ...` message the binary already used for `--help`, a missing API key, and the\n equals-form/non-numeric `--timeout-ms` cases — parse-layer failures and value-validation\n failures render through one error path. `--help`, the missing-key message, and the\n existing `--timeout-ms abc` / `--timeout-ms=-5` errors are unchanged. (#2952)\n\n### [0.2.5] - 2026-08-11\n\n#### Added\n\n- Every outbound request now carries `X-ByteKit-Client: mcp/<package version>`, the\n `client_surface` attribution marker defined by the Track A analytics contract (#2904),\n so requests made by the published `@hunt-labs/bytekit-mcp` server can be told apart\n from `api_direct` and the other published clients. Set once, unconditionally, at the\n client's single header-construction site — it does not ride along with `Authorization`\n and is not affected by the in-process gateway dispatch path (issue #1182). (#2907)\n\n### [0.2.4] - 2026-08-10\n\n#### Changed\n\n- Version-alignment release after the 2026-08-10 publish rescue: the published 0.2.3 artifact was built from the `main` promotion HEAD, which already contained every change documented under the 0.2.3 heading — but that commit postdates the one that introduced the 0.2.3 version string, so the `check-release-drift` gate (#2680) correctly reported shipped drift on every subsequent CI run (#2829). 0.2.4 realigns manifest ↔ registry ↔ version-introducing commit. **No consumer-visible change relative to the published 0.2.3.**\n\n### [0.2.3] - 2026-08-07\n\n#### Added\n\n- `scrape_url` / `get_result` render a zero-count `Links (0):` / `Images (0):` header for\n a format you requested that came back empty, so \"the page has none\" is no longer\n indistinguishable from \"the format was not returned\". A format you did not request\n still renders nothing at all. (#2687)\n- The queued-scrape render carries the spec-required `events` array, and the success\n render carries `content_length` — the compressed upstream wire-byte count that is the\n billing basis for the call, which nothing else in the output surfaced. (#2687)\n- Screenshot renders carry `page_title` (a spec field the tool description already\n promised as \"metadata\") and a note that `image_url` is a signed link with a short\n lifetime, using the concrete `expires_at` instant when the API supplies one. (#2687)\n- A queued scrape now gets the same \"Use `get_result` with this ID to check when it\n completes.\" guidance a pending screenshot got in 0.2.2. (#2687)\n- `screenshot_url` exposes `quality`, `dark_mode`, `country` and `language`. None of them\n can reach the queued outcome; `quality` and `dark_mode` are additionally cost-neutral (a\n screenshot bills on the phase-1 fetch's wire bytes, never the artifact size), while\n `country`/`language` change which page the origin serves and so can change that figure.\n `token_budget`, `clean_markdown` and `cache_ttl` stay unexposed on `scrape_url`, each\n for a reason recorded in `src/tools/scrape-url.ts`. (#2687)\n- **New output contract.** `scrape_url` / `get_result` render the envelope's `warnings`\n under a `Warnings (N):` section, one `code: message (element)` line per warning, on both\n the success and the terminal-failure render. The `(element)` suffix is omitted for the\n whole-extraction codes that carry no element. Nothing rendered them before, so an\n `artifact_unavailable` — a format you requested and were billed for is missing from the\n response — was indistinguishable from a page that simply had none of it. The block is\n budgeted inside the same 100KB cap as the content, ahead of the links/images sections, so\n a long links list cannot crowd a failure signal out. A `warnings` array that is empty or\n absent renders nothing, exactly as before. (#2679)\n\n#### Fixed\n\n- **Compile-time breaking for TypeScript consumers that read `SearchResult.snippet` or\n `SearchResult.date` unguarded.** Both were declared required on the exported\n `SearchResult` type, but `POST /v1/search` omits both keys for `type: 'images'`\n results — `docs/api/openapi.yaml` declares `required: [position, title, url]` and\n nothing else for a search result. Reading `result.snippet.length` therefore compiled\n under strict TypeScript and threw at runtime on any images result. They are now\n `snippet?: string` and `date?: string | null`. Runtime behaviour is unchanged — the\n server has always passed the API's JSON through verbatim, and no MCP tool output\n moved; what changes is that `tsc` now requires a guard (`result.snippet?.length`, or\n an `if (result.snippet !== undefined)` narrowing) at every read site. `web`/`news`\n results still carry both fields and `date` is still nullable there, so `null`\n (the provider reported no date) stays distinguishable from absent (the index carries\n no such field at all). (#2781)\n- The hosted `/mcp` transport and a local `npx` install now render invalid-argument errors\n identically. They had diverged — hosted returned the raw Zod issue-array JSON where\n stdio returned the flattened `Required at url` — and the cause was neither a stale\n deploy nor a difference in ByteKit source: both transports share one server factory, and\n the text is produced inside `@modelcontextprotocol/sdk`. What differed was the SDK\n version each side resolved. `@modelcontextprotocol/sdk` 1.30.0 rewrote\n `getParseErrorMessage` to format Zod issues as `<message> at <path>`, where 1.29.0 fell\n through to `ZodError.message` (the raw JSON array). The hosted image builds with a frozen\n lockfile, which still pinned 1.29.0, while the unpinned `^1.12.1` range let an `npx`\n consumer resolve 1.30.0. The lockfile is now bumped to 1.30.0 so both sides run the same\n SDK; the declared range is deliberately left at `^1.12.1` so upstream fixes keep\n arriving. (#2682)\n- A truncated links or images list is cut between whole entries instead of mid-URL, and\n each affected section is annotated with `[Links truncated: N of M entries shown]`, so\n the section header's count stays reconcilable with what was actually returned. The\n markers are spent from the same 100KB budget, not appended on top of it. (#2687)\n- `web_search` no longer prints the API error code twice\n (`validation_error: … (validation_error)`); the code is appended only when the message\n does not already carry it. (#2687)\n- `scrape_url` rejects `formats: []` at the schema boundary — matching the API's own\n `minItems: 1` — instead of forwarding it and returning a server 422. Omitting the\n parameter still yields the `[\"markdown\"]` default. (#2687)\n- `--timeout-ms` with a non-numeric value is rejected with an error instead of being\n silently ignored, which had left the client running on its default budget while the\n operator believed one was set. (#2687)\n- Reading `bytekit://account` issues its two sub-requests serially, matching the\n `get_account` tool — concurrent sub-requests could rate-limit a 1-rps plan against\n itself. (#2687)\n- `list_docs` with a `section` outside the documentation taxonomy returns an error naming\n the valid set, rather than a silent empty list that a correctly-spelled but empty\n section would also produce. (#2687)\n- The Claude Desktop / `mcp-remote` bridge config in README.md now authenticates as\n written. It previously passed `\"Authorization: Bearer $BYTEKIT_API_KEY\"` in `args`;\n an MCP host launches `command`/`args` with no shell, and `mcp-remote` interpolates\n only the braced `${VAR}` form, so the literal text was sent as the bearer token and\n the endpoint answered `401`. The snippet now uses `\"Authorization:${AUTH_HEADER}\"`\n with a matching `env` block, and the hosted-HTTP snippet carries the same\n no-shell-expansion caveat. (#2688)\n- The bundled documentation no longer teaches the deactivated `/v1/recordings` endpoint\n or links its removed reference pages. (#2688)\n- A 429 caused by the account's **concurrency** cap now says so and fails fast, instead of\n being reported as a rate limit. HTTP 429 carries two conditions (`rate_limited` and\n `concurrency_limit`), and the client read neither the body nor the code: every 429 got\n one `Retry-After` retry and then `Rate limited. Try again in a moment.` with the error\n code hardcoded to `rate_limited`. The concurrency variant does not clear on that\n back-off — the API spec calls its `Retry-After` \"a fixed small back-off\" while the slots\n free only when the in-flight jobs finish — so the retry was spent on a condition a\n second cannot clear, and the error object named the wrong cause. A `concurrency_limit`\n 429 now throws immediately with the real wait scale and `errorCode: 'concurrency_limit'`,\n at both 429 sites. `rate_limited` 429s, and any 429 whose body is empty, non-JSON or\n carries no recognizable code, keep the single honored-header retry and the exact message\n and code they had. (#2681)\n- A screenshot that fails inside the API's sync hold now surfaces its REAL failure code\n (`blocked`, `timeout`, …) and message. `POST /v1/screenshots` answers that case with HTTP\n 422 carrying the flat screenshot resource, not the unified error envelope, and the client\n parsed neither — so every such failure read as the literal `Validation error.`. The\n `(Screenshot ID: ss_…)` handle line is unchanged, and a genuine request-validation 422\n still renders exactly as it did. (#2679)\n\n### [0.2.2] - 2026-07-29\n\n#### Fixed\n\n- `scrape_url` / `get_result` render every returned textual format\n (`markdown`/`html`/`raw_html`), not just the first present — a multi-format call\n previously dropped every secondary format silently despite it being billed. Secondary\n formats are rendered under a `--- format: <name> ---` delimiter, in canonical order\n after the unlabeled primary. (#2589)\n- The 100KB output truncation budget now covers the links/images blocks too — they were\n previously appended AFTER truncation, so a combined output could exceed the budget.\n The whole assembled payload is now truncated exactly once, with the links/images\n block reserved its own share of the budget so it is never dropped in full just\n because the textual formats alone already fill the budget. (#2589)\n- `scrape_url` / `get_result` descriptions no longer advertise a queued `sc_` outcome\n that the MCP input schema (`url`/`formats`/`country`) cannot produce — that outcome\n was only reachable via `body.async` or fields `can-fast-path.ts` gates on, none of\n which this tool's schema exposes. (#2589)\n- `web_search` now renders `credits_used` and `related_searches`, both spec-required\n fields that were previously dropped silently. (#2591)\n- A sync-failed screenshot's `ss_` handle — absent from the 422 error body — is now\n read from the `X-Screenshot-ID` response header and included in the error text, so\n it can still be redeemed via `get_result`. Degrades gracefully when the header is\n absent. (#2591)\n- The 402 message on `/v1/screenshots` no longer says \"Bandwidth quota exhausted\"\n (screenshot quotas are credit/count-based) and no longer points at `get_account`,\n which is rate-limit-fragile immediately after a quota failure. Every other endpoint's\n 402 wording is unchanged. (#2591)\n- `get_result`'s invalid-id-prefix message no longer truncates the offending id to 3\n characters. (#2591)\n- `get_result` now gives the same \"poll with get_result\" guidance `screenshot_url`'s\n queued branch gives when a screenshot is still `pending`/`processing`. (#2591)\n- `get_account` no longer renders a duplicate email (`Account: foo@bar.com\n(foo@bar.com)`) when the account has no name. (#2591)\n- `search_docs` snippets no longer duplicate the page title when the match falls near\n the body's own leading `# <Title>` heading. (#2591)\n- `ScrapeErrorEnvelope.id` is now modeled as nullable, matching\n `docs/api/openapi.yaml` (`id` is null when a scrape was never queued, e.g. a\n validation failure) — `get_result`/`scrape_url` render `ID: —` instead of the\n literal `ID: null`. (#2591)\n\n#### Changed\n\n- `get_account` now issues its `getAccount`/`getUsage` requests serially instead of\n via `Promise.all`, so it no longer doubles the concurrent request rate against\n 1-rps plans. (#2591)\n- Regenerated the bundled `src/docs-bundle/docs-bundle.json` against the current\n `packages/docs/content` tree. Every guarded endpoint's docs page now states its\n request-body byte ceiling and the `request_too_large` error code (#2640), and the\n `/v1/bulk` pages document `defaults.type` inheritance plus the 422 on unrecognized\n keys (#2643). Content only — no tool surface, schema, or runtime behavior changed.\n (#2640, #2643)\n\n### [0.2.1] - 2026-07-24\n\n#### Fixed\n\n- The spec'd flat `/v1/search` 502 error body (`{\"error\":\"search_provider_error\"}`)\n now surfaces its code in the tool error text instead of collapsing to a generic\n \"ByteKit API error (HTTP 502)\". Flat `{error: \"<string>\"}` bodies on any status\n parse the same way; envelope-shaped bodies keep winning when both shapes are\n present. (#2541)\n\n#### Added\n\n- `BytekitClient` accepts a `timeoutMs` constructor option — a per-request budget in\n milliseconds, defaulting to `120000`. Set `0` to disable it entirely. Values that are\n negative or non-finite normalize to disabled rather than throwing. Previously a hung\n upstream hung a stdio MCP tool call forever. (#2568)\n- The budget covers an **entire** `request()` call rather than each await separately:\n the initial fetch, the 429 `Retry-After` sleep, the retry fetch, **and both** the\n success and error body reads (`response.json()` in `request()` and in\n `parseErrorEnvelope`). Two of those previously swallowed an abort outright — the\n `Retry-After` sleep observed no signal, and a failed error-body read was downgraded to\n \"no envelope\", surfacing a misleading status-line message instead of the timeout.\n Exhausting the budget now produces a `BytekitApiError` with\n `errorCode: 'timeout'`, distinct from `'network_error'`. (#2568)\n- Note the semantics are **client-side only**: aborting does not cancel or refund\n server-side work already in progress, so an account may still be billed for a result\n the caller never reads. The `120000` default is deliberately well above the server-side\n screenshot ceiling so it never truncates a legitimate billable operation. (#2568)\n\n### [0.2.0] - 2026-07-21\n\n#### Removed (**BREAKING**)\n\n- The legacy `RAPIDCRAWL_API_KEY` environment-variable fallback (kept as a\n one-minor-version bridge in #2421) is removed. Use `BYTEKIT_API_KEY` (or the\n `--api-key` flag). (#2473)\n\n#### Fixed\n\n- Tool-surface drift against the live API (#2477):\n - `screenshot_url`'s `device` enum is now `desktop` / `mobile` — `tablet` was\n 422-rejected by the API.\n - Screenshot results render the spec field names (`image_width`,\n `image_height`, `file_size_bytes`); the removed `format` field is gone.\n - `get_result` renders a failed job's envelope (`Status: failed` +\n `error.code`/`error.message`) instead of `undefined` lines, and omits\n `Credits: null` for pending rows.\n - `get_account` no longer renders `Account: null` when the account has no\n name.\n - `get_doc`'s description example uses a real bundle key.\n- Server errors now surface diagnostics instead of a generic failure: any\n non-2xx with a parseable API envelope renders its `code` + `message`\n (e.g. 503 `blocked`, 400 `invalid_url`), 422 includes `error.details`, and\n `Retry-After` (including HTTP-date or garbage values) is parsed to a bounded\n retry delay instead of `setTimeout(NaN)`. Specific 401/402/429 mappings still\n win. (#2478)\n\n#### Changed\n\n- The bundled offline docs (`get_doc`/`list_docs`/`search_docs`) are\n regenerated: 96 pages, now including the TypeScript SDK `usage` and\n `webhooks` reference pages and dropping removed content. (#2469)\n\n### [0.1.3] - 2026-07-16\n\n#### Changed (**BREAKING**)\n\n- The MCP tool `web-search` is renamed to `web_search` (snake_case, consistent\n with every other tool). MCP clients bound to the old `web-search` name must\n update. (#2421)\n\n#### Changed\n\n- The 401 error message now references `BYTEKIT_API_KEY`; `--base-url` now falls\n back to the `BYTEKIT_BASE_URL` environment variable when no flag is passed. (#2421)\n\n#### Fixed\n\n- The bundled offline docs (`get_doc`/`list_docs`/`search_docs`) now teach the\n correct `@hunt-labs/bytekit-sdk` install/import name instead of the dead\n `@bytekit/sdk` scope. (#2449)\n\n### [0.1.2] - 2026-07-15\n\n#### Fixed\n\n- `scrape_url` now reads the snake_case envelope fields the API actually returns\n (`id`, `final_url`, `status_code`); the published 0.1.1 tarball read the old\n camelCase fields (`scrapeId`, `finalUrl`, `statusCode`), so every metadata line\n rendered `undefined` (#2419).\n- The MCP handshake `serverInfo.version` is now derived from `package.json` instead\n of a hardcoded literal, so it can never drift from the published version (#2419).\n\n#### Changed\n\n- Compiled test code and fixtures are excluded from the published tarball — only\n runtime `dist/**` (plus `README.md`, `LICENSE`, and now `CHANGELOG.md`) ships (#2419).\n\n### [0.1.1] - 2026-07 [DEPRECATED]\n\n#### Note\n\n- Superseded by 0.1.2. This release shipped stale `scrape_url` metadata rendering\n (camelCase fields the API no longer returned) and included compiled test code in\n the tarball. Upgrade to 0.1.2 or later.\n\n### [0.1.0] - 2026-07\n\n#### Added\n\n- Initial release of the ByteKit MCP server, exposing ByteKit web-data tools\n (scrape, screenshot, search, docs) to AI agents over the Model Context Protocol,\n as a local stdio server or hosted."
276
276
  },
277
277
  "cli": {
278
278
  "title": "Install & Authenticate",
@@ -117,35 +117,6 @@ export interface ScrapeSuccessEnvelope {
117
117
  total: number;
118
118
  truncated: boolean;
119
119
  };
120
- /**
121
- * Per-call billing multiplier for this scrape (1.0 base, +0.5/billable format).
122
- * Reports the BASE-endpoint composition: on a cache hit it is a flat 0.5 for
123
- * every requested format, because the per-endpoint factor is applied later, at
124
- * report time by GET /v1/usage/by-endpoint (issue #2313), not here. It equals
125
- * the X-Scrape-Credits-Charged header and the persisted credits_charged column
126
- * (both 0.5 on a cache hit), but it does NOT always equal the
127
- * X-Billing-Multiplier header, which composes the REAL endpoint: on a markdown
128
- * cache hit the header is 0.75 (scrape_md 1.5 x cacheHit 0.5) while this field
129
- * stays 0.5 (Exception D-scrape, issue #2315). Raw cache hits are 0.5 in both.
130
- * NOTE: pre-clean_markdown-multiplier; on clean_markdown:true the final billed
131
- * usage is 3x this. Omitted on paths with no billing value (issue #1899).
132
- * LEGACY (issue #3139): `billing` below is now the explanation of the charge —
133
- * it names every factor and composes to the X-Billing-Multiplier header. Read
134
- * that; this field is removed in the final slice of #3135.
135
- */
136
- billing_multiplier?: number;
137
- /**
138
- * Metered wire bytes for this call = round(content_length x billing_multiplier),
139
- * derived from the body multiplier above rather than from the header's. Same
140
- * value as the X-Billable-Bytes header wherever the two multipliers agree; on a
141
- * markdown cache hit the header carries round(content_length x 0.75) and this
142
- * field round(content_length x 0.5), per Exception D-scrape (issue #2315).
143
- * (pre-clean_markdown-multiplier, like the header). Omitted on paths with no
144
- * billing value (issue #1899).
145
- * LEGACY (issue #3139): read `billing.billed_bytes` below instead — it equals
146
- * the X-Billable-Bytes header on the same response.
147
- */
148
- billed_bytes?: number;
149
120
  /**
150
121
  * The named billing factor list (issue #3139) — the DEFINITION of what this
151
122
  * call is charged. `factors` lists every applying factor in composition order
@@ -198,10 +169,16 @@ export interface ScrapeQueuedEnvelope {
198
169
  export type ScrapeEnvelope = ScrapeSuccessEnvelope | ScrapeErrorEnvelope | ScrapeQueuedEnvelope;
199
170
  /**
200
171
  * The complete billing factor vocabulary — fixed and TOTAL, in the order the
201
- * factors compose. A charge is explained by these three names or it is not
202
- * explained at all.
172
+ * factors compose. A charge is explained by these names or it is not explained
173
+ * at all.
174
+ *
175
+ * The first three explain a BYTE-SCRAPE charge. `phase1_render` (issue #3141)
176
+ * explains a CAPTURE charge — screenshots and recordings bill on
177
+ * `phase1_wire_bytes × 1.5`, a basis the byte-scrape endpoint factor cannot
178
+ * name — and occupies the endpoint position in a capture node, which carries
179
+ * that factor and nothing else. The two vocabularies never mix on one node.
203
180
  */
204
- export type BillingFactorName = 'endpoint' | 'cache_hit' | 'clean_markdown';
181
+ export type BillingFactorName = 'endpoint' | 'cache_hit' | 'clean_markdown' | 'phase1_render';
205
182
  export interface BillingFactor {
206
183
  name: BillingFactorName;
207
184
  /** This factor's multiplicative contribution. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hunt-labs/bytekit-mcp",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "ByteKit MCP server — exposes ByteKit web-data tools (scrape, screenshot, search, docs) to AI agents over the Model Context Protocol, hosted or as a local stdio server.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -58,11 +58,12 @@
58
58
  "zod": "^3.23.6"
59
59
  },
60
60
  "scripts": {
61
- "prebuild": "pnpm check:scrape-contract && tsx scripts/build-docs-bundle.ts",
61
+ "prebuild": "pnpm check:scrape-contract",
62
62
  "build": "rm -rf dist tsconfig.tsbuildinfo && tsc && mkdir -p dist/docs-bundle && cp src/docs-bundle/docs-bundle.json dist/docs-bundle/docs-bundle.json",
63
63
  "typecheck": "pnpm check:scrape-contract && tsc --noEmit && tsc --noEmit -p tsconfig.scripts.json",
64
64
  "test": "pnpm check:scrape-contract && vitest run && pnpm test:package",
65
65
  "generate:scrape-contract": "tsx scripts/sync-scrape-contract.ts",
66
+ "generate:docs-bundle": "tsx scripts/build-docs-bundle.ts",
66
67
  "check:scrape-contract": "tsx scripts/sync-scrape-contract.ts --check",
67
68
  "test:package": "tsx scripts/test-package-boundary.ts"
68
69
  }