{
  "schemaVersion": 1,
  "sdk": "sdk",
  "baseline": {
    "version": "0.120.0",
    "markdown": "# Changelog — `@warmhub/sdk-ts`\n\n## 0.120.0\n\nRepository export v3.\n\n### Breaking\n\n#### Checkpoint generation is retired — take an export instead\n\n**What it was.** Producing a fresh snapshot of a repository meant asking the\nserver to mint a checkpoint, polling until the job completed, requesting a\nshort-lived signed URL for the archive, downloading it outside the SDK, and\nverifying the bytes locally.\n\n**What it is now.** One call that streams verified rows, with the header,\nper-row canonical decode, ordering and trailer checks applied as the bytes\narrive. There is no job to start, no state to poll, and no separate verify\nstep — a row that reaches you has already been proven.\n\n**Migration.**\n\nBefore:\n\n```ts\nimport { createReadStream } from 'node:fs'\nimport { writeFile } from 'node:fs/promises'\nimport { Readable } from 'node:stream'\nimport { verifyRepositoryCheckpointArchive } from '@warmhub/sdk-ts/checkpoint'\n\nlet status = await client.repo.checkpoint.generate('acme', 'catalog')\nwhile (status.state !== 'complete') {\n  await new Promise((resolve) => setTimeout(resolve, 1_000))\n  status = await client.repo.checkpoint.status('acme', 'catalog', {\n    checkpointId: status.checkpointId,\n  })\n}\n\nconst access = await client.repo.checkpoint.getAccess('acme', 'catalog', {\n  checkpoint: 'latest',\n  artifact: 'archive',\n})\n// Signed URL: fetched WITHOUT the WarmHub bearer token.\nconst archive = await fetch(access.url)\nawait writeFile('catalog.zip', Readable.fromWeb(archive.body))\nawait verifyRepositoryCheckpointArchive(createReadStream('catalog.zip'))\n```\n\nAfter:\n\n```ts\nfor await (const row of client.repo.export('acme', 'catalog')) {\n  console.log(row.kind, row.durableId, row.version)\n}\n```\n\nIf you were relying on `generate` returning before the download — starting the\nbuild in one process and fetching it in another, or on another machine — that\nshape survives as the async token flow:\n\n```ts\n// Process A: ask for it, get a token, do not read a byte.\nconst prepared = await client.repo.exportPrepare('acme', 'catalog')\nconsole.log(prepared.exportToken, prepared.atRepoSeq)\n\n// Process B: redeem it. `export` polls while the fold is still running.\nfor await (const row of client.repo.export('acme', 'catalog', {\n  token: prepared.exportToken,\n})) {\n  // ...\n}\n```\n\nThe token is redeemable only at that repository's URL, by a principal holding\ncheckpoint read there.\n\n**Why.** Export format v3 replaces checkpoint generation outright; the whole\ngeneration pipeline is deleted server-side (PR #10020).\n\n#### `client.repo.checkpoint.generate` and `.retry` are gone\n\n**What it was.** `generate(orgName, repoName, { atLeastRepoSeq })` minted a\ncheckpoint; `retry(orgName, repoName, checkpointId)` re-ran a failed one. Both\nreturned a `RepositoryCheckpointStatus`.\n\n**What it is now.** Neither method exists, and the tRPC procedures behind them\n(`repo.checkpoint.generate`, `repo.checkpoint.retry`) are no longer served. The\n`repo:checkpoint-generate` scope no longer buys anything.\n\n**Migration.** Replace both with `client.repo.export`.\n\nBefore:\n\n```ts\nconst fresh = await client.repo.checkpoint.generate('acme', 'catalog', {\n  atLeastRepoSeq: 42,\n})\nconst recovered = await client.repo.checkpoint.retry(\n  'acme',\n  'catalog',\n  failed.checkpointId,\n)\n```\n\nAfter:\n\n```ts\n// `atRepoSeq` pins the fence the way `atLeastRepoSeq` asked for a floor.\n// Omit it and the server pins current and echoes it back in the header.\nfor await (const row of client.repo.export('acme', 'catalog', {\n  atRepoSeq: 42,\n})) {\n  // ...\n}\n```\n\nThere is no retry to replace: an export is a read, so a failed one is re-read,\nnot re-queued.\n\n**Why.** Same retirement (PR #10020).\n\n#### Failed checkpoint statuses now all answer `nextAction: 'none'`\n\n**What it was.** `RepositoryCheckpointStatus` carried `nextAction: 'retry'` for\n`deadline_exceeded` and `attempts_exhausted`, and `nextAction: 'generate'` for\n`invalid_source`. Each named a procedure a reader could call.\n\n**What it is now.** Those three failure codes join `repository_deleted` in a\nsingle variant with `nextAction: 'none'`. The `'retry'` and `'generate'`\nmembers are gone from the union, so a `switch` over `nextAction` that had cases\nfor them will no longer typecheck against them.\n\n**Migration.**\n\nBefore:\n\n```ts\nif (status.state === 'failed') {\n  switch (status.nextAction) {\n    case 'retry':\n      await client.repo.checkpoint.retry('acme', 'catalog', status.checkpointId)\n      break\n    case 'generate':\n      await client.repo.checkpoint.generate('acme', 'catalog')\n      break\n    case 'contact_support':\n      report(status.checkpointId, status.failureCode)\n      break\n  }\n}\n```\n\nAfter:\n\n```ts\nif (status.state === 'failed') {\n  if (status.nextAction === 'contact_support') {\n    report(status.checkpointId, status.failureCode)\n  } else {\n    // Terminal. Take an export instead of trying to revive the checkpoint.\n    for await (const row of client.repo.export('acme', 'catalog')) {\n      // ...\n    }\n  }\n}\n```\n\n**Why.** Each retired value pointed at a route the server no longer serves;\nleaving them in the vocabulary would send readers to a 404 (PR #10020).\n\n### Added\n\n- **`client.repo.export(orgName, repoName, options?)`** — an\n  `AsyncGenerator<RepositoryExportRow>` over a verified export stream. Options:\n  `mode` (`'heads'`, the default, or `'ops'`), `sinceRepoSeq` (delta base;\n  `0` means a full export), `atRepoSeq` (pin the fence), `prefer`\n  (`'sync'` | `'async'`), `token`, `session`, `afterDurableId`,\n  `pollIntervalMs`, and `signal`.\n\n- **`client.repo.exportPrepare(orgName, repoName, options?)`** — returns\n  `{ exportToken, atRepoSeq }` without waiting for the fold or reading the\n  body. Takes `mode`, `sinceRepoSeq`, `atRepoSeq`, and `signal`.\n\n- **`RepositoryExportSession` / `createRepositoryExportSession()`** — the\n  rolling verification state of one logical export: the opening `header`, the\n  resume cursor `lastDurableId`, `rowCount`, `complete`, and — once the stream\n  is finalized — `contentSha256`. Pass the same session back into `export` to\n  resume a stream that broke:\n\n  ```ts\n  import {\n    createRepositoryExportSession,\n    RepositoryExportError,\n  } from '@warmhub/sdk-ts'\n\n  const session = createRepositoryExportSession()\n  const rows: unknown[] = []\n  for (let attempt = 0; attempt < 3 && !session.complete; attempt += 1) {\n    try {\n      // The session's own cursor and fence pin the resumed request; do not\n      // recompute them.\n      for await (const row of client.repo.export('acme', 'catalog', {\n        session,\n      })) {\n        rows.push(row)\n      }\n    } catch (error) {\n      if (\n        !(error instanceof RepositoryExportError) ||\n        error.reason !== 'truncated'\n      ) {\n        throw error\n      }\n    }\n  }\n  console.log(session.rowCount, session.contentSha256)\n  ```\n\n- **`readRepositoryExportStream(source, session, expected, options?)`** — read\n  a response body you fetched with your own transport, verified against a\n  session as it goes. `client.repo.export` is the usual entry point.\n\n- **`restoreRepositoryExportSession(source, options?)`** — the offline twin:\n  replay a saved export's bytes back through the same header, canonical-row,\n  ordering and trailer checks, and get the session back rather than the rows.\n  Pass `{ partial: true }` for a download that was interrupted, then resume\n  from the session it returns.\n\n  ```ts\n  import { createReadStream } from 'node:fs'\n  import { restoreRepositoryExportSession } from '@warmhub/sdk-ts'\n\n  const session = await restoreRepositoryExportSession(\n    createReadStream('catalog.ndjson'),\n    { partial: true },\n  )\n  for await (const row of client.repo.export('acme', 'catalog', { session })) {\n    // continues from session.lastDurableId\n  }\n  ```\n\n- **`applyRepositoryExportDelta(base, delta)`** — fold a delta export onto a\n  base by `durableId`: active rows upsert, tombstones remove. Pure; neither\n  argument is mutated. Both arguments accept either an iterable of rows or a\n  `Map` returned by a previous fold, so folds chain.\n\n  ```ts\n  import { applyRepositoryExportDelta } from '@warmhub/sdk-ts'\n\n  const session = createRepositoryExportSession()\n  const base = []\n  for await (const row of client.repo.export('acme', 'catalog', { session })) {\n    base.push(row)\n  }\n  const fence = session.header?.atRepoSeq ?? 0\n\n  // Later: only what changed since that fence.\n  const delta = []\n  for await (const row of client.repo.export('acme', 'catalog', {\n    sinceRepoSeq: fence,\n  })) {\n    delta.push(row)\n  }\n\n  const current = applyRepositoryExportDelta(base, delta)\n  ```\n\n  `wref` is an opaque rendering and is never keyed on, so the fold survives a\n  rename.\n\n- **`RepositoryExportError`** with a typed `reason`:\n  `'count_mismatch'`, `'digest_mismatch'`, `'fence_mismatch'`,\n  `'header_invalid'`, `'row_invalid'`, `'row_out_of_order'`,\n  `'since_below_epoch_floor'`, `'trailer_invalid'`, `'truncated'`. Every reason\n  except `'since_below_epoch_floor'` is a local verification verdict — the\n  bytes did not prove what the trailer claimed. `'since_below_epoch_floor'` is\n  the server refusing a delta base it no longer retains; recover by re-running\n  the export with `sinceRepoSeq: 0`.\n\n- **`RepositoryExportRowMap` / `RepositoryExportRows`** — the collection types\n  `applyRepositoryExportDelta` accepts and returns.\n\n### Behavior worth knowing\n\n- **A redeemed token's bytes come from storage, not the API, and the client\n  checks what the API said.** A complete redemption answers with a short-lived\n  presigned URL rather than the export bytes, and the SDK fetches that URL\n  *without* your WarmHub bearer: the signature in the URL is the whole\n  capability, and the storage host has no business seeing a credential. The\n  record count and content digest the session derives are then checked against\n  the ones the API named — a download that does not match raises\n  `count_mismatch` or `digest_mismatch` rather than handing you rows nothing\n  independent vouched for. A refused or expired URL re-redeems the token, which\n  is a deterministic lookup, and retries; a break after rows have already been\n  yielded surfaces as an error instead, because a silent restart would hand you\n  those rows twice.\n\n- **Ordering is verified, in `heads` mode only.** A heads export is a set,\n  emitted in ascending `durableId` by unsigned UTF-8 bytes, and that order is\n  part of what the digest proves. A row that does not advance the cursor raises\n  `row_out_of_order`. An `ops` export is a log — it repeats identities by\n  design — and is not order-checked.\n\n- **Resume trailers are segment-scoped.** A resumed request carries no header,\n  and its trailer covers only that segment's rows. The session keeps two\n  hashers: a per-segment one the trailer is checked against, and a whole-stream\n  one that accumulates across segments. `session.contentSha256` is the\n  whole-stream value, and is what you should record as the export's digest.\n\n- **A trailer failure poisons the session.** `truncated` is the resumable\n  failure. `count_mismatch`, `digest_mismatch`, `fence_mismatch` and\n  `trailer_invalid` are not: the whole-stream digest has already absorbed that\n  segment's rows, so the session refuses to resume and you must start a new\n  one.\n\n- **`afterDurableId` requires a session with a header.** A resumed request gets\n  no header back, so with nothing to check the repository and fence against the\n  call is refused before it is sent. Reuse the session the broken stream wrote,\n  or rebuild one with `restoreRepositoryExportSession`.\n\n- **The async redemption poll has a floor of 50 ms**, and defaults to 1000 ms.\n  Each poll re-runs the full authorization gate, so `pollIntervalMs: 0` — or a\n  `NaN` from an unvalidated config value — is clamped rather than honored.\n\n- **Flat server error bodies keep their message.** The export route answers\n  with a flat `{ code, message }` body rather than the client's usual nested\n  `{ error: { ... } }` envelope. Those responses are re-wrapped before the\n  standard mapping runs, so classification stays standard and the server's\n  message is not discarded.\n\n### Still supported\n\nThe checkpoint **read** plane is untouched: `client.repo.checkpoint.status`,\n`.latest`, `.getAccess`, and `verifyRepositoryCheckpointArchive` from\n`@warmhub/sdk-ts/checkpoint` all continue to work against archives already in\nobject storage. Nothing mints new ones.\n\n**Deprecation horizon:** those read surfaces are supported until the announced\ncleanup, 30 days after GA. Their removal is a separately-filed post-GA change.\nMove download-and-verify workflows to `client.repo.export` before then.\n"
  },
  "releases": [
    {
      "version": "0.122.3",
      "sourceSha": "4ab1a8b0c92c8852e3ed2bbfbe1ef17ed0f79dc6",
      "notes": [
        {
          "id": "backfill-sdk-0-122-3",
          "body": "### Release changes\n\n- test(backend): reduce avoidable test isolation (commit `ca288390db56`)\n- perf(query): A1 — bound every typed count arm and report the bound (commit `cc93a4636a8b`)\n\nReconstructed from SDK release tags."
        }
      ]
    },
    {
      "version": "0.123.0",
      "sourceSha": "775c5b1930935be110f53828b01360d9cc21b55c",
      "notes": [
        {
          "id": "backfill-sdk-0-123-0",
          "body": "### Release changes\n\n- fix(component): bound manifest regex evaluation (#10870) (commit `03a9129692b1`)\n- fix(rules): validate manifest commit filters (#10884) (commit `a60d060c9139`)\n- fix(rules): validate folded array field names (#10886) (commit `efeb4938b9b6`)\n\nReconstructed from SDK release tags."
        }
      ]
    },
    {
      "version": "0.124.0",
      "sourceSha": "5e3bfb7a6e3024eb9e16707695d3e25a7e01bbf1",
      "notes": [
        {
          "id": "backfill-sdk-0-124-0",
          "body": "### Release changes\n\n- chore(compat): #10974 retire transitional client contracts and startup adoption (commit `4347a0500db6`)\n\nReconstructed from SDK release tags."
        }
      ]
    },
    {
      "version": "0.125.0",
      "sourceSha": "a5c5261c5721d1059b265d413e8368aa540eabdd",
      "notes": [
        {
          "id": "backfill-sdk-0-125-0",
          "body": "### Release changes\n\nNo SDK source changes.\n\nReconstructed from SDK release tags."
        }
      ]
    },
    {
      "version": "0.126.0",
      "sourceSha": "29f70ba169ad15b09f72b7a07782d9662a7d1191",
      "notes": [
        {
          "id": "backfill-sdk-0-126-0",
          "body": "### Release changes\n\n- feat(collections): Arc and Bond become ordinary Things under protected V2 Shapes (commit `50fec9ce2a8f`)\n- feat(collections): the Collections V2 cutover with a legacy-sugar window (commit `adaaa4fe53dc`)\n- feat(collections): split the read kind and key collection-ness on the certificate (commit `6a33c1713c45`)\n- feat(collections): classify inbound traversal by closure and add the aggregate roles (commit `ca07faa123f0`)\n- feat(collections): carry the collections summary across every read surface (commit `8147aff4dfc5`)\n- fix(collections): let a legacy collection row be retracted (GH-10975) (commit `9b625cb9c67c`)\n- test(collections): invert the tests the ruling slice moves (commit `79a1d08eb82d`)\n- fix(collections): stop head and history claiming member facts they cannot see (commit `9c6752da5e8d`)\n- feat(collections): put the member layout on the Shape and the facts on the row (commit `be4d60df9499`)\n- test(collections): pin the layout ruling and the four review findings it touches (commit `102b6e20d7a2`)\n- feat(collections)!: define member position within a field, and nowhere else (commit `d4d69aaf2282`)\n- feat(export)!: carry Shape certificates as pinned wref strings (commit `30187cb8082e`)\n- fix(rules): model the v3 collection row and close the pinned-wref newline hole (commit `dd2dc046d7da`)\n- fix(collections)!: name a foreign certifying Shape by its repository (commit `18478e45b47f`)\n\nReconstructed from SDK release tags."
        }
      ]
    },
    {
      "version": "0.127.0",
      "sourceSha": "766ffcad41027f48f9e7596fbccc36565dd1ffb2",
      "notes": [
        {
          "id": "backfill-sdk-0-127-0",
          "body": "### Release changes\n\nNo SDK source changes.\n\nReconstructed from SDK release tags."
        }
      ]
    },
    {
      "version": "0.128.0",
      "sourceSha": "f990f080d6f8b7310700b1d430ee1aa11dcaaf23",
      "notes": [
        {
          "id": "published-changelog-artifacts",
          "body": "### Documentation\n\nVersioned release notes are available as [HTML, Markdown, and JSON](https://docs.warmhub.ai/sdk/typescript/changelog/)."
        }
      ]
    },
    {
      "version": "0.129.0",
      "sourceSha": "e3b82b4b08936c141a727fc4f072a5d9ee1eeb31",
      "notes": []
    },
    {
      "version": "0.129.1",
      "sourceSha": "0d89f491050573a87e365d3d1223f46c556f9269",
      "notes": []
    },
    {
      "version": "0.130.0",
      "sourceSha": "756a13ed78b5ffc90a2640f8b9b0a1db9233f6a4",
      "notes": []
    },
    {
      "version": "0.130.1",
      "sourceSha": "3002fc481e70b3bdad6d6e504622da4dfb249b1c",
      "notes": []
    },
    {
      "version": "0.130.2",
      "sourceSha": "6999b2f6645b5ae0f8b9b07e0e52e5d7a8a39669",
      "notes": []
    },
    {
      "version": "0.131.0",
      "sourceSha": "651c5ad187c2f3eb4b90c0437ec87fd2f4108857",
      "notes": []
    },
    {
      "version": "0.132.0",
      "sourceSha": "eeb99f940dc369a637a9b63d86b3cb3fe9530fd7",
      "notes": []
    },
    {
      "version": "0.133.0",
      "sourceSha": "5a309dc538853e5544eaa7ae7d68f0045ac6911a",
      "notes": []
    },
    {
      "version": "0.134.0",
      "sourceSha": "a0f560ee3dfd8b29188069ca965bef780b235d93",
      "notes": []
    },
    {
      "version": "0.135.0",
      "sourceSha": "dbb88c4ad3afe73aeec2f6f60bdf43a8f3311910",
      "notes": []
    },
    {
      "version": "0.136.0",
      "sourceSha": "421b081a24dff3f4a44162011791ebcd1ed9b917",
      "notes": []
    },
    {
      "version": "0.137.0",
      "sourceSha": "ecdeee60fe6a0af5454e69a90710f6a9416999b8",
      "notes": []
    },
    {
      "version": "0.137.1",
      "sourceSha": "06fea798b04da1ab1394ca63bc12f3ff12de0221",
      "notes": []
    },
    {
      "version": "0.138.0",
      "sourceSha": "27f4db0b47ea2a05a4e9ef7dd89c4b540704c671",
      "notes": []
    },
    {
      "version": "0.139.0",
      "sourceSha": "01575d928d1214ed8556301179ef2a4509c28383",
      "notes": []
    },
    {
      "version": "0.140.0",
      "sourceSha": "6d99197d6e84edc1e7842634e0f5e4b810c80824",
      "notes": [
        {
          "id": "export-resume-format-guard",
          "body": "### Changed\n\nA resumed repository export now sends the `formatVersion` of the header the download opened with, and the server refuses a resume whose format is not the one it writes: HTTP 412 `client-incompatible` with the message \"Restart the export; a resume must use the format it started with.\" A download started before a server upgrade that changes the export format can no longer be silently finished under its old header; the resume fails and the export must be restarted.\n\nA resume of a file that holds only the header (interrupted before the first row) sends no cursor, so the server cannot check it; the session now compares the new header's format to the saved one and raises `RepositoryExportError` (`header_invalid`) with the same restart message rather than appending new-format rows under the old header.\n\n**Upgrade with the server.** An older SDK sends no `formatVersion` on a resume, so a server with this change refuses every resume from it, not only cross-format ones. Upgrade the SDK in the same release as the server."
        },
        {
          "id": "is-all-stream-operations-failed-error",
          "body": "### Added\n\n`isAllStreamOperationsFailedError(error)` reports whether a thrown value is an all-failed stream error. Unlike `error instanceof AllStreamOperationsFailedError`, it also recognizes the error after `toWarmHubError` normalization and when a different copy of the SDK threw it."
        },
        {
          "id": "name-taken-durable-id-only",
          "body": "### Breaking\n\n#### `NAME_TAKEN` names the holder by durable id only and offers no replacement name\n\n**What it was.** A `name_taken` error's `details.takenBy` was `{ shape, durableId }`, `details.suggestedName` could carry a replacement name, and the message said `by a <Shape> Thing` and `for example \"<name>\"`.\n\n**What it is now.** `details.takenBy` is `{ durableId }`; `shape` is removed. `details.suggestedName` is removed and no example name appears in the message or hint. The message names no Shape: `Name \"acme\" is already taken in this repository by another Thing; choose another name`. A caller who cannot read the holder still gets no `takenBy` and no `by another Thing`. The `name_taken` decoder in the streaming submission protocol requires only `takenBy.durableId`.\n\n**Why it breaks.** This is a client-visible breaking change, accepted. Released sdk-ts 0.135.0 to 0.139.0 decode `takenBy` with `shape` required, so they refuse a `name_taken` result from a server that carries this change. It lands before the v2 floor release (0.140.0), so no v2 client sees `shape`.\n\n**Migration.** Read the holder's Shapes with `get` on `details.takenBy.durableId`; a Thing can have several Shapes or none. Choose the replacement name yourself.\n\n```ts\n// Before\nconst { takenBy, suggestedName } = details\nconsole.log(takenBy?.shape, suggestedName)\n\n// After\nconst holder = details.takenBy && (await client.thing.get(org, repo, details.takenBy.durableId))\n```"
        },
        {
          "id": "restore-operation",
          "body": "### Added\n\nThe `restore` operation and `OperationBuilder.restore()` make a retracted Thing active again, by its durable ID. Pass `newName` to restore it under another name."
        },
        {
          "id": "v2-write-form",
          "body": "In these notes, \"old grammar\" means the reference form used before this release (`Deal/acme`, operations with `kind`), and \"new grammar\" the form this release introduces (`acme`, operations with `shapes`).\n\n### Breaking\n\n#### Write operations take `name` and `shapes`\n\n**What it was.** Operations carried `kind`, an add name spelled\n`Shape/name`, a top-level `about`, or collection `type`/`members`, and the\nSDK converted them.\n\n**What it is now.** `Operation`, `AddOperation`, `ReviseOperation`,\n`RetractOperation`, `ReaffirmOperation` and `RenameOperation` keep their\nnames but have the new shape. An add or revise requires `name`, `shapes`\nand `data`. `kind` and `shape` are typed `never`. The new `WriteOperation`\ntype is one operation of that form.\n\n- A Shape is the Thing `hub/shapes/X` (`shapeName('X')`), written with\n  `shapes: []`.\n- An assertion is a Thing one of whose declared Shapes composes `Assertion`,\n  with its target in `data.about`.\n- A collection is a Thing of its collection Shape:\n  `{ shapes: ['Set'], data: { members } }`.\n\n**Migration.**\n\n```ts\n// Before\nawait client.commit.apply('acme', 'world', 'seed', [\n  { operation: 'add', kind: 'thing', name: 'Deal/acme', data: { company: 'Acme' } },\n])\n\n// After\nawait client.commit.apply('acme', 'world', 'seed', [\n  { operation: 'add', name: 'acme', shapes: ['Deal'], data: { company: 'Acme' } },\n])\n```\n\n#### Old-grammar operations are refused before any request\n\n**What it was.** The SDK converted old-grammar operations.\n\n**What it is now.** An operation with `kind`, `shape`, `wref`,\n`declaredShapes`, `about`, collection `type` or `members`, or with no\n`operation`, is refused with a `WriteOperationError` before anything is\nsent. The message shows a suggested new form, with data values replaced by\n`\"...\"`. Names and `about` targets are copied as written, so check them: a\nsuggested `name: 'Deal/acme'` would address a Thing literally named\n`Deal/acme`. An add or revise with no `shapes` is refused with a message\nthat it states no Shapes.\n\nOld-grammar input no longer type-checks, so it reaches this refusal only\nthrough a cast.\n\n**Migration.**\n\n```ts\n// Before: converted and sent\nawait client.commit.apply('acme', 'world', 'rate', [\n  { operation: 'add', kind: 'assertion', name: 'Rating/r1', about: 'Deal/acme', data: { score: 5 } },\n])\n\n// After\nawait client.commit.apply('acme', 'world', 'rate', [\n  { operation: 'add', name: 'r1', shapes: ['Rating'], data: { about: 'acme', score: 5 } },\n])\n```\n\nOther operations refused locally:\n\n- a pinned Shape in `shapes` (`Deal@v2`), or an entry that is not a bare\n  Shape name (`hub/shapes/Deal`, anything with `/`);\n- `shapeless` on a raw operation (spell it `shapes: []`);\n- non-empty `shapes` on a `hub/shapes/X` name;\n- an add or revise without `data`, and `keepShapes` on an add;\n- `affirmedTargets` on a shapeless write;\n- `expectedVersion` on an add, and `active` on a revise;\n- renaming a Shape to a non-Shape name, or the reverse;\n- `+` in an added or renamed-to name;\n- an added or renamed-to name under the reserved `hub` root\n  (`RESERVED_NAME`);\n- the same name added twice in one submission (`ILLEGAL_OP_SEQUENCE`);\n- errors found by the local Shape-definition checks.\n\n#### `OperationBuilder` methods take the name first\n\n**What it was.** `add({ name, data })`, `revise({ name, data })`,\n`retract(target)`, `reaffirm({ name, kind, ... })`; no `rename`.\n\n**What it is now.**\n\n| Method | After |\n|---|---|\n| `add` | `add(name, { shapes \\| shapeless, data, ... })` |\n| `revise` | `revise(name, { shapes \\| shapeless \\| keepShapes, data, ... })` |\n| `retract` | `retract(name, { reason? })` |\n| `reaffirm` | `reaffirm(name, { add?, remove? })` |\n| `rename` | `rename(name, newName)` (new) |\n\nEach add and revise states its Shapes in exactly one way: `shapes: [...]`,\n`shapeless: true`, or (revise only) `keepShapes: true`. The builder refuses\nzero ways or more than one, `keepShapes` on an add, `shapeless` on a\n`hub/shapes/X` name, and `shapes: []` on a non-Shape name (spell that\n`shapeless: true`).\n\n**Migration.**\n\n```ts\n// Before\nimport { OperationBuilder } from '@warmhub/sdk-ts'\nconst ob = new OperationBuilder()\nob.add({ name: 'Deal/acme', data: { company: 'Acme' } })\nob.retract('Deal/old')\nawait ob.commit({ client, orgName: 'acme', repoName: 'world', message: 'seed' })\n\n// After\nimport { createOperationEventRequestId } from '@warmhub/sdk-ts'\n\nawait client.shape.create('acme', 'world', 'Deal', { company: 'string' }, {\n  eventRequestId: createOperationEventRequestId(),\n})\n\nawait client.commit.apply(\n  'acme',\n  'world',\n  'seed',\n  client\n    .ops()\n    .add('acme', { shapes: ['Deal'], data: { company: 'Acme' } })\n    .add('scratch', { shapeless: true, data: { note: 'free' } })\n    .rename('scratch', 'scratch-2')\n    .retract('old'),\n)\n\n// A later submission: keepShapes revises a Thing that already exists\nawait client.commit.apply(\n  'acme',\n  'world',\n  'update',\n  client.ops().revise('acme', { keepShapes: true, data: { company: 'Acme 2' } }),\n)\n```\n\nA `keepShapes` revise of a Thing added or renamed earlier in the same\nsubmission is refused; state `shapes` instead.\n\n#### Builder errors are `WriteOperationError`, raised when an operation is queued\n\n**What it was.** Some refusals surfaced only at commit.\n\n**What it is now.** A per-operation refusal throws at the `.add(...)` or\n`.revise(...)` call. Whole-batch refusals (\"already submitted\", \"in flight\")\nhave `operationIndex: undefined`. The code is usually `VALIDATION_ERROR`;\nit can also be `RESERVED_NAME`, `ILLEGAL_OP_SEQUENCE`, a Shape-name check\ncode, or (for `keepShapes`, at submit) `NOT_FOUND`.\n\n**Migration.**\n\n```ts\nimport { WriteOperationError, type AddInput } from '@warmhub/sdk-ts'\n\ntry {\n  client.ops().add('acme', { data: {} } as AddInput) // no Shapes stated\n} catch (e) {\n  if (e instanceof WriteOperationError) console.log(e.code, e.operationIndex) // VALIDATION_ERROR 0\n}\n```\n\n#### Every reference argument uses the new grammar\n\n**What it was.** Read and write calls took `Deal/acme`, and a Shape was\n`Deal`.\n\n**What it is now.** Pass the Thing name (`acme`) and `hub/shapes/Deal` for a\nShape where any Thing can appear. An old spelling is looked up literally: a\nsingle read gets `NOT_FOUND`, and `thing.getMany` lists it in `missing`.\nGlobs (`match`) match Thing names, and `*` does not cross `/`.\n\n**Migration.**\n\n```ts\n// Before\nawait client.thing.get('acme', 'world', 'Deal/acme')\n// After\nawait client.thing.get('acme', 'world', 'acme')\n```\n\n#### `thing.rename` takes full names\n\n**What it was.** `rename(org, repo, shapeName, oldName, newName, opts)`.\n\n**What it is now.** `rename(org, repo, name, newName, opts)`. A call in the\nold argument order is refused locally with `VALIDATION_ERROR`.\n\n**Migration.**\n\n```ts\n// Before\nawait client.thing.rename('acme', 'world', 'Deal', 'acme', 'acme-corp', { eventRequestId })\n// After\nawait client.thing.rename('acme', 'world', 'acme', 'acme-corp', { eventRequestId })\n```\n\n#### Read results drop `shape`, `shapeName` and `validatedShape`\n\n**What it was.** Results carried a single Shape.\n\n**What it is now.** Use `declaredShapes` (the Shapes the version states)\nand `validatedShapes` (the Shapes it satisfies, including composed ones).\nBoth hold version-pinned names such as `Deal@v3`. The removal covers\n`ThingDetail`, `ThingItem`, `thing.getMany` items, `thing.getWithLease`,\nhistory versions and history's `thing`, refs items, component owned Things\nand `view.evaluate` items. `SynthesizedRepoContent.shape` becomes\n`declaredShapes` / `validatedShapes`.\n\n`ThingDetail` allows extra keys, so `detail.shapeName` still compiles; it is\n`undefined` at run time. Search your code for these field names.\n\n`shape` as an input filter (`thing.head(org, repo, { shape: 'Deal' })`) is\nunchanged.\n\n**Migration.**\n\n```ts\n// Before\nconst shape = detail.shapeName\n// After\nconst shapes = (detail.declaredShapes ?? []).map((w) => w.replace(/@v\\d+$/, ''))\n```\n\n#### Token scopes use `grants`, on input and output\n\n**What it was.** A scope entry carried `allowedMatches` and `allowedShapes`.\n\n**What it is now.** Restrictions are a list of (paths, Shapes) pairs in\n`grants`.\n\n- Input (`token.create`): the entry-level fields are still typed `unknown`,\n  so old code compiles, but the server refuses them with \"allowedMatches and\n  allowedShapes are no longer scope-entry fields: give each (paths, Shapes)\n  pair in grants…\".\n- Output (`TokenCreateResult`, token metadata, whoami scopes): the\n  entry-level fields are removed, and reading them is a compile error. Read\n  `grants`.\n- `org.setMemberScopes` takes entries with `resource` and `permissions`\n  only; restrictions on member scopes are refused.\n- A pair must carry a non-empty `allowedMatches`, or an `allowedShapes`\n  with at least one key. `grants: []`, `{}` and `{ allowedShapes: {} }` are\n  refused.\n- `shapeless: true` in a clause is not a restriction of its own: it lets\n  Things with no Shape through. Alone it admits every Thing the pair's paths\n  match, shaped or shapeless; beside `shapes` it adds shapeless Things to\n  the Things the clause covers. No clause restricts a pair to shapeless\n  Things only.\n\n**Migration.**\n\n```ts\n// Before\nawait client.token.create({ name: 'ci', scopes: [\n  { resource: 'acme/world', permissions: ['read'], allowedMatches: ['Deal/**'] },\n] })\n// After\nawait client.token.create({ name: 'ci', scopes: [\n  { resource: 'acme/world', permissions: ['read'],\n    grants: [{ allowedMatches: ['**'], allowedShapes: { shapes: ['Deal'] } }] },\n] })\n```\n\n#### Repository exports are format 6, and the delta fold needs formats\n\n**What it was.** Exports were format 5, and\n`applyRepositoryExportDelta(base, delta)` returned rows keyed by durable id.\n\n**What it is now.**\n\n- The server writes format 6. This SDK reads 5 and 6; older SDKs read only\n  5, so they cannot read exports made after this release reaches\n  production.\n- Format 6 uses new-grammar references, has one row per Shape version, and\n  may carry `retracted: true` on Shape rows. A Shape tombstone in format 6\n  is rejected as `row_invalid`.\n- `applyRepositoryExportDelta` takes a third argument, the formats. Mixing\n  format 5 and format 6 throws `RepositoryExportError` with reason\n  `format_mismatch`.\n- In the returned map, format 6 Shape rows are keyed `durableId@vN`, not\n  `durableId`. Code that looks a Shape up by durable id, or keys its own map\n  by durable id, must account for versions.\n\n**Migration.**\n\n```ts\n// Before\nconst current = applyRepositoryExportDelta(base, delta)\n// After\nconst current = applyRepositoryExportDelta(base, delta, {\n  base: baseSession.header!.formatVersion,\n  delta: deltaSession.header!.formatVersion,\n})\n```\n\n#### `stream.append` takes new-grammar operations only\n\n**What it was.** `stream.append` took the old operation form.\n\n**What it is now.** It takes new-grammar operations and does not accept\n`keepShapes` (use `createKeepShapesResolver`). Its only local check is a\npinned Shape; everything else is checked by the server.\n\n**Migration.** Send `{ operation, name, shapes, data }` operations.\n\n#### Writes need a server running this release\n\n**What it was.** The SDK wrote to any current server.\n\n**What it is now.** Against an older server, writes fail the compatibility\ncheck with \"@warmhub/sdk-ts requires write contract 3, but the backend\nprovides 2.\"\n\n**Migration.** Upgrade the SDK after the server.\n\n### Added\n\n- **`client.ops(options?)`** — returns a new `OperationBuilder`.\n- **`shapeName(bare)`** — `'Deal'` to `'hub/shapes/Deal'`; idempotent.\n- **`isShapeReference(value)`** — true for a bare, unpinned Shape name.\n- **`WriteOperationError`** (extends `WarmHubError`) — with\n  `operationIndex`; its message starts `Invalid operation at index N:`.\n- **Types** — `WriteOperation`, `KeepShapesRevise`, `AddInput`,\n  `ReviseInput`, `RetractInput`, `ReaffirmInput`, `ShapesChoice`,\n  `CommitValidateOperations`, `RepositoryExportDeltaFormats`,\n  `ThingShapesReader`.\n- **`keepShapes: true` on a revise** — at submit the SDK reads the Thing's\n  current Shapes and version and sends both, the version as\n  `expectedVersion` (a supplied `expectedVersion` wins). Shapes are sent\n  bare, so the revise is checked against each Shape's current version. A\n  missing Thing is refused with `NOT_FOUND`. A Thing added, or renamed to or\n  from, earlier in the same submission is refused. A Thing revised earlier in\n  the same submission reuses that revise's Shapes and sends no version.\n  Because the version is pinned, resubmitting the same `submissionId` from\n  another process can conflict; explicit `shapes` is the retry-safe form.\n  ```ts\n  await client.commit.apply('acme', 'world', 'm',\n    client.ops().revise('acme', { keepShapes: true, data: { company: 'Acme 2' } }))\n  ```\n- **`createKeepShapesResolver(read)`** — resolves `keepShapes` revises for\n  `stream.append`. It keeps state across calls, so use one resolver per\n  submission.\n  ```ts\n  const resolve = createKeepShapesResolver((names) => client.thing.getMany('acme', 'world', names))\n  await client.stream.append({ /* ... */ operations: await resolve([\n    { operation: 'revise', name: 'acme', keepShapes: true, data: {} },\n  ]) })\n  ```\n- **Builders everywhere** — `commit.validate`, `commit.apply` and\n  `commit.applyStreaming` accept an `OperationBuilder` as well as an array.\n- **`shapeless: true` read filter** — on `thing.head`, `thing.query`,\n  `thing.count` and `live.thingHead`: only Things with no Shape. It\n  cannot be combined with `shape`, `declaredShape`, `match`, a token\n  restricted by paths, or `sinceRepoSeq`, and is not available on search or\n  the changes feeds.\n  ```ts\n  await client.thing.head('acme', 'world', { shapeless: true })\n  ```\n- **`warnings.shapeless?: true`** — on per-operation write results.\n- **`ThingGetManyResult.missingHints`** — for a missing reference that is an\n  old `Shape/name` spelling of a Thing you can read, the text naming its new\n  form.\n- **`declaredShapes` on refs items and history's `thing`** (history also\n  gains `validatedShapes`).\n- **`redactedResource: true`** — may appear on `TokenCreateResult` scopes.\n- **`details.reason` values** — `'legacy-wrefs-window-ended'` (from the\n  server) and `'legacy-wrefs-sdk'` (local).\n- **`DEPENDENCY_FAILED`** — exported as a constant.\n- **`LEGACY_WREFS_REFUSAL` and `WarmHubClient.clientFlags`**.\n- **Export** — `RepositoryExportErrorReason` gains `'format_mismatch'`;\n  `RepositoryExportSession.lastShapeVersion`; an `onRow` option on\n  `restoreRepositoryExportSession`. A resume that breaks between two versions\n  of one Shape continues from the right version.\n\n### Behavior worth knowing\n\n- **`clientFlags: ['legacy-wrefs']` refuses every call.** The SDK does not\n  send old-grammar requests. With the flag set, reads, writes, streaming,\n  export and the compatibility check all throw `WarmHubError` with code\n  `CLIENT_INCOMPATIBLE`, `details.reason: 'legacy-wrefs-sdk'`, and the\n  message \"`legacy-wrefs` is set; the SDKs are v2-only. Unset it, or use the\n  `wh` CLI for v1.\" Use the CLI to submit old-grammar files during the\n  compatibility window.\n\n### Changed\n\n- **Local checks before sending.** `commit.apply`, `commit.validate` and\n  the builder check every operation before sending when given an array or a\n  builder. An iterable, an async iterable, or `commit.applyStreaming` is\n  checked chunk by chunk, so a bad operation late in the source is refused\n  after earlier chunks were committed (`PartialStreamSubmissionError`).\n  `stream.append` checks only pinned Shapes.\n- **Content-limit error labels.**\n  ```text\n  Before: Field \"Content/Readme.content\" is N bytes; WarmHub content fields are limited to 65536 bytes. ...\n  After:  Field \"Readme.content\" is N bytes; WarmHub content fields are limited to 65536 bytes. ...\n  ```\n  `Agents.content` changes the same way.\n\n### Removed\n\n- **`AddOp`, `ReviseOp`, `RetractOp`, `CollectionAddOp`,\n  `CollectionAddType`, `OperationBuilderAddInput`** — use `WriteOperation`\n  and the builder input types.\n  ```ts\n  // Before\n  const op: AddOp = { name: 'Deal/acme', data: {} }\n  // After\n  const op: WriteOperation = { operation: 'add', name: 'acme', shapes: ['Deal'], data: {} }\n  ```\n- **Automatic old-grammar conversion** (`kind`, `about`, `type`/`members`,\n  `Shape/name` splitting).\n- **The local \"Selector-backed revise requires a Set/<name> target wref\"\n  check in `collection.revise`.** The server decides.\n"
        }
      ]
    },
    {
      "version": "0.141.0",
      "sourceSha": "798ff51d9a128c7196c419b6322115384c44d4f3",
      "notes": []
    },
    {
      "version": "0.142.0",
      "sourceSha": "1864f32b1776781546cf69c1b0f1fee9e748b38a",
      "notes": []
    },
    {
      "version": "0.143.0",
      "sourceSha": "30c1c1e3267fb5a818890794c82b4602d46dc02a",
      "notes": []
    },
    {
      "version": "0.144.0",
      "sourceSha": "afdf1b126e6f578b3ef214e6c56e8732ab9a7599",
      "notes": []
    },
    {
      "version": "0.145.0",
      "sourceSha": "b554042d01acc75236d70634ca4bc9150b8f1e95",
      "notes": []
    },
    {
      "version": "0.146.0",
      "sourceSha": "030df2fc02f64167a1de0b1c94438c25a9592a43",
      "notes": []
    },
    {
      "version": "0.147.0",
      "sourceSha": "f339a0b17523aa4b8837320096eb80fb03debf19",
      "notes": []
    },
    {
      "version": "0.148.0",
      "sourceSha": "98bb1d4fd1af7ec25148194c5ac21cfa95f80888",
      "notes": []
    },
    {
      "version": "0.149.0",
      "sourceSha": "5c92063917d8c26596c06e6632eac81e0fe1c5cc",
      "notes": []
    },
    {
      "version": "0.150.0",
      "sourceSha": "51df3f021c36cc337887612643f2e6e15166eb7b",
      "notes": []
    },
    {
      "version": "0.151.0",
      "sourceSha": "328254a84f050601eb5791f0f6f96e46f2a5cede",
      "notes": []
    },
    {
      "version": "0.152.0",
      "sourceSha": "b9992898f8098700ce10efa435e6a5489decea39",
      "notes": []
    },
    {
      "version": "0.153.1",
      "sourceSha": "0f3cb3bcf28b17c01555717909d628674fecefab",
      "notes": []
    },
    {
      "version": "0.153.2",
      "sourceSha": "1c6ce1f2a3dc87a33f4b10b69ae93915ec93a907",
      "notes": []
    }
  ]
}
