{
  "antiPatterns": [
    "Replaying a POST after a lost connection without an application-level idempotency guarantee.",
    "Parsing every SSE payload as JSON before inspecting the event type."
  ],
  "api": {
    "importPath": "@ancrel/client-core",
    "symbols": [
      "createHttpClient",
      "HttpError",
      "decodeSse",
      "subscribe",
      "postStream",
      "HttpClient",
      "HttpClientOptions",
      "SseFrame",
      "SubscribeOptions",
      "PostStreamOptions"
    ],
    "typeRef": "api/client-core/index.d.ts"
  },
  "constraints": [
    "Supply a completion predicate for application-specific terminal frames.",
    "Choose the GET cursor commit and unexpected EOF policies to match the server protocol.",
    "Use a Fetch-compatible runtime with Web Streams and UTF-8 decoding."
  ],
  "docs": "raw/frontend/client-core.md",
  "examples": [
    {
      "code": "import { createHttpClient, subscribe, type HttpClientOptions } from '@ancrel/client-core'\n\n// The snapshot and event feed share an opaque cursor. Resume immediately after the snapshot.\nexport default async function readUpdates(client: HttpClientOptions, signal?: AbortSignal) {\n  const snapshot = await createHttpClient(client).json<{ cursor: string; messages: string[] }>('snapshot', { signal })\n  const messages = [...snapshot.messages]\n  const frames = subscribe({\n    url: 'updates',\n    client,\n    signal,\n    cursor: snapshot.cursor,\n    commitCursor: 'on-dispatch',\n    onUnexpectedEof: 'error',\n    isTerminal: frame => frame.event === 'done',\n  })\n  for await (const frame of frames) {\n    if (frame.event === 'message') messages.push(frame.data)\n  }\n  return messages\n}\n",
      "command": "pnpm test",
      "entry": "examples/fe.client-core/App.tsx",
      "fixture": "examples/fe.client-core/",
      "id": "minimal"
    }
  ],
  "id": "fe.client-core",
  "kind": "library",
  "language": "typescript",
  "layer": "frontend",
  "owner": "frontend-infra",
  "package": {
    "ecosystem": "npm",
    "name": "@ancrel/client-core",
    "version": "0.2.0"
  },
  "provenance": {
    "changes": "Extracted the HTTP and POST transport from client.ts lines 90–175 and 1955–2060, and text, error and GET cursor handling from frontend/src/api/rsiClient.ts lines 35–115 and 1300–1415. Corrected header merging, incremental framing and cancellation. Moved completion, cursor and EOF policy to the caller and removed endpoint-specific behavior.",
    "commit": "4cc384c3bdbd09a3a50268adf81ba23f53aac93e",
    "mode": "extracted",
    "origin": "rule-studio",
    "path": "frontend/src/api/client.ts",
    "rights": "org-internal; approved-by=owner; ref=item-19"
  },
  "schemaVersion": 1,
  "stability": "experimental",
  "summary": "Read HTTP responses, resume a GET event feed by cursor, or submit a single POST command and stream its result."
}
