stitchkit 0.124.1 → 0.124.2

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/browser/client-executors.d.ts.map +1 -1
  3. package/dist/browser/contract-stream.d.ts +7 -2
  4. package/dist/browser/contract-stream.d.ts.map +1 -1
  5. package/dist/entrypoints/agent-runtime/sandbox.js +1 -1
  6. package/dist/entrypoints/cli/publish.js +1 -1
  7. package/dist/entrypoints/cli.js +2 -2
  8. package/dist/entrypoints/http.js +2 -2
  9. package/dist/entrypoints/index.js +3 -3
  10. package/dist/entrypoints/node.js +1 -1
  11. package/dist/entrypoints/process.js +1 -1
  12. package/dist/entrypoints/remote.js +1 -1
  13. package/dist/entrypoints/server.js +2 -2
  14. package/dist/entrypoints/testing.js +1 -1
  15. package/dist/entrypoints/tools/connections.js +1 -1
  16. package/dist/entrypoints/tools/toolkit.js +1 -1
  17. package/dist/entrypoints/tools.js +2 -2
  18. package/dist/{index-03qrr49d.js → index-b2sey031.js} +1 -1
  19. package/dist/{index-x0769xt9.js → index-btjwc7xr.js} +1 -1
  20. package/dist/{index-6qrspvxp.js → index-gbj964dt.js} +1 -1
  21. package/dist/{index-e1x6vze4.js → index-hzk4ydpy.js} +1 -1
  22. package/dist/{index-45dyex0j.js → index-m9hb9wnk.js} +1 -1
  23. package/dist/{index-zbzagr9k.js → index-ne4j9998.js} +16 -15
  24. package/dist/{index-cjbn98zt.js → index-ss67fxhj.js} +21 -3
  25. package/dist/{index-5efrpfmj.js → index-wxadzdb7.js} +1 -1
  26. package/dist/internal/stream-chunks.d.ts +10 -0
  27. package/dist/internal/stream-chunks.d.ts.map +1 -1
  28. package/llms/stitchkit.2.txt +6 -0
  29. package/llms/stitchkit.3.txt +1 -1
  30. package/llms-full.txt +7 -1
  31. package/llms.txt +1 -1
  32. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -15,6 +15,21 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [0.124.2] - 2026-11-17
19
+
20
+ ### Fixed
21
+
22
+ - `stitchkit`, `stitchkit/http` — **a streaming endpoint reads the response of another runtime's
23
+ fetch.** The typed client refused any response that was not the global `Response` class with
24
+ `Streaming endpoint did not return a Response`, so a `ClientFetch` built on `expo/fetch` in React
25
+ Native — whose `FetchResponse` is its own class — never read a stream, and the bare-fetch client
26
+ failed on it with a `TypeError`. Both client paths now take a response by its shape, a `body`
27
+ with `getReader()`, and both refuse one without a readable body with that same error.
28
+ `parseNDJSON`, `parseSSE` and `readBoundedBody` recognise a source by its shape as well: a
29
+ reader, then `Symbol.asyncIterator`, else the response's `body`; a response with no `body` at
30
+ all is a `TypeError` that says so.
31
+ **Affects:** `stitchkit` createClient(stream), createClients(stream), parseNDJSON, parseSSE, readBoundedBody; `stitchkit/http` createClient(stream), createClients(stream), readBoundedBody
32
+
18
33
  ## [0.124.1] - 2026-11-17
19
34
 
20
35
  ### Added
