@smithery/api 0.30.0 → 0.32.0

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 (160) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/client.d.mts +3 -7
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +3 -7
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/core/pagination.d.mts +0 -37
  9. package/core/pagination.d.mts.map +1 -1
  10. package/core/pagination.d.ts +0 -37
  11. package/core/pagination.d.ts.map +1 -1
  12. package/core/pagination.js +1 -47
  13. package/core/pagination.js.map +1 -1
  14. package/core/pagination.mjs +0 -44
  15. package/core/pagination.mjs.map +1 -1
  16. package/core/streaming.d.mts +33 -0
  17. package/core/streaming.d.mts.map +1 -0
  18. package/core/streaming.d.ts +33 -0
  19. package/core/streaming.d.ts.map +1 -0
  20. package/core/streaming.js +263 -0
  21. package/core/streaming.js.map +1 -0
  22. package/core/streaming.mjs +258 -0
  23. package/core/streaming.mjs.map +1 -0
  24. package/internal/decoders/line.d.mts +17 -0
  25. package/internal/decoders/line.d.mts.map +1 -0
  26. package/internal/decoders/line.d.ts +17 -0
  27. package/internal/decoders/line.d.ts.map +1 -0
  28. package/internal/decoders/line.js +113 -0
  29. package/internal/decoders/line.js.map +1 -0
  30. package/internal/decoders/line.mjs +108 -0
  31. package/internal/decoders/line.mjs.map +1 -0
  32. package/internal/parse.d.mts.map +1 -1
  33. package/internal/parse.d.ts.map +1 -1
  34. package/internal/parse.js +10 -0
  35. package/internal/parse.js.map +1 -1
  36. package/internal/parse.mjs +10 -0
  37. package/internal/parse.mjs.map +1 -1
  38. package/internal/request-options.d.mts +2 -0
  39. package/internal/request-options.d.mts.map +1 -1
  40. package/internal/request-options.d.ts +2 -0
  41. package/internal/request-options.d.ts.map +1 -1
  42. package/internal/request-options.js.map +1 -1
  43. package/internal/request-options.mjs.map +1 -1
  44. package/package.json +11 -1
  45. package/resources/beta/beta.d.mts +0 -4
  46. package/resources/beta/beta.d.mts.map +1 -1
  47. package/resources/beta/beta.d.ts +0 -4
  48. package/resources/beta/beta.d.ts.map +1 -1
  49. package/resources/beta/beta.js +0 -4
  50. package/resources/beta/beta.js.map +1 -1
  51. package/resources/beta/beta.mjs +0 -4
  52. package/resources/beta/beta.mjs.map +1 -1
  53. package/resources/beta/connect/mcp.d.mts +1 -24
  54. package/resources/beta/connect/mcp.d.mts.map +1 -1
  55. package/resources/beta/connect/mcp.d.ts +1 -24
  56. package/resources/beta/connect/mcp.d.ts.map +1 -1
  57. package/resources/beta/connect/mcp.js +3 -7
  58. package/resources/beta/connect/mcp.js.map +1 -1
  59. package/resources/beta/connect/mcp.mjs +3 -7
  60. package/resources/beta/connect/mcp.mjs.map +1 -1
  61. package/resources/beta/index.d.mts +0 -1
  62. package/resources/beta/index.d.mts.map +1 -1
  63. package/resources/beta/index.d.ts +0 -1
  64. package/resources/beta/index.d.ts.map +1 -1
  65. package/resources/beta/index.js +1 -3
  66. package/resources/beta/index.js.map +1 -1
  67. package/resources/beta/index.mjs +0 -1
  68. package/resources/beta/index.mjs.map +1 -1
  69. package/resources/index.d.mts +1 -1
  70. package/resources/index.d.mts.map +1 -1
  71. package/resources/index.d.ts +1 -1
  72. package/resources/index.d.ts.map +1 -1
  73. package/resources/index.js.map +1 -1
  74. package/resources/index.mjs.map +1 -1
  75. package/resources/servers/deployments.d.mts +178 -1
  76. package/resources/servers/deployments.d.mts.map +1 -1
  77. package/resources/servers/deployments.d.ts +178 -1
  78. package/resources/servers/deployments.d.ts.map +1 -1
  79. package/resources/servers/deployments.js +100 -0
  80. package/resources/servers/deployments.js.map +1 -1
  81. package/resources/servers/deployments.mjs +100 -0
  82. package/resources/servers/deployments.mjs.map +1 -1
  83. package/resources/servers/index.d.mts +5 -5
  84. package/resources/servers/index.d.mts.map +1 -1
  85. package/resources/servers/index.d.ts +5 -5
  86. package/resources/servers/index.d.ts.map +1 -1
  87. package/resources/servers/index.js.map +1 -1
  88. package/resources/servers/index.mjs +1 -1
  89. package/resources/servers/index.mjs.map +1 -1
  90. package/resources/servers/logs.d.mts +70 -1
  91. package/resources/servers/logs.d.mts.map +1 -1
  92. package/resources/servers/logs.d.ts +70 -1
  93. package/resources/servers/logs.d.ts.map +1 -1
  94. package/resources/servers/logs.js +14 -0
  95. package/resources/servers/logs.js.map +1 -1
  96. package/resources/servers/logs.mjs +14 -0
  97. package/resources/servers/logs.mjs.map +1 -1
  98. package/resources/servers/repo.d.mts +63 -1
  99. package/resources/servers/repo.d.mts.map +1 -1
  100. package/resources/servers/repo.d.ts +63 -1
  101. package/resources/servers/repo.d.ts.map +1 -1
  102. package/resources/servers/repo.js +40 -0
  103. package/resources/servers/repo.js.map +1 -1
  104. package/resources/servers/repo.mjs +40 -0
  105. package/resources/servers/repo.mjs.map +1 -1
  106. package/resources/servers/secrets.d.mts +57 -1
  107. package/resources/servers/secrets.d.mts.map +1 -1
  108. package/resources/servers/secrets.d.ts +57 -1
  109. package/resources/servers/secrets.d.ts.map +1 -1
  110. package/resources/servers/secrets.js +43 -0
  111. package/resources/servers/secrets.js.map +1 -1
  112. package/resources/servers/secrets.mjs +43 -0
  113. package/resources/servers/secrets.mjs.map +1 -1
  114. package/resources/servers/servers.d.mts +67 -9
  115. package/resources/servers/servers.d.mts.map +1 -1
  116. package/resources/servers/servers.d.ts +67 -9
  117. package/resources/servers/servers.d.ts.map +1 -1
  118. package/resources/servers/servers.js +15 -0
  119. package/resources/servers/servers.js.map +1 -1
  120. package/resources/servers/servers.mjs +16 -1
  121. package/resources/servers/servers.mjs.map +1 -1
  122. package/src/client.ts +2 -13
  123. package/src/core/pagination.ts +0 -106
  124. package/src/core/streaming.ts +315 -0
  125. package/src/internal/decoders/line.ts +135 -0
  126. package/src/internal/parse.ts +14 -0
  127. package/src/internal/request-options.ts +2 -0
  128. package/src/resources/beta/beta.ts +0 -10
  129. package/src/resources/beta/connect/mcp.ts +3 -30
  130. package/src/resources/beta/index.ts +0 -1
  131. package/src/resources/index.ts +1 -0
  132. package/src/resources/servers/deployments.ts +301 -0
  133. package/src/resources/servers/index.ts +28 -1
  134. package/src/resources/servers/logs.ts +107 -1
  135. package/src/resources/servers/repo.ts +99 -0
  136. package/src/resources/servers/secrets.ts +88 -0
  137. package/src/resources/servers/servers.ts +135 -2
  138. package/src/streaming.ts +2 -0
  139. package/src/version.ts +1 -1
  140. package/streaming.d.mts +2 -0
  141. package/streaming.d.mts.map +1 -0
  142. package/streaming.d.ts +2 -0
  143. package/streaming.d.ts.map +1 -0
  144. package/streaming.js +6 -0
  145. package/streaming.js.map +1 -0
  146. package/streaming.mjs +2 -0
  147. package/streaming.mjs.map +1 -0
  148. package/version.d.mts +1 -1
  149. package/version.d.ts +1 -1
  150. package/version.js +1 -1
  151. package/version.mjs +1 -1
  152. package/resources/beta/tools.d.mts +0 -64
  153. package/resources/beta/tools.d.mts.map +0 -1
  154. package/resources/beta/tools.d.ts +0 -64
  155. package/resources/beta/tools.d.ts.map +0 -1
  156. package/resources/beta/tools.js +0 -25
  157. package/resources/beta/tools.js.map +0 -1
  158. package/resources/beta/tools.mjs +0 -21
  159. package/resources/beta/tools.mjs.map +0 -1
  160. package/src/resources/beta/tools.ts +0 -89
