@reminix/sdk 0.8.2 → 0.8.4

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 (116) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +10 -43
  3. package/client.d.mts +12 -6
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +12 -6
  6. package/client.d.ts.map +1 -1
  7. package/client.js +9 -3
  8. package/client.js.map +1 -1
  9. package/client.mjs +9 -3
  10. package/client.mjs.map +1 -1
  11. package/core/streaming.d.mts +33 -0
  12. package/core/streaming.d.mts.map +1 -0
  13. package/core/streaming.d.ts +33 -0
  14. package/core/streaming.d.ts.map +1 -0
  15. package/core/streaming.js +263 -0
  16. package/core/streaming.js.map +1 -0
  17. package/core/streaming.mjs +258 -0
  18. package/core/streaming.mjs.map +1 -0
  19. package/index.d.mts +0 -1
  20. package/index.d.mts.map +1 -1
  21. package/index.d.ts +0 -1
  22. package/index.d.ts.map +1 -1
  23. package/index.js +1 -5
  24. package/index.js.map +1 -1
  25. package/index.mjs +0 -2
  26. package/index.mjs.map +1 -1
  27. package/internal/decoders/line.d.mts +17 -0
  28. package/internal/decoders/line.d.mts.map +1 -0
  29. package/internal/decoders/line.d.ts +17 -0
  30. package/internal/decoders/line.d.ts.map +1 -0
  31. package/internal/decoders/line.js +113 -0
  32. package/internal/decoders/line.js.map +1 -0
  33. package/internal/decoders/line.mjs +108 -0
  34. package/internal/decoders/line.mjs.map +1 -0
  35. package/internal/parse.d.mts.map +1 -1
  36. package/internal/parse.d.ts.map +1 -1
  37. package/internal/parse.js +10 -0
  38. package/internal/parse.js.map +1 -1
  39. package/internal/parse.mjs +10 -0
  40. package/internal/parse.mjs.map +1 -1
  41. package/internal/request-options.d.mts +2 -0
  42. package/internal/request-options.d.mts.map +1 -1
  43. package/internal/request-options.d.ts +2 -0
  44. package/internal/request-options.d.ts.map +1 -1
  45. package/internal/request-options.js.map +1 -1
  46. package/internal/request-options.mjs.map +1 -1
  47. package/package.json +1 -1
  48. package/resources/agents.d.mts +49 -40
  49. package/resources/agents.d.mts.map +1 -1
  50. package/resources/agents.d.ts +49 -40
  51. package/resources/agents.d.ts.map +1 -1
  52. package/resources/agents.js +7 -127
  53. package/resources/agents.js.map +1 -1
  54. package/resources/agents.mjs +7 -126
  55. package/resources/agents.mjs.map +1 -1
  56. package/resources/deployments.d.mts +4 -0
  57. package/resources/deployments.d.mts.map +1 -0
  58. package/resources/deployments.d.ts +4 -0
  59. package/resources/deployments.d.ts.map +1 -0
  60. package/resources/deployments.js +9 -0
  61. package/resources/deployments.js.map +1 -0
  62. package/resources/deployments.mjs +5 -0
  63. package/resources/deployments.mjs.map +1 -0
  64. package/resources/index.d.mts +4 -2
  65. package/resources/index.d.mts.map +1 -1
  66. package/resources/index.d.ts +4 -2
  67. package/resources/index.d.ts.map +1 -1
  68. package/resources/index.js +7 -3
  69. package/resources/index.js.map +1 -1
  70. package/resources/index.mjs +3 -1
  71. package/resources/index.mjs.map +1 -1
  72. package/resources/{project.d.mts → projects.d.mts} +31 -7
  73. package/resources/projects.d.mts.map +1 -0
  74. package/resources/{project.d.ts → projects.d.ts} +31 -7
  75. package/resources/projects.d.ts.map +1 -0
  76. package/resources/{project.js → projects.js} +8 -7
  77. package/resources/projects.js.map +1 -0
  78. package/resources/{project.mjs → projects.mjs} +6 -5
  79. package/resources/projects.mjs.map +1 -0
  80. package/resources/secrets.d.mts +4 -0
  81. package/resources/secrets.d.mts.map +1 -0
  82. package/resources/secrets.d.ts +4 -0
  83. package/resources/secrets.d.ts.map +1 -0
  84. package/resources/secrets.js +9 -0
  85. package/resources/secrets.js.map +1 -0
  86. package/resources/secrets.mjs +5 -0
  87. package/resources/secrets.mjs.map +1 -0
  88. package/src/client.ts +25 -5
  89. package/src/core/streaming.ts +315 -0
  90. package/src/index.ts +0 -4
  91. package/src/internal/decoders/line.ts +135 -0
  92. package/src/internal/parse.ts +14 -0
  93. package/src/internal/request-options.ts +2 -0
  94. package/src/resources/agents.ts +101 -67
  95. package/src/resources/deployments.ts +5 -0
  96. package/src/resources/index.ts +8 -1
  97. package/src/resources/{project.ts → projects.ts} +35 -7
  98. package/src/resources/secrets.ts +5 -0
  99. package/src/streaming.ts +2 -87
  100. package/src/version.ts +1 -1
  101. package/streaming.d.mts +1 -30
  102. package/streaming.d.mts.map +1 -1
  103. package/streaming.d.ts +1 -30
  104. package/streaming.d.ts.map +1 -1
  105. package/streaming.js +3 -80
  106. package/streaming.js.map +1 -1
  107. package/streaming.mjs +1 -78
  108. package/streaming.mjs.map +1 -1
  109. package/version.d.mts +1 -1
  110. package/version.d.ts +1 -1
  111. package/version.js +1 -1
  112. package/version.mjs +1 -1
  113. package/resources/project.d.mts.map +0 -1
  114. package/resources/project.d.ts.map +0 -1
  115. package/resources/project.js.map +0 -1
  116. package/resources/project.mjs.map +0 -1