@@ -1 +1 @@
1
- {"version":3,"file":"client-executors.d.ts","sourceRoot":"","sources":["../../src/browser/client-executors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAOtD,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAInE,OAAO,EACL,KAAK,UAAU,IAAI,WAAW,EAG/B,MAAM,QAAQ,CAAC;AAmEhB,MAAM,MAAM,qBAAqB,GAAG,CAClC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,OAAO,CAAC,EAAE,oBAAoB,KAC3B,OAAO,CAAC,OAAO,CAAC,CAAC;AAEtB,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EACjD,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,WAAW,EACnB,MAAM,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAC/B,qBAAqB,CA+DvB;AAED,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAClD,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,YAAY,EACpB,cAAc,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,GACvC,qBAAqB,CA4HvB"}
1
+ {"version":3,"file":"client-executors.d.ts","sourceRoot":"","sources":["../../src/browser/client-executors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAOtD,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAInE,OAAO,EACL,KAAK,UAAU,IAAI,WAAW,EAG/B,MAAM,QAAQ,CAAC;AA6DhB,MAAM,MAAM,qBAAqB,GAAG,CAClC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,OAAO,CAAC,EAAE,oBAAoB,KAC3B,OAAO,CAAC,OAAO,CAAC,CAAC;AAEtB,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EACjD,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,WAAW,EACnB,MAAM,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAC/B,qBAAqB,CA+DvB;AAED,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAClD,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,YAAY,EACpB,cAAc,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,GACvC,qBAAqB,CA4HvB"}
@@ -1,5 +1,10 @@
1
1
  import type { ZodType } from 'zod';
2
2
  import type { EndpointStreamDescriptor } from '../contract/define.js';
3
- /** Convert protocol frames into an immediately-owned schema-derived iterator. */
4
- export declare function parseContractStream<T>(response: Response, descriptor: EndpointStreamDescriptor<ZodType<T>>, abort: () => void): AsyncIterableIterator<T>;
3
+ /**
4
+ * Convert a streaming endpoint's response into an immediately-owned schema-derived iterator. The
5
+ * response is recognised by its shape — a `body` with `getReader()` — so the response class of
6
+ * another runtime's fetch (`expo/fetch` in React Native) streams like the global `Response`; one
7
+ * without a readable body is refused by name, and the request is aborted.
8
+ */
9
+ export declare function parseContractStream<T>(response: unknown, descriptor: EndpointStreamDescriptor<ZodType<T>>, abort: () => void): AsyncIterableIterator<T>;
5
10
  //# sourceMappingURL=contract-stream.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-stream.d.ts","sourceRoot":"","sources":["../../src/browser/contract-stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAoInE,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAChD,KAAK,EAAE,MAAM,IAAI,GAChB,qBAAqB,CAAC,CAAC,CAAC,CAE1B"}
1
+ {"version":3,"file":"contract-stream.d.ts","sourceRoot":"","sources":["../../src/browser/contract-stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAqInE;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,QAAQ,EAAE,OAAO,EACjB,UAAU,EAAE,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAChD,KAAK,EAAE,MAAM,IAAI,GAChB,qBAAqB,CAAC,CAAC,CAAC,CAM1B"}
@@ -31,7 +31,7 @@ import {
31
31
  } from "../../index-jj9228tt.js";
32
32
  import {
33
33
  readBoundedBody2
34
- } from "../../index-5efrpfmj.js";
34
+ } from "../../index-wxadzdb7.js";
35
35
  import {
36
36
  MAX_TIMER_MS
37
37
  } from "../../index-eemvahkc.js";
@@ -15,7 +15,7 @@ import {
15
15
  gzipCliAsset,
16
16
  decodeCliAsset,
17
17
  compareCliVersions2
18
- } from "../../index-x0769xt9.js";
18
+ } from "../../index-btjwc7xr.js";
19
19
  import {
20
20
  withExclusiveLock2
21
21
  } from "../../index-fvd6pvw3.js";
@@ -17,7 +17,7 @@ import {
17
17
  renderCliView2,
18
18
  pollUntilDone2,
19
19
  createCli2
20
- } from "../index-e1x6vze4.js";
20
+ } from "../index-hzk4ydpy.js";
21
21
  import"../index-ndjzbt2v.js";
22
22
  import"../index-ct75c3at.js";
23
23
  import"../index-tynna0n4.js";
@@ -46,7 +46,7 @@ import {
46
46
  checkCliUpdate2,
47
47
  applyCliUpdate2,
48
48
  rollbackCliUpdate2
49
- } from "../index-x0769xt9.js";
49
+ } from "../index-btjwc7xr.js";
50
50
  import"../index-bqzgaj57.js";