@@ -86,6 +86,21 @@ class Servers extends resource_1.APIResource {
86
86
  const { namespace } = params;
87
87
  return this._client.get((0, path_1.path) `/servers/${namespace}/${server}`, options);
88
88
  }
89
+ /**
90
+ * Get a server by namespace name. Used for namespace-only servers where the
91
+ * namespace name is also the server name. Also handles deprecated encoded
92
+ * patterns.
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * const response = await client.servers.getByNamespace(
97
+ * 'namespace',
98
+ * );
99
+ * ```
100
+ */
101
+ getByNamespace(namespace, options) {
102
+ return this._client.get((0, path_1.path) `/servers/${namespace}`, options);
103
+ }
89
104
  }
90
105
  exports.Servers = Servers;
91
106
  Servers.Deployments = deployments_1.Deployments;
@@ -1 +1 @@
1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EAAE,EAAE,OAAO,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,SAAiB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,YAAY,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;CACF;AA/FD,0BA+FC;AAiQD,OAAO,CAAC,WAAW,GAAG,yBAAW,CAAC;AAClC,OAAO,CAAC,IAAI,GAAG,WAAI,CAAC;AACpB,OAAO,CAAC,OAAO,GAAG,iBAAO,CAAC;AAC1B,OAAO,CAAC,IAAI,GAAG,WAAI,CAAC"}
@@ -3,7 +3,7 @@ import { APIResource } from "../../core/resource.mjs";
3
3
  import * as DeploymentsAPI from "./deployments.mjs";
