casedev 0.25.0 → 0.26.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 (58) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +1 -1
  3. package/resources/agent/v1/chat/chat.d.mts +163 -0
  4. package/resources/agent/v1/chat/chat.d.mts.map +1 -0
  5. package/resources/agent/v1/chat/chat.d.ts +163 -0
  6. package/resources/agent/v1/chat/chat.d.ts.map +1 -0
  7. package/resources/agent/v1/chat/chat.js +109 -0
  8. package/resources/agent/v1/chat/chat.js.map +1 -0
  9. package/resources/agent/v1/chat/chat.mjs +104 -0
  10. package/resources/agent/v1/chat/chat.mjs.map +1 -0
  11. package/resources/agent/v1/chat/files.d.mts +42 -0
  12. package/resources/agent/v1/chat/files.d.mts.map +1 -0
  13. package/resources/agent/v1/chat/files.d.ts +42 -0
  14. package/resources/agent/v1/chat/files.d.ts.map +1 -0
  15. package/resources/agent/v1/chat/files.js +33 -0
  16. package/resources/agent/v1/chat/files.js.map +1 -0
  17. package/resources/agent/v1/chat/files.mjs +29 -0
  18. package/resources/agent/v1/chat/files.mjs.map +1 -0
  19. package/resources/agent/v1/chat/index.d.mts +3 -0
  20. package/resources/agent/v1/chat/index.d.mts.map +1 -0
  21. package/resources/agent/v1/chat/index.d.ts +3 -0
  22. package/resources/agent/v1/chat/index.d.ts.map +1 -0
  23. package/resources/agent/v1/chat/index.js +9 -0
  24. package/resources/agent/v1/chat/index.js.map +1 -0
  25. package/resources/agent/v1/chat/index.mjs +4 -0
  26. package/resources/agent/v1/chat/index.mjs.map +1 -0
  27. package/resources/agent/v1/chat.d.mts +1 -158
  28. package/resources/agent/v1/chat.d.mts.map +1 -1
  29. package/resources/agent/v1/chat.d.ts +1 -158
  30. package/resources/agent/v1/chat.d.ts.map +1 -1
  31. package/resources/agent/v1/chat.js +2 -97
  32. package/resources/agent/v1/chat.js.map +1 -1
  33. package/resources/agent/v1/chat.mjs +1 -95
  34. package/resources/agent/v1/chat.mjs.map +1 -1
  35. package/resources/agent/v1/index.d.mts +1 -1
  36. package/resources/agent/v1/index.d.ts +1 -1
  37. package/resources/agent/v1/index.js +2 -2
  38. package/resources/agent/v1/index.js.map +1 -1
  39. package/resources/agent/v1/index.mjs +1 -1
  40. package/resources/agent/v1/v1.d.mts +2 -2
  41. package/resources/agent/v1/v1.d.mts.map +1 -1
  42. package/resources/agent/v1/v1.d.ts +2 -2
  43. package/resources/agent/v1/v1.d.ts.map +1 -1
  44. package/resources/agent/v1/v1.js +2 -2
  45. package/resources/agent/v1/v1.js.map +1 -1
  46. package/resources/agent/v1/v1.mjs +2 -2
  47. package/resources/agent/v1/v1.mjs.map +1 -1
  48. package/src/resources/agent/v1/chat/chat.ts +267 -0
  49. package/src/resources/agent/v1/chat/files.ts +63 -0
  50. package/src/resources/agent/v1/chat/index.ts +16 -0
  51. package/src/resources/agent/v1/chat.ts +1 -253
  52. package/src/resources/agent/v1/index.ts +1 -1
  53. package/src/resources/agent/v1/v1.ts +14 -14
  54. package/src/version.ts +1 -1
  55. package/version.d.mts +1 -1
  56. package/version.d.ts +1 -1
  57. package/version.js +1 -1
  58. package/version.mjs +1 -1
