2.5 KiB
2.5 KiB
KriFrontCommon Consumer Contract
- Consume the published
@kri/commonpackage only through entry points declared by itspackage.jsonexportsmap. - Do not import from
@kri/common/src/*,@kri/common/dist/*, or another undeclared deep path. - Prefer a public shared helper or an approved backward-compatible library addition over copying or forking shared behavior locally.
- Do not modify KriFrontCommon or another consumer repository unless it is explicitly included in the approved task scope.
Required Shared References
Before each related task, read the current contents of every matching reference, even if it was read earlier in the session.
| Task scope | Required reference |
|---|---|
| Package entry points, runtime boundaries, HTTP, authentication, state, storage, environment, or optional peer integrations | .agent-harness/references/kri-front-common/package-and-runtime.md |
| React rendering performance, memoization, or React Compiler behavior | .agent-harness/references/kri-front-common/react-compiler.md |
| Package upgrade, dependency changes, lockfile, or verification | .agent-harness/references/kri-front-common/change-and-verification.md |
If a task spans multiple scopes, read every matching reference. Generated files under .agent-harness/references/ are read-only copies; edit KriFrontCommon's .agent/consumer.md or .agent/consumer-references/ and recompose instead.
HTTP Streaming
@kri/common/httpHTTP clients expose streamGet/streamPost/streamPut/streamPatch/streamDel, returning HttpStreamResponse (status, statusText, headers, url, nullable body).- Streaming shares ordinary authentication, URL, body and HTTP-error policy. Read body incrementally; no automatic JSON/NDJSON/SSE parsing or reconnect is performed.
- Streaming options accept an external AbortSignal. Caller cancellation raises AbortError without an HTTP error notification. Cancel the body when it will not be consumed.
- timeoutMs covers connection/headers (and an HTTP error body); idleTimeoutMs covers inactivity after successful headers and resets on consumed chunks. Both default to the client's defaultTimeoutMs (60 seconds by default), and 0 disables that timer for streaming only.
- Mid-stream transport/time-out errors reach the body reader. HTTP error statuses use existing HttpError handlers before a stream is returned. A 204 response has body=null.
- See HTTP_STREAMING.md for examples and node --test tests/http-stream.test.mjs for focused validation after npm run build.