4
4
  import { Deployments, } from "./deployments.mjs";
5
5
  import * as LogsAPI from "./logs.mjs";
6
- import { Logs } from "./logs.mjs";
6
+ import { Logs, } from "./logs.mjs";
7
7
  import * as RepoAPI from "./repo.mjs";
8
8
  import { Repo, } from "./repo.mjs";
9
9
  import * as SecretsAPI from "./secrets.mjs";
@@ -82,6 +82,21 @@ export class Servers extends APIResource {
82
82
  const { namespace } = params;
83
83
  return this._client.get(path `/servers/${namespace}/${server}`, options);
84
84
  }
85
+ /**
86
+ * Get a server by namespace name. Used for namespace-only servers where the
87
+ * namespace name is also the server name. Also handles deprecated encoded
88
+ * patterns.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * const response = await client.servers.getByNamespace(
93
+ * 'namespace',
94
+ * );
95
+ * ```
96
+ */
97
+ getByNamespace(namespace, options) {
98
+ return this._client.get(path `/servers/${namespace}`, options);
99
+ }
85
100
  }
86
101
  Servers.Deployments = Deployments;
87
102
  Servers.Logs = Logs;
@@ -1 +1 @@
1
- {"version":3,"file":"servers.mjs","sourceRoot":"","sources":["../../src/resources/servers/servers.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,K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,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,SAAiB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,YAAY,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;CACF;AAiQD,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC;AAClC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;AACpB,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;AAC1B,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC"}
package/src/client.ts CHANGED
@@ -17,14 +17,10 @@ import * as Errors from './core/error';
17
17
  import * as Pagination from './core/pagination';
18
18
  import {
19
19
  AbstractPage,
20
- type ConnectToolsCursorParams,
21
- ConnectToolsCursorResponse,
22
20
  type SkillsPageParams,
23
21
  SkillsPageResponse,
24
22
  type SmitheryPageParams,
25
23
  SmitheryPageResponse,
26
- type ToolsPageParams,
27
- ToolsPageResponse,
28
24
  } from './core/pagination';
29
25
  import * as Uploads from './core/uploads';
30
26
  import * as API from './resources/index';
@@ -57,6 +53,7 @@ import {
57
53
  ServerDeleteParams,
58
54
  ServerDeleteResponse,
59
55
  ServerDownloadParams,
56
+ ServerGetByNamespaceResponse,
60
57
  ServerGetParams,
61
58
  ServerGetResponse,
62
59
  ServerListParams,
@@ -790,15 +787,6 @@ export declare namespace Smithery {
790
787
  export import SkillsPage = Pagination.SkillsPage;
791
788
  export { type SkillsPageParams as SkillsPageParams, type SkillsPageResponse as SkillsPageResponse };
792
789
 
793
- export import ToolsPage = Pagination.ToolsPage;
794
- export { type ToolsPageParams as ToolsPageParams, type ToolsPageResponse as ToolsPageResponse };
795
-
796
- export import ConnectToolsCursor = Pagination.ConnectToolsCursor;
797
- export {
798
- type ConnectToolsCursorParams as ConnectToolsCursorParams,
799
- type ConnectToolsCursorResponse as ConnectToolsCursorResponse,
800
- };
801
-
802
790
  export { Health as Health, type HealthCheckResponse as HealthCheckResponse };
803
791
 
804
792
  export {
@@ -809,6 +797,7 @@ export declare namespace Smithery {
809
797
  type ServerListResponse as ServerListResponse,
810
798
  type ServerDeleteResponse as ServerDeleteResponse,
811
799
  type ServerGetResponse as ServerGetResponse,
800
+ type ServerGetByNamespaceResponse as ServerGetByNamespaceResponse,
812
801
  type ServerListResponsesSmitheryPage as ServerListResponsesSmitheryPage,
813
802
  type ServerListParams as ServerListParams,
814
803
  type ServerDeleteParams as ServerDeleteParams,
@@ -224,109 +224,3 @@ export class SkillsPage<Item> extends AbstractPage<Item> implements SkillsPageRe
224
224
  };
225
225
  }
226
226
  }
227
-
228
- export interface ToolsPageResponse<Item> {
229
- tools: Array<Item>;
230
-
231
- pagination: ToolsPageResponse.Pagination;
232
- }
233
-
234
- export namespace ToolsPageResponse {
235
- export interface Pagination {
236
- currentPage?: number;
237
-
238
- pageSize?: number;
239
-
240
- totalCount?: number;
241
-
242
- totalPages?: number;
243
- }
244
- }
245
-
246
- export interface ToolsPageParams {
247
- page?: number;
248
-
249
- pageSize?: number;
250
- }
251
-
252
- export class ToolsPage<Item> extends AbstractPage<Item> implements ToolsPageResponse<Item> {
253
- tools: Array<Item>;
254
-
255
- pagination: ToolsPageResponse.Pagination;
256
-
257
- constructor(
258
- client: Smithery,
259
- response: Response,
260
- body: ToolsPageResponse<Item>,
261
- options: FinalRequestOptions,
262
- ) {
263
- super(client, response, body, options);
264
-
265
- this.tools = body.tools || [];
266
- this.pagination = body.pagination || {};
267
- }
268
-
269
- getPaginatedItems(): Item[] {
270
- return this.tools ?? [];
271
- }
272
-
273
- nextPageRequestOptions(): PageRequestOptions | null {
274
- const query = this.options.query as ToolsPageParams;
275
- const currentPage = query?.page ?? 1;
276
-
277
- return {
278
- ...this.options,
279
- query: {
280
- ...maybeObj(this.options.query),
281
- page: currentPage + 1,
282
- },
283
- };
284
- }
285
- }
286
-
287
- export interface ConnectToolsCursorResponse<Item> {
288
- tools: Array<Item>;
289
-
290
- next_cursor: string | null;
291
- }
292
-
293
- export interface ConnectToolsCursorParams {
294
- cursor?: string;
295
- }
296
-
297
- export class ConnectToolsCursor<Item> extends AbstractPage<Item> implements ConnectToolsCursorResponse<Item> {
298
- tools: Array<Item>;
299
-
300
- next_cursor: string | null;
301
-
302
- constructor(
303
- client: Smithery,
304
- response: Response,
305
- body: ConnectToolsCursorResponse<Item>,
306
- options: FinalRequestOptions,
307
- ) {
308
- super(client, response, body, options);
309
-
310
- this.tools = body.tools || [];
311
- this.next_cursor = body.next_cursor || null;
312
- }
313
-
314
- getPaginatedItems(): Item[] {
315
- return this.tools ?? [];
316
- }
317
-
318
- nextPageRequestOptions(): PageRequestOptions | null {
319
- const cursor = this.next_cursor;
320
- if (!cursor) {
321
- return null;
322
- }
323
-
324
- return {
325
- ...this.options,
326
- query: {
327
- ...maybeObj(this.options.query),
328
- cursor,
329
- },
330
- };
331
- }
332
- }
@@ -0,0 +1,315 @@
1
+ import { SmitheryError } from './error';
2
+ import { type ReadableStream } from '../internal/shim-types';
3
+ import { makeReadableStream } from '../internal/shims';
4
+ import { findDoubleNewlineIndex, LineDecoder } from '../internal/decoders/line';
5
+ import { ReadableStreamToAsyncIterable } from '../internal/shims';
6
+ import { isAbortError } from '../internal/errors';
7
+ import { encodeUTF8 } from '../internal/utils/bytes';
8
+ import { loggerFor } from '../internal/utils/log';
9
+ import type { Smithery } from '../client';
10
+
11
+ type Bytes = string | ArrayBuffer | Uint8Array | null | undefined;
12
+
13
+ export type ServerSentEvent = {
14
+ event: string | null;
15
+ data: string;
16
+ raw: string[];
17
+ };
18
+
19
+ export class Stream<Item> implements AsyncIterable<Item> {
20
+ controller: AbortController;
21
+ #client: Smithery | undefined;
22
+
23
+ constructor(
24
+ private iterator: () => AsyncIterator<Item>,
25
+ controller: AbortController,
26
+ client?: Smithery,
27
+ ) {
28
+ this.controller = controller;
29
+ this.#client = client;
30
+ }
31
+
32
+ static fromSSEResponse<Item>(
33
+ response: Response,
34
+ controller: AbortController,
35
+ client?: Smithery,
36
+ ): Stream<Item> {
37
+ let consumed = false;
38
+ const logger = client ? loggerFor(client) : console;
39
+
40
+ async function* iterator(): AsyncIterator<Item, any, undefined> {
41
+ if (consumed) {
42
+ throw new SmitheryError('Cannot iterate over a consumed stream, use `.tee()` to split the stream.');
43
+ }
44
+ consumed = true;
45
+ let done = false;
46
+ try {
47
+ for await (const sse of _iterSSEMessages(response, controller)) {
48
+ try {
49
+ yield JSON.parse(sse.data);
50
+ } catch (e) {
51
+ logger.error(`Could not parse message into JSON:`, sse.data);
52
+ logger.error(`From chunk:`, sse.raw);
53
+ throw e;
54
+ }
55
+ }
56
+ done = true;
57
+ } catch (e) {
58
+ // If the user calls `stream.controller.abort()`, we should exit without throwing.
59
+ if (isAbortError(e)) return;
60
+ throw e;
61
+ } finally {
62
+ // If the user `break`s, abort the ongoing request.
63
+ if (!done) controller.abort();
64
+ }
65
+ }
66
+
67
+ return new Stream(iterator, controller, client);
68
+ }
69
+
70
+ /**
71
+ * Generates a Stream from a newline-separated ReadableStream
72
+ * where each item is a JSON value.
73
+ */
74
+ static fromReadableStream<Item>(
75
+ readableStream: ReadableStream,
76
+ controller: AbortController,
77
+ client?: Smithery,
78
+ ): Stream<Item> {
79
+ let consumed = false;
80
+
81
+ async function* iterLines(): AsyncGenerator<string, void, unknown> {
82
+ const lineDecoder = new LineDecoder();
83
+
84
+ const iter = ReadableStreamToAsyncIterable<Bytes>(readableStream);
85
+ for await (const chunk of iter) {
86
+ for (const line of lineDecoder.decode(chunk)) {
87
+ yield line;
88
+ }
89
+ }
90
+
91
+ for (const line of lineDecoder.flush()) {
92
+ yield line;
93
+ }
94
+ }
95
+
96
+ async function* iterator(): AsyncIterator<Item, any, undefined> {
97
+ if (consumed) {
98
+ throw new SmitheryError('Cannot iterate over a consumed stream, use `.tee()` to split the stream.');
99
+ }
100
+ consumed = true;
101
+ let done = false;
102
+ try {
103
+ for await (const line of iterLines()) {
104
+ if (done) continue;
105
+ if (line) yield JSON.parse(line);
106
+ }
107
+ done = true;
108
+ } catch (e) {
109
+ // If the user calls `stream.controller.abort()`, we should exit without throwing.
110
+ if (isAbortError(e)) return;
111
+ throw e;
112
+ } finally {
113
+ // If the user `break`s, abort the ongoing request.
114
+ if (!done) controller.abort();
115
+ }
116
+ }
117
+
118
+ return new Stream(iterator, controller, client);
119
+ }
120
+
121
+ [Symbol.asyncIterator](): AsyncIterator<Item> {
122
+ return this.iterator();
123
+ }
124
+
125
+ /**
126
+ * Splits the stream into two streams which can be
127
+ * independently read from at different speeds.
128
+ */
129
+ tee(): [Stream<Item>, Stream<Item>] {
130
+ const left: Array<Promise<IteratorResult<Item>>> = [];
131
+ const right: Array<Promise<IteratorResult<Item>>> = [];
132
+ const iterator = this.iterator();
133
+
134
+ const teeIterator = (queue: Array<Promise<IteratorResult<Item>>>): AsyncIterator<Item> => {
135
+ return {
136
+ next: () => {
137
+ if (queue.length === 0) {
138
+ const result = iterator.next();
139
+ left.push(result);
140
+ right.push(result);
141
+ }
142
+ return queue.shift()!;
143
+ },
144
+ };
145
+ };
146
+
147
+ return [
148
+ new Stream(() => teeIterator(left), this.controller, this.#client),
149
+ new Stream(() => teeIterator(right), this.controller, this.#client),
150
+ ];
151
+ }
152
+
153
+ /**
154
+ * Converts this stream to a newline-separated ReadableStream of
155
+ * JSON stringified values in the stream
156
+ * which can be turned back into a Stream with `Stream.fromReadableStream()`.
157
+ */
158
+ toReadableStream(): ReadableStream {
159
+ const self = this;
160
+ let iter: AsyncIterator<Item>;
161
+
162
+ return makeReadableStream({
163
+ async start() {
164
+ iter = self[Symbol.asyncIterator]();
165
+ },
166
+ async pull(ctrl: any) {
167
+ try {
168
+ const { value, done } = await iter.next();
169
+ if (done) return ctrl.close();
170
+
171
+ const bytes = encodeUTF8(JSON.stringify(value) + '\n');
172
+
173
+ ctrl.enqueue(bytes);
174
+ } catch (err) {
175
+ ctrl.error(err);
176
+ }
177
+ },
178
+ async cancel() {
179
+ await iter.return?.();
180
+ },
181
+ });
182
+ }
183
+ }
184
+
185
+ export async function* _iterSSEMessages(
186
+ response: Response,
187
+ controller: AbortController,
188
+ ): AsyncGenerator<ServerSentEvent, void, unknown> {
189
+ if (!response.body) {
190
+ controller.abort();
191
+ if (
192
+ typeof (globalThis as any).navigator !== 'undefined' &&
193
+ (globalThis as any).navigator.product === 'ReactNative'
194
+ ) {
195
+ throw new SmitheryError(
196
+ `The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`,
197
+ );
198
+ }
199
+ throw new SmitheryError(`Attempted to iterate over a response with no body`);
200
+ }
201
+
202
+ const sseDecoder = new SSEDecoder();
203
+ const lineDecoder = new LineDecoder();
204
+
205
+ const iter = ReadableStreamToAsyncIterable<Bytes>(response.body);
206
+ for await (const sseChunk of iterSSEChunks(iter)) {
207
+ for (const line of lineDecoder.decode(sseChunk)) {
208
+ const sse = sseDecoder.decode(line);
209
+ if (sse) yield sse;
210
+ }
211
+ }
212
+
213
+ for (const line of lineDecoder.flush()) {
214
+ const sse = sseDecoder.decode(line);
215
+ if (sse) yield sse;
216
+ }
217
+ }
218
+
219
+ /**
220
+ * Given an async iterable iterator, iterates over it and yields full
221
+ * SSE chunks, i.e. yields when a double new-line is encountered.
222
+ */
223
+ async function* iterSSEChunks(iterator: AsyncIterableIterator<Bytes>): AsyncGenerator<Uint8Array> {
224
+ let data = new Uint8Array();
225
+
226
+ for await (const chunk of iterator) {
227
+ if (chunk == null) {
228
+ continue;
229
+ }
230
+
231
+ const binaryChunk =
232
+ chunk instanceof ArrayBuffer ? new Uint8Array(chunk)
233
+ : typeof chunk === 'string' ? encodeUTF8(chunk)
234
+ : chunk;
235
+
236
+ let newData = new Uint8Array(data.length + binaryChunk.length);
237
+ newData.set(data);
238
+ newData.set(binaryChunk, data.length);
239
+ data = newData;
240
+
241
+ let patternIndex;
242
+ while ((patternIndex = findDoubleNewlineIndex(data)) !== -1) {
243
+ yield data.slice(0, patternIndex);
244
+ data = data.slice(patternIndex);
245
+ }
246
+ }
247
+
248
+ if (data.length > 0) {
249
+ yield data;
250
+ }
251
+ }
252
+
253
+ class SSEDecoder {
254
+ private data: string[];
255
+ private event: string | null;
256
+ private chunks: string[];
257
+
258
+ constructor() {
259
+ this.event = null;
260
+ this.data = [];
261
+ this.chunks = [];
262
+ }
263
+
264
+ decode(line: string) {
265
+ if (line.endsWith('\r')) {
266
+ line = line.substring(0, line.length - 1);
267
+ }
268
+
269
+ if (!line) {
270
+ // empty line and we didn't previously encounter any messages
271
+ if (!this.event && !this.data.length) return null;
272
+
273
+ const sse: ServerSentEvent = {
274
+ event: this.event,
275
+ data: this.data.join('\n'),
276
+ raw: this.chunks,
277
+ };
278
+
279
+ this.event = null;
280
+ this.data = [];
281
+ this.chunks = [];
282
+
283
+ return sse;
284
+ }
285
+
286
+ this.chunks.push(line);
287
+
288
+ if (line.startsWith(':')) {
289
+ return null;
290
+ }
291
+
292
+ let [fieldname, _, value] = partition(line, ':');
293
+
294
+ if (value.startsWith(' ')) {
295
+ value = value.substring(1);
296
+ }
297
+
298
+ if (fieldname === 'event') {
299
+ this.event = value;
300
+ } else if (fieldname === 'data') {
301
+ this.data.push(value);
302
+ }
303
+
304
+ return null;
305
+ }
306
+ }
307
+
308
+ function partition(str: string, delimiter: string): [string, string, string] {
309
+ const index = str.indexOf(delimiter);
310
+ if (index !== -1) {
311
+ return [str.substring(0, index), delimiter, str.substring(index + delimiter.length)];
312
+ }
313
+
314
+ return [str, '', ''];
315
+ }
@@ -0,0 +1,135 @@
1
+ import { concatBytes, decodeUTF8, encodeUTF8 } from '../utils/bytes';
2
+
3
+ export type Bytes = string | ArrayBuffer | Uint8Array | null | undefined;
4
+
5
+ /**
6
+ * A re-implementation of httpx's `LineDecoder` in Python that handles incrementally
7
+ * reading lines from text.
8
+ *
9
+ * https://github.com/encode/httpx/blob/920333ea98118e9cf617f246905d7b202510941c/httpx/_decoders.py#L258
10
+ */
11
+ export class LineDecoder {
12
+ // prettier-ignore
13
+ static NEWLINE_CHARS = new Set(['\n', '\r']);
14
+ static NEWLINE_REGEXP = /\r\n|[\n\r]/g;
15
+
16
+ #buffer: Uint8Array;
17
+ #carriageReturnIndex: number | null;
18
+
19
+ constructor() {
20
+ this.#buffer = new Uint8Array();
21
+ this.#carriageReturnIndex = null;
22
+ }
23
+
24
+ decode(chunk: Bytes): string[] {
25
+ if (chunk == null) {
26
+ return [];
27
+ }
28
+
29
+ const binaryChunk =
30
+ chunk instanceof ArrayBuffer ? new Uint8Array(chunk)
31
+ : typeof chunk === 'string' ? encodeUTF8(chunk)
32
+ : chunk;
33
+
34
+ this.#buffer = concatBytes([this.#buffer, binaryChunk]);
35
+
36
+ const lines: string[] = [];
37
+ let patternIndex;
38
+ while ((patternIndex = findNewlineIndex(this.#buffer, this.#carriageReturnIndex)) != null) {
39
+ if (patternIndex.carriage && this.#carriageReturnIndex == null) {
40
+ // skip until we either get a corresponding `\n`, a new `\r` or nothing
41
+ this.#carriageReturnIndex = patternIndex.index;
42
+ continue;
43
+ }
44
+
45
+ // we got double \r or \rtext\n
46
+ if (
47
+ this.#carriageReturnIndex != null &&
48
+ (patternIndex.index !== this.#carriageReturnIndex + 1 || patternIndex.carriage)
49
+ ) {
50
+ lines.push(decodeUTF8(this.#buffer.subarray(0, this.#carriageReturnIndex - 1)));
51
+ this.#buffer = this.#buffer.subarray(this.#carriageReturnIndex);
52
+ this.#carriageReturnIndex = null;
53
+ continue;
54
+ }
55
+
56
+ const endIndex =
57
+ this.#carriageReturnIndex !== null ? patternIndex.preceding - 1 : patternIndex.preceding;
58
+
59
+ const line = decodeUTF8(this.#buffer.subarray(0, endIndex));
60
+ lines.push(line);
61
+
62
+ this.#buffer = this.#buffer.subarray(patternIndex.index);
63
+ this.#carriageReturnIndex = null;
64
+ }
65
+
66
+ return lines;
67
+ }
68
+
69
+ flush(): string[] {
70
+ if (!this.#buffer.length) {
71
+ return [];
72
+ }
73
+ return this.decode('\n');
74
+ }
75
+ }
76
+
77
+ /**
78
+ * This function searches the buffer for the end patterns, (\r or \n)
79
+ * and returns an object with the index preceding the matched newline and the
80
+ * index after the newline char. `null` is returned if no new line is found.
81
+ *
82
+ * ```ts
83
+ * findNewLineIndex('abc\ndef') -> { preceding: 2, index: 3 }
84
+ * ```
85
+ */
86
+ function findNewlineIndex(
87
+ buffer: Uint8Array,
88
+ startIndex: number | null,
89
+ ): { preceding: number; index: number; carriage: boolean } | null {
90
+ const newline = 0x0a; // \n
91
+ const carriage = 0x0d; // \r
92
+
93
+ for (let i = startIndex ?? 0; i < buffer.length; i++) {
94
+ if (buffer[i] === newline) {
95
+ return { preceding: i, index: i + 1, carriage: false };
96
+ }
97
+
98
+ if (buffer[i] === carriage) {
99
+ return { preceding: i, index: i + 1, carriage: true };
100
+ }
101
+ }
102
+
103
+ return null;
104
+ }
105
+
106
+ export function findDoubleNewlineIndex(buffer: Uint8Array): number {
107
+ // This function searches the buffer for the end patterns (\r\r, \n\n, \r\n\r\n)
108
+ // and returns the index right after the first occurrence of any pattern,
109
+ // or -1 if none of the patterns are found.
110
+ const newline = 0x0a; // \n
111
+ const carriage = 0x0d; // \r
112
+
113
+ for (let i = 0; i < buffer.length - 1; i++) {
114
+ if (buffer[i] === newline && buffer[i + 1] === newline) {
115
+ // \n\n
116
+ return i + 2;
117
+ }
118
+ if (buffer[i] === carriage && buffer[i + 1] === carriage) {
119
+ // \r\r
120
+ return i + 2;
121
+ }
122
+ if (
123
+ buffer[i] === carriage &&
124
+ buffer[i + 1] === newline &&
125
+ i + 3 < buffer.length &&
126
+ buffer[i + 2] === carriage &&
127
+ buffer[i + 3] === newline
128
+ ) {
129
+ // \r\n\r\n
130
+ return i + 4;
131
+ }
132
+ }
133
+
134
+ return -1;
135
+ }