@@ -1,255 +1,3 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../../core/resource';
4
- import { APIPromise } from '../../../core/api-promise';
5
- import { Stream } from '../../../core/streaming';
6
- import { buildHeaders } from '../../../internal/headers';
7
- import { RequestOptions } from '../../../internal/request-options';
8
- import { path } from '../../../internal/utils/path';
9
-
10
- /**
11
- * Create, manage, and execute AI agents with tool access, sandbox environments, and async run workflows
12
- */
13
- export class Chat extends APIResource {
14
- /**
15
- * Creates a persistent OpenCode chat session in a Modal sandbox. Session state is
16
- * retained and can be resumed across requests.
17
- */
18
- create(
19
- body: ChatCreateParams | null | undefined = {},
20
- options?: RequestOptions,
21
- ): APIPromise<ChatCreateResponse> {
22
- return this._client.post('/agent/v1/chat', { body, ...options });
23
- }
24
-
25
- /**
26
- * Snapshots and terminates the active sandbox (if any), then marks the chat as
27
- * ended.
28
- */
29
- delete(id: string, options?: RequestOptions): APIPromise<ChatDeleteResponse> {
30
- return this._client.delete(path`/agent/v1/chat/${id}`, options);
31
- }
32
-
33
- /**
34
- * Aborts the active OpenCode generation for this chat session.
35
- */
36
- cancel(id: string, options?: RequestOptions): APIPromise<ChatCancelResponse> {
37
- return this._client.post(path`/agent/v1/chat/${id}/cancel`, options);
38
- }
39
-
40
- /**
41
- * Answers a pending OpenCode question for the chat session bound to this agent
42
- * chat.
43
- */
44
- replyToQuestion(
45
- requestID: string,
46
- params: ChatReplyToQuestionParams,
47
- options?: RequestOptions,
48
- ): APIPromise<void> {
49
- const { id, ...body } = params;
50
- return this._client.post(path`/agent/v1/chat/${id}/question/${requestID}/reply`, {
51
- body,
52
- ...options,
53
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
54
- });
55
- }
56
-
57
- /**
58
- * Streams a single assistant turn as normalized SSE events with stable turn,
59
- * message, and part IDs. Emits events: `turn.started`, `turn.status`,
60
- * `message.created`, `message.part.updated`, `message.completed`, `session.usage`,
61
- * `turn.completed`.
62
- *
63
- * **When to use this endpoint:** Recommended for building custom chat UIs that
64
- * need real-time streaming progress. This is the primary streaming endpoint for
65
- * new integrations.
66
- *
67
- * **Alternatives:**
68
- *
69
- * - `POST /chat/:id/message` — synchronous, returns complete response as JSON
70
- * (best for server-to-server)
71
- */
72
- respond(
73
- id: string,
74
- body: ChatRespondParams,
75
- options?: RequestOptions,
76
- ): APIPromise<Stream<ChatRespondResponse>> {
77
- return this._client.post(path`/agent/v1/chat/${id}/respond`, {
78
- body,
79
- ...options,
80
- headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
81
- stream: true,
82
- }) as APIPromise<Stream<ChatRespondResponse>>;
83
- }
84
-
85
- /**
86
- * Sends a message and returns the complete response as a single JSON body. Blocks
87
- * until the agent turn completes.
88
- *
89
- * **When to use this endpoint:** Best for server-to-server integrations,
90
- * background processing, or any context where you want the full response in one
91
- * call without managing an SSE stream.
92
- *
93
- * **Alternatives:**
94
- *
95
- * - `POST /chat/:id/respond` — streaming SSE with normalized events (recommended
96
- * for custom chat UIs)
97
- */
98
- sendMessage(id: string, body: ChatSendMessageParams, options?: RequestOptions): APIPromise<void> {
99
- return this._client.post(path`/agent/v1/chat/${id}/message`, {
100
- body,
101
- ...options,
102
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
103
- });
104
- }
105
-
106
- /**
107
- * Relays OpenCode SSE events for this chat. Supports replay from buffered events
108
- * using Last-Event-ID.
109
- */
110
- stream(
111
- id: string,
112
- query: ChatStreamParams | undefined = {},
113
- options?: RequestOptions,
114
- ): APIPromise<Stream<ChatStreamResponse>> {
115
- return this._client.get(path`/agent/v1/chat/${id}/stream`, {
116
- query,
117
- ...options,
118
- headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
119
- stream: true,
120
- }) as APIPromise<Stream<ChatStreamResponse>>;
121
- }
122
- }
123
-
124
- export interface ChatCreateResponse {
125
- id?: string;
126
-
127
- createdAt?: string;
128
-
129
- idleTimeoutMs?: number;
130
-
131
- status?: string;
132
- }
133
-
134
- export interface ChatDeleteResponse {
135
- id?: string;
136
-
137
- cost?: number;
138
-
139
- runtimeMs?: number;
140
-
141
- snapshotImageId?: string | null;
142
-
143
- status?: string;
144
- }
145
-
146
- export interface ChatCancelResponse {
147
- id?: string;
148
-
149
- ok?: boolean;
150
- }
151
-
152
- export type ChatRespondResponse = string;
153
-
154
- export type ChatStreamResponse = string;
155
-
156
- export interface ChatCreateParams {
157
- /**
158
- * Idle timeout before session is eligible for snapshot/termination. Defaults to 15
159
- * minutes.
160
- */
161
- idleTimeoutMs?: number | null;
162
-
163
- /**
164
- * Optional model override for the OpenCode session
165
- */
166
- model?: string | null;
167
-
168
- /**
169
- * Optional human-readable session title
170
- */
171
- title?: string;
172
-
173
- /**
174
- * Restrict the chat session to specific vault IDs
175
- */
176
- vaultIds?: Array<string> | null;
177
- }
178
-
179
- export interface ChatReplyToQuestionParams {
180
- /**
181
- * Path param: Chat session ID
182
- */
183
- id: string;
184
-
185
- /**
186
- * Body param: Answer selections for each prompt element in the pending question
187
- */
188
- answers: Array<Array<string>>;
189
- }
190
-
191
- export interface ChatRespondParams {
192
- /**
193
- * Message content parts. Currently only "text" type is supported. Additional types
194
- * (e.g. file, image) may be added in future versions.
195
- */
196
- parts?: Array<ChatRespondParams.Part>;
197
- }
198
-
199
- export namespace ChatRespondParams {
200
- export interface Part {
201
- /**
202
- * The message text content
203
- */
204
- text: string;
205
-
206
- /**
207
- * Part type. Currently only "text" is supported.
208
- */
209
- type: 'text';
210
- }
211
- }
212
-
213
- export interface ChatSendMessageParams {
214
- /**
215
- * Message content parts. Currently only "text" type is supported. Additional types
216
- * (e.g. file, image) may be added in future versions.
217
- */
218
- parts?: Array<ChatSendMessageParams.Part>;
219
- }
220
-
221
- export namespace ChatSendMessageParams {
222
- export interface Part {
223
- /**
224
- * The message text content
225
- */
226
- text: string;
227
-
228
- /**
229
- * Part type. Currently only "text" is supported.
230
- */
231
- type: 'text';
232
- }
233
- }
234
-
235
- export interface ChatStreamParams {
236
- /**
237
- * Replay events after this sequence number
238
- */
239
- lastEventId?: number;
240
- }
241
-
242
- export declare namespace Chat {
243
- export {
244
- type ChatCreateResponse as ChatCreateResponse,
245
- type ChatDeleteResponse as ChatDeleteResponse,
246
- type ChatCancelResponse as ChatCancelResponse,
247
- type ChatRespondResponse as ChatRespondResponse,
248
- type ChatStreamResponse as ChatStreamResponse,
249
- type ChatCreateParams as ChatCreateParams,
250
- type ChatReplyToQuestionParams as ChatReplyToQuestionParams,
251
- type ChatRespondParams as ChatRespondParams,
252
- type ChatSendMessageParams as ChatSendMessageParams,
253
- type ChatStreamParams as ChatStreamParams,
254
- };
255
- }
3
+ export * from './chat/index';
@@ -23,7 +23,7 @@ export {
23
23
  type ChatRespondParams,
24
24
  type ChatSendMessageParams,
25
25
  type ChatStreamParams,
26
- } from './chat';
26
+ } from './chat/index';
27
27
  export { Execute, type ExecuteCreateResponse, type ExecuteCreateParams } from './execute';