@@ -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
+ }
@@ -1,6 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import type { FinalRequestOptions } from './request-options';
4
+ import { Stream } from '../core/streaming';
4
5
  import { type Reminix } from '../client';
5
6
  import { formatRequestDetails, loggerFor } from './utils/log';
6
7
 
@@ -16,6 +17,19 @@ export type APIResponseProps = {
16
17
  export async function defaultParseResponse<T>(client: Reminix, props: APIResponseProps): Promise<T> {
17
18
  const { response, requestLogID, retryOfRequestLogID, startTime } = props;
18
19
  const body = await (async () => {
20
+ if (props.options.stream) {
21
+ loggerFor(client).debug('response', response.status, response.url, response.headers, response.body);
22
+
23
+ // Note: there is an invariant here that isn't represented in the type system
24
+ // that if you set `stream: true` the response type must also be `Stream<T>`
25
+
26
+ if (props.options.__streamClass) {
27
+ return props.options.__streamClass.fromSSEResponse(response, props.controller, client) as any;
28
+ }
29
+
30
+ return Stream.fromSSEResponse(response, props.controller, client) as any;
31
+ }
32
+
19
33
  // fetch refuses to read the body when the status code is 204.
20
34
  if (response.status === 204) {
21
35
  return null as T;
@@ -3,6 +3,7 @@
3
3
  import { NullableHeaders } from './headers';
4
4
 
5
5
  import type { BodyInit } from './builtin-types';
6
+ import { Stream } from '../core/streaming';
6
7
  import type { HTTPMethod, MergedRequestInit } from './types';
7
8
  import { type HeadersLike } from './headers';
8
9
 
@@ -76,6 +77,7 @@ export type RequestOptions = {
76
77
  defaultBaseURL?: string | undefined;
77
78
 
78
79
  __binaryResponse?: boolean | undefined;
80
+ __streamClass?: typeof Stream;
79
81
  };
80
82
 
81
83
  export type EncodedContent = { bodyHeaders: HeadersLike; body: BodyInit };
@@ -1,14 +1,12 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
+ import * as AgentsAPI from './agents';
4
5
  import { APIPromise } from '../core/api-promise';
6
+ import { Stream } from '../core/streaming';
5
7
  import { RequestOptions } from '../internal/request-options';
6
8
  import { path } from '../internal/utils/path';
7
9
 
8
- // stainless-custom-start
9
- import { Stream, StreamChunk } from '../streaming';
10
- // stainless-custom-end
11
-
12
10
  export class Agents extends APIResource {
13
11
  /**
14
12
  * Have a conversational interaction with an agent. This endpoint maintains
@@ -50,8 +48,31 @@ export class Agents extends APIResource {
50
48
  * });
51
49
  * ```
52
50
  */
53
- chat(name: string, body: AgentChatParams, options?: RequestOptions): APIPromise<AgentChatResponse> {
54
- return this._client.post(path`/agents/${name}/chat`, { body, ...options });
51
+ chat(
52
+ name: string,
53
+ body: AgentChatParamsNonStreaming,
54
+ options?: RequestOptions,
55
+ ): APIPromise<AgentChatResponse>;
56
+ chat(
57
+ name: string,
58
+ body: AgentChatParamsStreaming,
59
+ options?: RequestOptions,
60
+ ): APIPromise<Stream<StreamChunk>>;
61
+ chat(
62
+ name: string,
63
+ body: AgentChatParamsBase,
64
+ options?: RequestOptions,
65
+ ): APIPromise<Stream<StreamChunk> | AgentChatResponse>;
66
+ chat(
67
+ name: string,
68
+ body: AgentChatParams,
69
+ options?: RequestOptions,
70
+ ): APIPromise<AgentChatResponse> | APIPromise<Stream<StreamChunk>> {
71
+ return this._client.post(path`/agents/${name}/chat`, {
72
+ body,
73
+ ...options,
74
+ stream: body.stream ?? false,
75
+ }) as APIPromise<AgentChatResponse> | APIPromise<Stream<StreamChunk>>;
55
76
  }
56
77
 
57
78
  /**
@@ -88,71 +109,32 @@ export class Agents extends APIResource {
88
109
  * });
89
110
  * ```
90
111
  */
91
- invoke(name: string, body: AgentInvokeParams, options?: RequestOptions): APIPromise<AgentInvokeResponse> {
92
- return this._client.post(path`/agents/${name}/invoke`, { body, ...options });
93
- }
94
-
95
- // stainless-custom-start
96
- /**
97
- * Streaming variant of chat(). Returns an async iterable of chunks.
98
- *
99
- * Have a conversational interaction with an agent with real-time streaming.
100
- * Each chunk contains a portion of the response as it's generated.
101
- *
102
- * @example
103
- * ```ts
104
- * const stream = await client.agents.chatStream('my-agent', {
105
- * messages: [{ role: 'user', content: 'Tell me a story' }],
106
- * });
107
- * for await (const chunk of stream) {
108
- * process.stdout.write(chunk.chunk);
109
- * }
110
- * ```
111
- */
112
- async chatStream(
112
+ invoke(
113
113
  name: string,
114
- body: Omit<AgentChatParams, 'stream'>,
114
+ body: AgentInvokeParamsNonStreaming,
115
115
  options?: RequestOptions,
116
- ): Promise<Stream<StreamChunk>> {
117
- const response = await this._client.post(path`/agents/${name}/chat`, {
118
- body: { ...body, stream: true },
119
- ...options,
120
- headers: { Accept: 'text/event-stream', ...options?.headers },
121
- __binaryResponse: true,
122
- });
123
- return new Stream<StreamChunk>(response as unknown as Response);
124
- }
125
-
126
- /**
127
- * Streaming variant of invoke(). Returns an async iterable of chunks.
128
- *
129
- * Execute a one-shot task with an agent with real-time streaming.
130
- * Each chunk contains a portion of the response as it's generated.
131
- *
132
- * @example
133
- * ```ts
134
- * const stream = await client.agents.invokeStream('my-agent', {
135
- * input: { task: 'generate', prompt: 'Write a poem' },
136
- * });
137
- * for await (const chunk of stream) {
138
- * process.stdout.write(chunk.chunk);
139
- * }
140
- * ```
141
- */
142
- async invokeStream(
116
+ ): APIPromise<AgentInvokeResponse>;
117
+ invoke(
118
+ name: string,
119
+ body: AgentInvokeParamsStreaming,
120
+ options?: RequestOptions,
121
+ ): APIPromise<Stream<StreamChunk>>;
122
+ invoke(
123
+ name: string,
124
+ body: AgentInvokeParamsBase,
125
+ options?: RequestOptions,
126
+ ): APIPromise<Stream<StreamChunk> | AgentInvokeResponse>;
127
+ invoke(
143
128
  name: string,
144
- body: Omit<AgentInvokeParams, 'stream'>,
129
+ body: AgentInvokeParams,
145
130
  options?: RequestOptions,
146
- ): Promise<Stream<StreamChunk>> {
147
- const response = await this._client.post(path`/agents/${name}/invoke`, {
148
- body: { ...body, stream: true },
131
+ ): APIPromise<AgentInvokeResponse> | APIPromise<Stream<StreamChunk>> {
132
+ return this._client.post(path`/agents/${name}/invoke`, {
133
+ body,
149
134
  ...options,
150
- headers: { Accept: 'text/event-stream', ...options?.headers },
151
- __binaryResponse: true,
152
- });
153
- return new Stream<StreamChunk>(response as unknown as Response);
135
+ stream: body.stream ?? false,
136
+ }) as APIPromise<AgentInvokeResponse> | APIPromise<Stream<StreamChunk>>;
154
137
  }
155
- // stainless-custom-end
156
138
  }
157
139
 
158
140
  /**
@@ -175,6 +157,13 @@ export interface Context {
175
157
  user_id?: string;
176
158
  }
177
159
 
160
+ export interface StreamChunk {
161
+ /**
162
+ * Text chunk from the stream
163
+ */
164
+ chunk: string;
165
+ }
166
+
178
167
  export interface AgentChatResponse {
179
168
  /**
180
169
  * Full conversation history including the assistant response
@@ -234,7 +223,9 @@ export interface AgentInvokeResponse {
234
223
  output?: unknown;
235
224
  }
236
225
 
237
- export interface AgentChatParams {
226
+ export type AgentChatParams = AgentChatParamsNonStreaming | AgentChatParamsStreaming;
227
+
228
+ export interface AgentChatParamsBase {
238
229
  /**
239
230
  * Conversation history. Must include at least one message.
240
231
  */
@@ -289,9 +280,28 @@ export namespace AgentChatParams {
289
280
  }
290
281
  }
291
282
  }
283
+
284
+ export type AgentChatParamsNonStreaming = AgentsAPI.AgentChatParamsNonStreaming;
285
+ export type AgentChatParamsStreaming = AgentsAPI.AgentChatParamsStreaming;
286
+ }
287
+
288
+ export interface AgentChatParamsNonStreaming extends AgentChatParamsBase {
289
+ /**
290
+ * Whether to stream the response as SSE.
291
+ */
292
+ stream?: false;
293
+ }
294
+
295
+ export interface AgentChatParamsStreaming extends AgentChatParamsBase {
296
+ /**
297
+ * Whether to stream the response as SSE.
298
+ */
299
+ stream: true;
292
300
  }
293
301
 
294
- export interface AgentInvokeParams {
302
+ export type AgentInvokeParams = AgentInvokeParamsNonStreaming | AgentInvokeParamsStreaming;
303
+
304
+ export interface AgentInvokeParamsBase {
295
305
  /**
296
306
  * Input data for the agent. Structure depends on agent implementation.
297
307
  */
@@ -308,12 +318,36 @@ export interface AgentInvokeParams {
308
318
  stream?: boolean;
309
319
  }
310
320
 
321
+ export namespace AgentInvokeParams {
322
+ export type AgentInvokeParamsNonStreaming = AgentsAPI.AgentInvokeParamsNonStreaming;
323
+ export type AgentInvokeParamsStreaming = AgentsAPI.AgentInvokeParamsStreaming;
324
+ }
325
+
326
+ export interface AgentInvokeParamsNonStreaming extends AgentInvokeParamsBase {
327
+ /**
328
+ * Whether to stream the response as SSE.
329
+ */
330
+ stream?: false;
331
+ }
332
+
333
+ export interface AgentInvokeParamsStreaming extends AgentInvokeParamsBase {
334
+ /**
335
+ * Whether to stream the response as SSE.
336
+ */
337
+ stream: true;
338
+ }
339
+
311
340
  export declare namespace Agents {
312
341
  export {
313
342
  type Context as Context,
343
+ type StreamChunk as StreamChunk,
314
344
  type AgentChatResponse as AgentChatResponse,
315
345
  type AgentInvokeResponse as AgentInvokeResponse,
316
346
  type AgentChatParams as AgentChatParams,
347
+ type AgentChatParamsNonStreaming as AgentChatParamsNonStreaming,
348
+ type AgentChatParamsStreaming as AgentChatParamsStreaming,
317
349
  type AgentInvokeParams as AgentInvokeParams,
350
+ type AgentInvokeParamsNonStreaming as AgentInvokeParamsNonStreaming,
351
+ type AgentInvokeParamsStreaming as AgentInvokeParamsStreaming,
318
352
  };
319
353
  }
@@ -0,0 +1,5 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+
5
+ export class Deployments extends APIResource {}
@@ -3,9 +3,16 @@
3
3
  export {
4
4
  Agents,
5
5
  type Context,
6
+ type StreamChunk,
6
7
  type AgentChatResponse,
7
8
  type AgentInvokeResponse,
8
9
  type AgentChatParams,
10
+ type AgentChatParamsNonStreaming,
11
+ type AgentChatParamsStreaming,
9
12
  type AgentInvokeParams,
13
+ type AgentInvokeParamsNonStreaming,
14
+ type AgentInvokeParamsStreaming,
10
15
  } from './agents';
11
- export { Project, type ProjectRetrieveResponse } from './project';
16
+ export { Deployments } from './deployments';
17
+ export { Projects, type ProjectRetrieveCurrentResponse } from './projects';
18
+ export { Secrets } from './secrets';
@@ -4,26 +4,27 @@ import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
5
  import { RequestOptions } from '../internal/request-options';
6
6
 
7
- export class Project extends APIResource {
7
+ export class Projects extends APIResource {
8
8
  /**
9
- * Returns the project associated with the API key used for authentication.
9
+ * Returns the project associated with the API key or X-Project header.
10
10
  *
11
11
  * The project contains metadata about your organization's configuration,
12
12
  * including:
13
13
  *
14
14
  * - Project ID and organization ID
15
15
  * - Project name and slug
16
+ * - Organization details
16
17
  * - Creation and update timestamps
17
18
  *
18
19
  * This endpoint is useful for verifying your API key is valid and retrieving
19
20
  * project details.
20
21
  */
21
- retrieve(options?: RequestOptions): APIPromise<ProjectRetrieveResponse> {
22
- return this._client.get('/project', options);
22
+ retrieveCurrent(options?: RequestOptions): APIPromise<ProjectRetrieveCurrentResponse> {
23
+ return this._client.get('/projects/current', options);
23
24
  }
24
25
  }
25
26
 
26
- export interface ProjectRetrieveResponse {
27
+ export interface ProjectRetrieveCurrentResponse {
27
28
  /**
28
29
  * Unique identifier for the project
29
30
  */
@@ -39,6 +40,11 @@ export interface ProjectRetrieveResponse {
39
40
  */
40
41
  name: string;
41
42
 
43
+ /**
44
+ * Organization that owns this project
45
+ */
46
+ organization: ProjectRetrieveCurrentResponse.Organization;
47
+
42
48
  /**
43
49
  * ID of the organization that owns this project
44
50
  */
@@ -55,6 +61,28 @@ export interface ProjectRetrieveResponse {
55
61
  updatedAt: string;
56
62
  }
57
63
 
58
- export declare namespace Project {
59
- export { type ProjectRetrieveResponse as ProjectRetrieveResponse };
64
+ export namespace ProjectRetrieveCurrentResponse {
65
+ /**
66
+ * Organization that owns this project
67
+ */
68
+ export interface Organization {
69
+ /**
70
+ * Unique identifier for the organization
71
+ */
72
+ id: string;
73
+
74
+ /**
75
+ * Human-readable name of the organization
76
+ */
77
+ name: string;
78
+
79
+ /**
80
+ * URL-friendly identifier for the organization
81
+ */
82
+ slug: string;
83
+ }
84
+ }
85
+
86
+ export declare namespace Projects {
87
+ export { type ProjectRetrieveCurrentResponse as ProjectRetrieveCurrentResponse };
60
88
  }
@@ -0,0 +1,5 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+
5
+ export class Secrets extends APIResource {}
package/src/streaming.ts CHANGED
@@ -1,87 +1,2 @@
1
- // stainless-custom-start
2
- /**
3
- * Streaming utilities for SSE (Server-Sent Events) responses.
4
- *
5
- * This module provides streaming support for the Reminix API.
6
- * When you upgrade to Stainless Pro, you can remove this file
7
- * and use the built-in streaming support.
8
- */
9
-
10
- /**
11
- * A chunk from a streaming response.
12
- */
13
- export interface StreamChunk {
14
- /** Text chunk from the stream */
15
- chunk: string;
16
- }
17
-
18
- /**
19
- * An async iterable stream that parses SSE (Server-Sent Events) responses.
20
- *
21
- * @example
22
- * ```ts
23
- * const stream = await client.agents.chatStream('agent', { messages: [...] });
24
- * for await (const chunk of stream) {
25
- * process.stdout.write(chunk.chunk);
26
- * }
27
- * ```
28
- */
29
- export class Stream<T> implements AsyncIterable<T> {
30
- constructor(private response: Response) {}
31
-
32
- async *[Symbol.asyncIterator](): AsyncIterator<T> {
33
- const reader = this.response.body?.getReader();
34
- if (!reader) {
35
- throw new Error('Response body is not readable');
36
- }
37
-
38
- const decoder = new TextDecoder();
39
- let buffer = '';
40
-
41
- try {
42
- while (true) {
43
- const { done, value } = await reader.read();
44
- if (done) break;
45
-
46
- buffer += decoder.decode(value, { stream: true });
47
- const lines = buffer.split('\n');
48
- buffer = lines.pop() || '';
49
-
50
- for (const line of lines) {
51
- const trimmed = line.trim();
52
- if (trimmed.startsWith('data: ')) {
53
- const data = trimmed.slice(6);
54
- if (data === '[DONE]') {
55
- return;
56
- }
57
- if (data) {
58
- try {
59
- yield JSON.parse(data) as T;
60
- } catch {
61
- // Skip malformed JSON
62
- }
63
- }
64
- }
65
- }
66
- }
67
-
68
- // Process any remaining data in buffer
69
- if (buffer.trim()) {
70
- const trimmed = buffer.trim();
71
- if (trimmed.startsWith('data: ')) {
72
- const data = trimmed.slice(6);
73
- if (data && data !== '[DONE]') {
74
- try {
75
- yield JSON.parse(data) as T;
76
- } catch {
77
- // Skip malformed JSON
78
- }
79
- }
80
- }
81
- }
82
- } finally {
83
- reader.releaseLock();
84
- }
85
- }
86
- }
87
- // stainless-custom-end
1
+ /** @deprecated Import from ./core/streaming instead */
2
+ export * from './core/streaming';
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.8.2'; // x-release-please-version
1
+ export const VERSION = '0.8.4'; // x-release-please-version
package/streaming.d.mts CHANGED
@@ -1,31 +1,2 @@
1
- /**
2
- * Streaming utilities for SSE (Server-Sent Events) responses.
3
- *
4
- * This module provides streaming support for the Reminix API.
5
- * When you upgrade to Stainless Pro, you can remove this file
6
- * and use the built-in streaming support.
7
- */
8
- /**
9
- * A chunk from a streaming response.
10
- */
11
- export interface StreamChunk {
12
- /** Text chunk from the stream */
13
- chunk: string;
14
- }
15
- /**
16
- * An async iterable stream that parses SSE (Server-Sent Events) responses.
17
- *
18
- * @example
19
- * ```ts
20
- * const stream = await client.agents.chatStream('agent', { messages: [...] });
21
- * for await (const chunk of stream) {
22
- * process.stdout.write(chunk.chunk);
23
- * }
24
- * ```
25
- */
26
- export declare class Stream<T> implements AsyncIterable<T> {
27
- private response;
28
- constructor(response: Response);
29
- [Symbol.asyncIterator](): AsyncIterator<T>;
30
- }
1
+ export * from "./core/streaming.mjs";
31
2
  //# sourceMappingURL=streaming.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"streaming.d.mts","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;GAUG;AACH,qBAAa,MAAM,CAAC,CAAC,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IACpC,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,QAAQ;IAE/B,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC;CAsDlD"}
1
+ {"version":3,"file":"streaming.d.mts","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":""}
package/streaming.d.ts CHANGED
@@ -1,31 +1,2 @@
1
- /**
2
- * Streaming utilities for SSE (Server-Sent Events) responses.
3
- *
4
- * This module provides streaming support for the Reminix API.
5
- * When you upgrade to Stainless Pro, you can remove this file
6
- * and use the built-in streaming support.
7
- */
8
- /**
9
- * A chunk from a streaming response.
10
- */
11
- export interface StreamChunk {
12
- /** Text chunk from the stream */
13
- chunk: string;
14
- }
15
- /**
16
- * An async iterable stream that parses SSE (Server-Sent Events) responses.
17
- *
18
- * @example
19
- * ```ts
20
- * const stream = await client.agents.chatStream('agent', { messages: [...] });
21
- * for await (const chunk of stream) {
22
- * process.stdout.write(chunk.chunk);
23
- * }
24
- * ```
25
- */
26
- export declare class Stream<T> implements AsyncIterable<T> {
27
- private response;
28
- constructor(response: Response);
29
- [Symbol.asyncIterator](): AsyncIterator<T>;
30
- }
1
+ export * from "./core/streaming.js";
31
2
  //# sourceMappingURL=streaming.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;GAUG;AACH,qBAAa,MAAM,CAAC,CAAC,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IACpC,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,QAAQ;IAE/B,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC;CAsDlD"}
1
+ {"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":""}