51
51
  import"../index-3ymcmpa9.js";
52
52
  import"../index-fa53vygr.js";
@@ -14,13 +14,13 @@ import {
14
14
  createUrlBuilder2,
15
15
  createUrlBuilders2,
16
16
  createScopedUrlBuilders2
17
- } from "../index-zbzagr9k.js";
17
+ } from "../index-ne4j9998.js";
18
18
  import {
19
19
  ApiError2
20
20
  } from "../index-kfjkb396.js";
21
21
  import {
22
22
  readBoundedBody2
23
- } from "../index-5efrpfmj.js";
23
+ } from "../index-wxadzdb7.js";
24
24
  export {
25
25
  ApiError2 as ApiError,
26
26
  contractEndpointMatchers2 as contractEndpointMatchers,
@@ -71,11 +71,11 @@ import {
71
71
  createUrlBuilder2,
72
72
  createUrlBuilders2,
73
73
  createScopedUrlBuilders2
74
- } from "../index-zbzagr9k.js";
74
+ } from "../index-ne4j9998.js";
75
75
  import {
76
76
  StreamLineLimitError2,
77
77
  StreamTruncatedLineError2
78
- } from "../index-45dyex0j.js";
78
+ } from "../index-m9hb9wnk.js";
79
79
  import {
80
80
  createRetainedTopics2,
81
81
  createRealtimeClientWithPeer,
@@ -92,7 +92,7 @@ import {
92
92
  } from "../index-wqzw3qg9.js";
93
93
  import {
94
94
  readBoundedBody2
95
- } from "../index-5efrpfmj.js";
95
+ } from "../index-wxadzdb7.js";
96
96
  import {
97
97
  sleep
98
98
  } from "../index-eemvahkc.js";
@@ -24,7 +24,7 @@ import {
24
24
  createSocketIOServer2,
25
25
  UnixClientTransportError2,
26
26
  createUnixClientTransport2
27
- } from "../index-6qrspvxp.js";
27
+ } from "../index-gbj964dt.js";
28
28
  import {
29
29
  bindRealtimeServer2
30
30
  } from "../index-sqkttz7z.js";
@@ -22,7 +22,7 @@ import {
22
22
  import {
23
23
  StreamLineLimitError2,
24
24
  readBoundedUtf8Lines
25
- } from "../index-45dyex0j.js";
25
+ } from "../index-m9hb9wnk.js";
26
26
  import {
27
27
  safeJsonParse
28
28
  } from "../index-zsarb5xp.js";
@@ -5,7 +5,7 @@ import"../index-yt1gg11x.js";
5
5
  import {
6
6
  endpointHasArguments,
7
7
  createClient2
8
- } from "../index-zbzagr9k.js";
8
+ } from "../index-ne4j9998.js";
9
9
  import {
10
10
  ApiError2
11
11
  } from "../index-kfjkb396.js";
@@ -53,7 +53,7 @@ import {
53
53
  socketIoLane2,
54
54
  UnixClientTransportError2,
55
55
  createUnixClientTransport2
56
- } from "../index-6qrspvxp.js";
56
+ } from "../index-gbj964dt.js";
57
57
  import {
58
58
  createFileStateStore2
59
59
  } from "../index-1szhrfsf.js";
@@ -113,7 +113,7 @@ import {
113
113
  import {
114
114
  readBoundedChunks,
115
115
  concatChunks
116
- } from "../index-5efrpfmj.js";
116
+ } from "../index-wxadzdb7.js";
117
117
  import {
118
118
  assertPositiveSafeInteger
119
119
  } from "../index-0s4xebbg.js";
@@ -36,7 +36,7 @@ import"../index-ndjzbt2v.js";
36
36
  import {
37
37
  createClient2,
38
38
  createClients2
39
- } from "../index-zbzagr9k.js";
39
+ } from "../index-ne4j9998.js";
40
40
  import {
41
41
  assertPositiveSafeInteger
42
42
  } from "../index-0s4xebbg.js";