28
28
  export {
29
29
  Run,
@@ -13,20 +13,6 @@ import {
13
13
  AgentUpdateResponse,
14
14
  Agents,
15
15
  } from './agents';
16
- import * as ChatAPI from './chat';
17
- import {
18
- Chat,
19
- ChatCancelResponse,
20
- ChatCreateParams,
21
- ChatCreateResponse,
22
- ChatDeleteResponse,
23
- ChatReplyToQuestionParams,
24
- ChatRespondParams,
25
- ChatRespondResponse,
26
- ChatSendMessageParams,
27
- ChatStreamParams,
28
- ChatStreamResponse,
29
- } from './chat';
30
16
  import * as ExecuteAPI from './execute';
31
17
  import { Execute, ExecuteCreateParams, ExecuteCreateResponse } from './execute';
32
18
  import * as RunAPI from './run';
@@ -45,6 +31,20 @@ import {
45
31
  RunWatchParams,
46
32
  RunWatchResponse,
47
33
  } from './run';
34
+ import * as ChatAPI from './chat/chat';
35
+ import {
36
+ Chat,
37
+ ChatCancelResponse,
38
+ ChatCreateParams,
39
+ ChatCreateResponse,
40
+ ChatDeleteResponse,
41
+ ChatReplyToQuestionParams,
42
+ ChatRespondParams,
43
+ ChatRespondResponse,
44
+ ChatSendMessageParams,
45
+ ChatStreamParams,
46
+ ChatStreamResponse,
47
+ } from './chat/chat';
48
48
 
49
49
  export class V1 extends APIResource {
50
50
  agents: AgentsAPI.Agents = new AgentsAPI.Agents(this._client);
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.25.0'; // x-release-please-version
1
+ export const VERSION = '0.26.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.25.0";
1
+ export declare const VERSION = "0.26.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.25.0";
1
+ export declare const VERSION = "0.26.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.25.0'; // x-release-please-version
4
+ exports.VERSION = '0.26.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.25.0'; // x-release-please-version
1
+ export const VERSION = '0.26.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map