@@ -37,7 +37,7 @@ import {
37
37
  import {
38
38
  readBoundedChunks,
39
39
  concatChunks
40
- } from "../../index-5efrpfmj.js";
40
+ } from "../../index-wxadzdb7.js";
41
41
  import {
42
42
  MAX_TIMER_MS
43
43
  } from "../../index-eemvahkc.js";
@@ -11,7 +11,7 @@ import {
11
11
  } from "../../index-yebkpytc.js";
12
12
  import {
13
13
  createCli2
14
- } from "../../index-e1x6vze4.js";
14
+ } from "../../index-hzk4ydpy.js";
15
15
  import"../../index-332d0m9g.js";
16
16
  import"../../index-sqc6ezrb.js";
17
17
  import"../../index-gy9x38a2.js";
@@ -105,11 +105,11 @@ import {
105
105
  fetchGuarded,
106
106
  fetchPinnedDocument,
107
107
  readCapped
108
- } from "../index-03qrr49d.js";
108
+ } from "../index-b2sey031.js";
109
109
  import {
110
110
  readBoundedChunks,
111
111
  concatChunks
112
- } from "../index-5efrpfmj.js";
112
+ } from "../index-wxadzdb7.js";
113
113
  import {
114
114
  assertPositiveSafeInteger
115
115
  } from "../index-0s4xebbg.js";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./index-wqzw3qg9.js";
7
7
  import {
8
8
  readBoundedChunks
9
- } from "./index-5efrpfmj.js";
9
+ } from "./index-wxadzdb7.js";
10
10
 
11
11
  // src/internal/secure-fetch.ts
12
12
  import { lookup } from "node:dns/promises";
@@ -9,7 +9,7 @@ import {
9
9
  fetchGuarded,
10
10
  PrivateAddressRefusal,
11
11
  readCapped
12
- } from "./index-03qrr49d.js";
12
+ } from "./index-b2sey031.js";
13
13
  import {
14
14
  raceAbort
15
15
  } from "./index-b0kddvzw.js";
@@ -65,7 +65,7 @@ import {
65
65
  readBoundedChunks,
66
66
  concatChunks,
67
67
  readBoundedBody2
68
- } from "./index-5efrpfmj.js";
68
+ } from "./index-wxadzdb7.js";
69
69
  import {
70
70
  assertPositiveSafeInteger
71
71
  } from "./index-0s4xebbg.js";
@@ -57,7 +57,7 @@ import {
57
57
  import {
58
58
  fetchGuarded,
59
59
  readCapped
60
- } from "./index-03qrr49d.js";
60
+ } from "./index-b2sey031.js";
61
61
  import {
62
62
  errnoOf
63
63
  } from "./index-jj9228tt.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  chunksOf
3
- } from "./index-cjbn98zt.js";
3
+ } from "./index-ss67fxhj.js";
4
4
  import {
5
5
  assertPositiveSafeInteger
6
6
  } from "./index-0s4xebbg.js";
@@ -18,7 +18,7 @@ import {
18
18
  DEFAULT_STREAM_LINE_BYTES,
19
19
  createBoundedLineDecoder,
20
20
  readBoundedUtf8Lines
21
- } from "./index-45dyex0j.js";
21
+ } from "./index-m9hb9wnk.js";
22
22
  import {
23
23
  inputIsQuery
24
24
  } from "./index-xhzq2qvj.js";
@@ -26,6 +26,9 @@ import {
26
26
  ApiError2,
27
27
  refuseLocally
28
28
  } from "./index-kfjkb396.js";
29
+ import {
30
+ isStreamResponse
31
+ } from "./index-ss67fxhj.js";
29
32
  import {
30
33
  typedEntries,
31
34
  isRecord,
@@ -415,17 +418,17 @@ async function* parseSSE2(source, options) {
415
418
  }
416
419
 
417
420
  // src/browser/contract-stream.ts
418
- function sourceFor(response, descriptor) {
421
+ function sourceFor(body, descriptor) {
419
422
  const options = {
420
423
  maxLineBytes: descriptor.maxFrameBytes ?? DEFAULT_CONTRACT_STREAM_FRAME_BYTES2,
421
424
  finalLine: descriptor.finalLine
422
425
  };
423
- return descriptor.format === "sse" ? parseSSE2(response, options) : parseNDJSON2(response, options);
426
+ return descriptor.format === "sse" ? parseSSE2(body, options) : parseNDJSON2(body, options);
424
427
  }
425
- async function* readContractStream(response, descriptor, abort) {
428
+ async function* readContractStream(body, descriptor, abort) {
426
429
  let ended = false;
427
430
  let terminalSeen = descriptor.terminal === undefined;
428
- const source = sourceFor(response, descriptor);
431
+ const source = sourceFor(body, descriptor);
429
432
  try {
430
433
  for (;; ) {
431
434
  const next = await source.next();
@@ -525,7 +528,11 @@ class OwnedContractStream {
525
528
  }
526
529
  }
527
530
  function parseContractStream(response, descriptor, abort) {
528
- return new OwnedContractStream(readContractStream(response, descriptor, abort), abort);
531
+ if (!isStreamResponse(response)) {
532
+ abort();
533
+ throw new Error("Streaming endpoint did not return a Response");
534
+ }
535
+ return new OwnedContractStream(readContractStream(response.body, descriptor, abort), abort);
529
536
  }
530
537
 
531
538
  // src/browser/client-executors.ts
@@ -543,15 +550,9 @@ function withOutput(endpoint, result, abortStream) {
543
550
  if (endpoint.rawResponse)
544
551
  return result;
545
552
  if ("stream" in endpoint && endpoint.stream) {
546
- return result.then((value) => {
547
- if (!(value instanceof Response)) {
548
- abortStream?.();
549
- throw new Error("Streaming endpoint did not return a Response");
550
- }
551
- return parseContractStream(value, endpoint.stream, abortStream ?? (() => {
552
- return;
553
- }));
554
- }, (error) => {
553
+ return result.then((value) => parseContractStream(value, endpoint.stream, abortStream ?? (() => {
554
+ return;
555
+ })), (error) => {
555
556
  abortStream?.();
556
557
  throw error;
557
558
  });
@@ -2,14 +2,32 @@ import {
2
2
  abortReason,
3
3
  untilAborted
4
4
  } from "./index-a5qr2rj6.js";
5
+ import {
6
+ isRecord
7
+ } from "./index-hkxgennw.js";
5
8
 
6
9
  // src/internal/stream-chunks.ts
10
+ function isReadableByteStream(value) {
11
+ return isRecord(value) && typeof value.getReader === "function";
12
+ }
13
+ function isStreamResponse(value) {
14
+ return isRecord(value) && isReadableByteStream(value.body);
15
+ }
16
+ function bytesOf(source) {
17
+ if (isReadableByteStream(source))
18
+ return source;
19
+ if (Symbol.asyncIterator in source)
20
+ return source;
21
+ if (source.body === undefined)
22
+ throw new TypeError("The response has no body stream to read");
23
+ return source.body;
24
+ }
7
25
  async function* chunksOf(source, signal) {
8
26
  signal?.throwIfAborted();
9
- const stream = source instanceof Response ? source.body : source;
27
+ const stream = bytesOf(source);
10
28
  if (stream === null)
11
29
  return;
12
- if (stream instanceof ReadableStream) {
30
+ if (isReadableByteStream(stream)) {
13
31
  const reader = stream.getReader();
14
32
  const abort = () => {
15
33
  if (signal)
@@ -65,4 +83,4 @@ async function* chunksOf(source, signal) {
65
83
  }
66
84
  }
67
85
 
68
- export { chunksOf };
86
+ export { isStreamResponse, chunksOf };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  chunksOf
3
- } from "./index-cjbn98zt.js";
3
+ } from "./index-ss67fxhj.js";
4
4
  import {
5
5
  assertPositiveSafeInteger
6
6
  } from "./index-0s4xebbg.js";
@@ -1,5 +1,15 @@
1
1
  /** Bytes a stream reader accepts: a `Response` body, a web stream, or any async byte iterable. */
2
2
  export type StreamByteSource = Response | ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>;
3
+ /** A response of any fetch runtime whose body can be read as a web stream. */
4
+ export type StreamResponse = {
5
+ readonly body: ReadableStream<Uint8Array>;
6
+ };
7
+ /**
8
+ * Whether a value is a response with a readable body — the global `Response` or another runtime's,
9
+ * such as the `FetchResponse` of `expo/fetch`, which is its own class. A response without a body is
10
+ * not one.
11
+ */
12
+ export declare function isStreamResponse(value: unknown): value is StreamResponse;
3
13
  /**
4
14
  * Every chunk of a byte source: the chunk loop the line readers and the bounded body readers
5
15
  * share. The source is cancelled or returned on every exit path.
@@ -1 +1 @@
1
- {"version":3,"file":"stream-chunks.d.ts","sourceRoot":"","sources":["../../src/internal/stream-chunks.ts"],"names":[],"mappings":"AAEA,kGAAkG;AAClG,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,cAAc,CAAC,UAAU,CAAC,GAC1B,aAAa,CAAC,UAAU,CAAC,CAAC;AAE9B;;;;;;;;GAQG;AACH,wBAAuB,QAAQ,CAC7B,MAAM,EAAE,gBAAgB,EACxB,MAAM,CAAC,EAAE,WAAW,GACnB,cAAc,CAAC,UAAU,CAAC,CA+C5B"}
1
+ {"version":3,"file":"stream-chunks.d.ts","sourceRoot":"","sources":["../../src/internal/stream-chunks.ts"],"names":[],"mappings":"AAGA,kGAAkG;AAClG,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,cAAc,CAAC,UAAU,CAAC,GAC1B,aAAa,CAAC,UAAU,CAAC,CAAC;AAE9B,8EAA8E;AAC9E,MAAM,MAAM,cAAc,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,CAAA;CAAE,CAAC;AAO3E;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAExE;AAmBD;;;;;;;;GAQG;AACH,wBAAuB,QAAQ,CAC7B,MAAM,EAAE,gBAAgB,EACxB,MAAM,CAAC,EAAE,WAAW,GACnB,cAAc,CAAC,UAAU,CAAC,CA+C5B"}
@@ -501,6 +501,12 @@ body until it ends or is cancelled. This is the same for a Fetch-config client,
501
501
  Unix transport. Cancelling a quiet stream therefore releases its server source
502
502
  and transport connection instead of only settling the local iterator.
503
503
 
504
+ A stream is read from any response whose `body` has `getReader()`, not only from
505
+ the global `Response` class: a `fetch` of another runtime — `expo/fetch` in
506
+ React Native, which answers with its own `FetchResponse` — streams the same way.
507
+ A response without a readable body is refused with `Streaming endpoint did not
508
+ return a Response`.
509
+
504
510
  An established NDJSON protocol may keep its item schema as the complete wire
505
511
  frame. This mode requires a terminal item because an unwrapped response has no
506
512
  separate safe error/end envelope:
@@ -88,7 +88,7 @@ The browser-and-server entrypoint. Re-exports everything from
88
88
  | `parseNDJSON` | function | parse bounded fatal-UTF-8 NDJSON from a `Response`, a `ReadableStream<Uint8Array>` or an `AsyncIterable<Uint8Array>` (a child's stdout); blank keep-alives are skipped, `finalLine: 'require-newline'` makes the delimiter mandatory and `signal` cancels the source — [guide](../guide/client.md#any-byte-source) |
89
89
  | `createNDJSONDecoder` / `NDJSONDecoder` | function / _type_ | the same bounded NDJSON reading driven by `push(chunk)` / `end()`, for a socket `data` callback |
90
90
  | `readBoundedBody` / `BoundedBodyOptions` | function / _type_ | the whole body of a `ReadableStream<Uint8Array>` or async byte iterable as bytes, never reading past `maxBytes` plus one chunk; `limitError(observedBytes)` and `abortError(reason)` choose the two errors, the source is cancelled on both, a `null` body is empty — [guide](../guide/client.md#reading-a-body-up-to-a-byte-limit) |
91
- | `StreamByteSource` | _type_ | `Response \| ReadableStream<Uint8Array> \| AsyncIterable<Uint8Array>`, what the NDJSON and SSE readers accept |
91
+ | `StreamByteSource` | _type_ | `Response \| ReadableStream<Uint8Array> \| AsyncIterable<Uint8Array>`, what the NDJSON and SSE readers accept; each is recognised by its shape, not its class — a reader, `Symbol.asyncIterator`, else the response's `body` — so another runtime's fetch response (`expo/fetch`) reads like the global `Response` |
92
92
  | `StreamLineLimitError` / `StreamTruncatedLineError` | class | a line past `maxLineBytes` (`limitBytes`, `lineBytes`; a `RangeError`) and a source ended inside a line under `require-newline` (`lineBytes`; a `SyntaxError`) |
93
93
  | `resumableIterator` | function | re-open a long-lived stream from the last delivered cursor, with jittered backoff, a caller-owned terminal item and prompt abort — [guide](../guide/client.md#resumable-streams) |
94
94
  | `createBackoff` | function | exponential backoff with subtractive jitter as a value: `next()` / `reset()` |
package/llms-full.txt CHANGED
@@ -3753,6 +3753,12 @@ body until it ends or is cancelled. This is the same for a Fetch-config client,
3753
3753
  Unix transport. Cancelling a quiet stream therefore releases its server source
3754
3754
  and transport connection instead of only settling the local iterator.
3755
3755
 
3756
+ A stream is read from any response whose `body` has `getReader()`, not only from
3757
+ the global `Response` class: a `fetch` of another runtime — `expo/fetch` in
3758
+ React Native, which answers with its own `FetchResponse` — streams the same way.
3759
+ A response without a readable body is refused with `Streaming endpoint did not
3760
+ return a Response`.
3761
+
3756
3762
  An established NDJSON protocol may keep its item schema as the complete wire
3757
3763
  frame. This mode requires a terminal item because an unwrapped response has no
3758
3764
  separate safe error/end envelope:
@@ -23440,7 +23446,7 @@ The browser-and-server entrypoint. Re-exports everything from
23440
23446
  | `parseNDJSON` | function | parse bounded fatal-UTF-8 NDJSON from a `Response`, a `ReadableStream<Uint8Array>` or an `AsyncIterable<Uint8Array>` (a child's stdout); blank keep-alives are skipped, `finalLine: 'require-newline'` makes the delimiter mandatory and `signal` cancels the source — [guide](../guide/client.md#any-byte-source) |
23441
23447
  | `createNDJSONDecoder` / `NDJSONDecoder` | function / _type_ | the same bounded NDJSON reading driven by `push(chunk)` / `end()`, for a socket `data` callback |
23442
23448
  | `readBoundedBody` / `BoundedBodyOptions` | function / _type_ | the whole body of a `ReadableStream<Uint8Array>` or async byte iterable as bytes, never reading past `maxBytes` plus one chunk; `limitError(observedBytes)` and `abortError(reason)` choose the two errors, the source is cancelled on both, a `null` body is empty — [guide](../guide/client.md#reading-a-body-up-to-a-byte-limit) |
23443
- | `StreamByteSource` | _type_ | `Response \| ReadableStream<Uint8Array> \| AsyncIterable<Uint8Array>`, what the NDJSON and SSE readers accept |
23449
+ | `StreamByteSource` | _type_ | `Response \| ReadableStream<Uint8Array> \| AsyncIterable<Uint8Array>`, what the NDJSON and SSE readers accept; each is recognised by its shape, not its class — a reader, `Symbol.asyncIterator`, else the response's `body` — so another runtime's fetch response (`expo/fetch`) reads like the global `Response` |
23444
23450
  | `StreamLineLimitError` / `StreamTruncatedLineError` | class | a line past `maxLineBytes` (`limitBytes`, `lineBytes`; a `RangeError`) and a source ended inside a line under `require-newline` (`lineBytes`; a `SyntaxError`) |
23445
23451
  | `resumableIterator` | function | re-open a long-lived stream from the last delivered cursor, with jittered backoff, a caller-owned terminal item and prompt abort — [guide](../guide/client.md#resumable-streams) |
23446
23452
  | `createBackoff` | function | exponential backoff with subtractive jitter as a value: `next()` / `reset()` |
package/llms.txt CHANGED
@@ -9,7 +9,7 @@ Build with stitchkit: define a contract once, then `implement` it and serve it (
9
9
  Load the slice for each entrypoint your code imports — `import … from 'stitchkit/server'` → `llms/server.txt`; the root `stitchkit` import → `llms/stitchkit.txt`. A slice holds that entrypoint's API reference section and the guide pages whose home it is; every guide lives in exactly one slice, and a slice that needs another's guide names it under "Also read". Each file is at most 50.0 KB; a longer one continues in numbered parts, each naming the next at its top. Moving across versions: load `llms/upgrading.txt` and the range slices it lists between your version and the target. `llms-full.txt` inlines everything; it is far larger than a context window, so do not read it whole.
10
10
 
11
11
  ## Entrypoint slices
12
- - **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt) 45.2 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt) 30.9 KB → [llms/stitchkit.3.txt](llms/stitchkit.3.txt) 19.1 KB
12
+ - **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt) 45.2 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt) 31.2 KB → [llms/stitchkit.3.txt](llms/stitchkit.3.txt) 19.3 KB
13
13
  - **stitchkit/live**: [llms/live.txt](llms/live.txt) 21.2 KB
14
14
  - **stitchkit/react**: [llms/react.txt](llms/react.txt) 8.7 KB
15
15
  - **stitchkit/react/keyboard**: [llms/react-keyboard.txt](llms/react-keyboard.txt) 22.7 KB
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitchkit",
3
- "version": "0.124.1",
3
+ "version": "0.124.2",
4
4
  "description": "Contract-first backend framework — one defineContract() into an HTTP API, MCP tools, AI-agent tools and a typed client. Bun and Node.",
5
5
  "keywords": [
6
6
  "bun",
@@ -409,20 +409,20 @@
409
409
  "@modelcontextprotocol/server": "^2.4.0",
410
410
  "@openrouter/ai-sdk-provider": "^3.1.0",
411
411
  "@opentelemetry/api": "^1.10.0",
412
- "@seriousme/openapi-schema-validator": "^2.11.0",
412
+ "@seriousme/openapi-schema-validator": "^2.12.0",
413
413
  "@socket.io/bun-engine": "^0.1.2",
414
414
  "@socket.io/component-emitter": "^3.1.2",
415
- "@tanstack/react-query": "5.105.3",
415
+ "@tanstack/react-query": "5.108.0",
416
416
  "@types/bun": "^1.4.4",
417
417
  "@types/json-schema": "^7.0.15",
418
418
  "@types/react": "^19.3.0",
419
419
  "@types/react-dom": "^19.3.0",
420
420
  "@typescript/typescript6": "^6.0.2",
421
- "ai": "^7.0.162",
421
+ "ai": "^7.0.173",
422
422
  "ajv": "^8.20.0",
423
423
  "exceljs": "^4.4.0",
424
- "fake-indexeddb": "^6.2.7",
425
- "google-auth-library": "^11.3.3",
424
+ "fake-indexeddb": "^6.2.8",
425
+ "google-auth-library": "^11.3.4",
426
426
  "grammy": "^1.46.0",
427
427
  "react": "^19.3.1",
428
428
  "react-dom": "^19.3.1",