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,97 +1,3 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { APIResource } from "../../../core/resource.mjs";
3
- import { buildHeaders } from "../../../internal/headers.mjs";
4
- import { path } from "../../../internal/utils/path.mjs";
5
- /**
6
- * Create, manage, and execute AI agents with tool access, sandbox environments, and async run workflows
7
- */
8
- export class Chat extends APIResource {
9
- /**
10
- * Creates a persistent OpenCode chat session in a Modal sandbox. Session state is
11
- * retained and can be resumed across requests.
12
- */
13
- create(body = {}, options) {
14
- return this._client.post('/agent/v1/chat', { body, ...options });
15
- }
16
- /**
17
- * Snapshots and terminates the active sandbox (if any), then marks the chat as
18
- * ended.
19
- */
20
- delete(id, options) {
21
- return this._client.delete(path `/agent/v1/chat/${id}`, options);
22
- }
23
- /**
24
- * Aborts the active OpenCode generation for this chat session.
25
- */
26
- cancel(id, options) {
27
- return this._client.post(path `/agent/v1/chat/${id}/cancel`, options);
28
- }
29
- /**
30
- * Answers a pending OpenCode question for the chat session bound to this agent
31
- * chat.
32
- */
33
- replyToQuestion(requestID, params, options) {
34
- const { id, ...body } = params;
35
- return this._client.post(path `/agent/v1/chat/${id}/question/${requestID}/reply`, {
36
- body,
37
- ...options,
38
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
39
- });
40
- }
41
- /**
42
- * Streams a single assistant turn as normalized SSE events with stable turn,
43
- * message, and part IDs. Emits events: `turn.started`, `turn.status`,
44
- * `message.created`, `message.part.updated`, `message.completed`, `session.usage`,
45
- * `turn.completed`.
46
- *
47
- * **When to use this endpoint:** Recommended for building custom chat UIs that
48
- * need real-time streaming progress. This is the primary streaming endpoint for
49
- * new integrations.
50
- *
51
- * **Alternatives:**
52
- *
53
- * - `POST /chat/:id/message` — synchronous, returns complete response as JSON
54
- * (best for server-to-server)
55
- */
56
- respond(id, body, options) {
57
- return this._client.post(path `/agent/v1/chat/${id}/respond`, {
58
- body,
59
- ...options,
60
- headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
61
- stream: true,
62
- });
63
- }
64
- /**
65
- * Sends a message and returns the complete response as a single JSON body. Blocks
66
- * until the agent turn completes.
67
- *
68
- * **When to use this endpoint:** Best for server-to-server integrations,
69
- * background processing, or any context where you want the full response in one
70
- * call without managing an SSE stream.
71
- *
72
- * **Alternatives:**
73
- *
74
- * - `POST /chat/:id/respond` — streaming SSE with normalized events (recommended
75
- * for custom chat UIs)
76
- */
77
- sendMessage(id, body, options) {
78
- return this._client.post(path `/agent/v1/chat/${id}/message`, {
79
- body,
80
- ...options,
81
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
82
- });
83
- }
84
- /**
85
- * Relays OpenCode SSE events for this chat. Supports replay from buffered events
86
- * using Last-Event-ID.
87
- */
88
- stream(id, query = {}, options) {
89
- return this._client.get(path `/agent/v1/chat/${id}/stream`, {
90
- query,
91
- ...options,
92
- headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
93
- stream: true,
94
- });
95
- }
96
- }
2
+ export * from "./chat/index.mjs";
97
3
  //# sourceMappingURL=chat.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"chat.mjs","sourceRoot":"","sources":["../../../src/resources/agent/v1/chat.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf;;GAEG;AACH,MAAM,OAAO,IAAK,SAAQ,WAAW;IACnC;;;OAGG;IACH,MAAM,CACJ,OAA4C,EAAE,EAC9C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,EAAU,EAAE,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,kBAAkB,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,EAAU,EAAE,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,kBAAkB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC;IAED;;;OAGG;IACH,eAAe,CACb,SAAiB,EACjB,MAAiC,EACjC,OAAwB;QAExB,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,kBAAkB,EAAE,aAAa,SAAS,QAAQ,EAAE;YAC/E,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,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Agents, type AgentCreateResponse, type AgentRetrieveResponse, type AgentUpdateResponse, type AgentListResponse, type AgentDeleteResponse, type AgentCreateParams, type AgentUpdateParams, type AgentListParams, } from "./agents.mjs";
2
- export { Chat, type ChatCreateResponse, type ChatDeleteResponse, type ChatCancelResponse, type ChatRespondResponse, type ChatStreamResponse, type ChatCreateParams, type ChatReplyToQuestionParams, type ChatRespondParams, type ChatSendMessageParams, type ChatStreamParams, } from "./chat.mjs";
2
+ export { Chat, type ChatCreateResponse, type ChatDeleteResponse, type ChatCancelResponse, type ChatRespondResponse, type ChatStreamResponse, type ChatCreateParams, type ChatReplyToQuestionParams, type ChatRespondParams, type ChatSendMessageParams, type ChatStreamParams, } from "./chat/index.mjs";
3
3
  export { Execute, type ExecuteCreateResponse, type ExecuteCreateParams } from "./execute.mjs";
4
4
  export { Run, type RunCreateResponse, type RunListResponse, type RunCancelResponse, type RunEventsResponse, type RunExecResponse, type RunGetDetailsResponse, type RunGetStatusResponse, type RunWatchResponse, type RunCreateParams, type RunListParams, type RunEventsParams, type RunWatchParams, } from "./run.mjs";
5
5
  export { V1 } from "./v1.mjs";
@@ -1,5 +1,5 @@
1
1
  export { Agents, type AgentCreateResponse, type AgentRetrieveResponse, type AgentUpdateResponse, type AgentListResponse, type AgentDeleteResponse, type AgentCreateParams, type AgentUpdateParams, type AgentListParams, } from "./agents.js";
2
- export { Chat, type ChatCreateResponse, type ChatDeleteResponse, type ChatCancelResponse, type ChatRespondResponse, type ChatStreamResponse, type ChatCreateParams, type ChatReplyToQuestionParams, type ChatRespondParams, type ChatSendMessageParams, type ChatStreamParams, } from "./chat.js";
2
+ export { Chat, type ChatCreateResponse, type ChatDeleteResponse, type ChatCancelResponse, type ChatRespondResponse, type ChatStreamResponse, type ChatCreateParams, type ChatReplyToQuestionParams, type ChatRespondParams, type ChatSendMessageParams, type ChatStreamParams, } from "./chat/index.js";
3
3
  export { Execute, type ExecuteCreateResponse, type ExecuteCreateParams } from "./execute.js";
4
4
  export { Run, type RunCreateResponse, type RunListResponse, type RunCancelResponse, type RunEventsResponse, type RunExecResponse, type RunGetDetailsResponse, type RunGetStatusResponse, type RunWatchResponse, type RunCreateParams, type RunListParams, type RunEventsParams, type RunWatchParams, } from "./run.js";
5
5
  export { V1 } from "./v1.js";
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.V1 = exports.Run = exports.Execute = exports.Chat = exports.Agents = void 0;
5
5
  var agents_1 = require("./agents.js");
6
6
  Object.defineProperty(exports, "Agents", { enumerable: true, get: function () { return agents_1.Agents; } });
7
- var chat_1 = require("./chat.js");
8
- Object.defineProperty(exports, "Chat", { enumerable: true, get: function () { return chat_1.Chat; } });
7
+ var index_1 = require("./chat/index.js");
8
+ Object.defineProperty(exports, "Chat", { enumerable: true, get: function () { return index_1.Chat; } });
9
9
  var execute_1 = require("./execute.js");
10
10
  Object.defineProperty(exports, "Execute", { enumerable: true, get: function () { return execute_1.Execute; } });
11
11
  var run_1 = require("./run.js");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/agent/v1/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,sCAUkB;AAThB,gGAAA,MAAM,OAAA;AAUR,kCAYgB;AAXd,4FAAA,IAAI,OAAA;AAYN,wCAA0F;AAAjF,kGAAA,OAAO,OAAA;AAChB,gCAce;AAbb,0FAAA,GAAG,OAAA;AAcL,8BAA0B;AAAjB,wFAAA,EAAE,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/agent/v1/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,sCAUkB;AAThB,gGAAA,MAAM,OAAA;AAUR,yCAYsB;AAXpB,6FAAA,IAAI,OAAA;AAYN,wCAA0F;AAAjF,kGAAA,OAAO,OAAA;AAChB,gCAce;AAbb,0FAAA,GAAG,OAAA;AAcL,8BAA0B;AAAjB,wFAAA,EAAE,OAAA"}
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
  export { Agents, } from "./agents.mjs";
3
- export { Chat, } from "./chat.mjs";
3
+ export { Chat, } from "./chat/index.mjs";
4
4
  export { Execute } from "./execute.mjs";
5
5
  export { Run, } from "./run.mjs";
6
6
  export { V1 } from "./v1.mjs";
@@ -1,12 +1,12 @@
1
1
  import { APIResource } from "../../../core/resource.mjs";
2
2
  import * as AgentsAPI from "./agents.mjs";
3
3
  import { AgentCreateParams, AgentCreateResponse, AgentDeleteResponse, AgentListParams, AgentListResponse, AgentRetrieveResponse, AgentUpdateParams, AgentUpdateResponse, Agents } from "./agents.mjs";
4
- import * as ChatAPI from "./chat.mjs";
5
- import { Chat, ChatCancelResponse, ChatCreateParams, ChatCreateResponse, ChatDeleteResponse, ChatReplyToQuestionParams, ChatRespondParams, ChatRespondResponse, ChatSendMessageParams, ChatStreamParams, ChatStreamResponse } from "./chat.mjs";
6
4
  import * as ExecuteAPI from "./execute.mjs";
7
5
  import { Execute, ExecuteCreateParams, ExecuteCreateResponse } from "./execute.mjs";
8
6
  import * as RunAPI from "./run.mjs";
9
7
  import { Run, RunCancelResponse, RunCreateParams, RunCreateResponse, RunEventsParams, RunEventsResponse, RunExecResponse, RunGetDetailsResponse, RunGetStatusResponse, RunListParams, RunListResponse, RunWatchParams, RunWatchResponse } from "./run.mjs";
8
+ import * as ChatAPI from "./chat/chat.mjs";
9
+ import { Chat, ChatCancelResponse, ChatCreateParams, ChatCreateResponse, ChatDeleteResponse, ChatReplyToQuestionParams, ChatRespondParams, ChatRespondResponse, ChatSendMessageParams, ChatStreamParams, ChatStreamResponse } from "./chat/chat.mjs";
10
10
  export declare class V1 extends APIResource {
11
11
  agents: AgentsAPI.Agents;
12
12
  run: RunAPI.Run;
@@ -1 +1 @@
1
- {"version":3,"file":"v1.d.mts","sourceRoot":"","sources":["../../../src/resources/agent/v1/v1.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,E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BAAoB,EACjD,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,cAAc,IAAI,cAAc,GACtC,CAAC;IAEF,OAAO,EACL,OAAO,IAAI,OAAO,EAClB,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;IAEF,OAAO,EACL,IAAI,IAAI,IAAI,EACZ,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
@@ -1,12 +1,12 @@
1
1
  import { APIResource } from "../../../core/resource.js";
2
2
  import * as AgentsAPI from "./agents.js";
3
3
  import { AgentCreateParams, AgentCreateResponse, AgentDeleteResponse, AgentListParams, AgentListResponse, AgentRetrieveResponse, AgentUpdateParams, AgentUpdateResponse, Agents } from "./agents.js";
4
- import * as ChatAPI from "./chat.js";
5
- import { Chat, ChatCancelResponse, ChatCreateParams, ChatCreateResponse, ChatDeleteResponse, ChatReplyToQuestionParams, ChatRespondParams, ChatRespondResponse, ChatSendMessageParams, ChatStreamParams, ChatStreamResponse } from "./chat.js";
6
4
  import * as ExecuteAPI from "./execute.js";
7
5
  import { Execute, ExecuteCreateParams, ExecuteCreateResponse } from "./execute.js";
8
6
  import * as RunAPI from "./run.js";
9
7
  import { Run, RunCancelResponse, RunCreateParams, RunCreateResponse, RunEventsParams, RunEventsResponse, RunExecResponse, RunGetDetailsResponse, RunGetStatusResponse, RunListParams, RunListResponse, RunWatchParams, RunWatchResponse } from "./run.js";
8
+ import * as ChatAPI from "./chat/chat.js";
9
+ import { Chat, ChatCancelResponse, ChatCreateParams, ChatCreateResponse, ChatDeleteResponse, ChatReplyToQuestionParams, ChatRespondParams, ChatRespondResponse, ChatSendMessageParams, ChatStreamParams, ChatStreamResponse } from "./chat/chat.js";
10
10
  export declare class V1 extends APIResource {
11
11
  agents: AgentsAPI.Agents;
12
12
  run: RunAPI.Run;
@@ -1 +1 @@
1
- {"version":3,"file":"v1.d.ts","sourceRoot":"","sources":["../../../src/resources/agent/v1/v1.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,SAAS;OACd,EACL,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,EACP;OACM,KAAK,OAAO;OACZ,EACL,IAAI,EACJ,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EACnB;OACM,KAAK,UAAU;OACf,EAAE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE;OACvD,KAAK,MAAM;OACX,EACL,GAAG,EACH,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,eAAe,EACf,cAAc,EACd,gBAAgB,EACjB;AAED,qBAAa,EAAG,SAAQ,WAAW;IACjC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAsC;IAC9D,GAAG,EAAE,MAAM,CAAC,GAAG,CAAgC;IAC/C,OAAO,EAAE,UAAU,CAAC,OAAO,CAAwC;IACnE,IAAI,EAA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IAAI,yBAAyB,EAC3D,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
1
+ {"version":3,"file":"v1.d.ts","sourceRoot":"","sources":["../../../src/resources/agent/v1/v1.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,SAAS;OACd,EACL,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,EACP;OACM,KAAK,UAAU;OACf,EAAE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE;OACvD,KAAK,MAAM;OACX,EACL,GAAG,EACH,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,eAAe,EACf,cAAc,EACd,gBAAgB,EACjB;OACM,KAAK,OAAO;OACZ,EACL,IAAI,EACJ,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EACnB;AAED,qBAAa,EAAG,SAAQ,WAAW;IACjC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAsC;IAC9D,GAAG,EAAE,MAAM,CAAC,GAAG,CAAgC;IAC/C,OAAO,EAAE,UAAU,CAAC,OAAO,CAAwC;IACnE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAkC;CACrD;AAOD,MAAM,CAAC,OAAO,WAAW,EAAE,CAAC;IAC1B,OAAO,EACL,MAAM,IAAI,MAAM,EAChB,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,mBAAmB,IAAI,mBAA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.js");
7
7
  const AgentsAPI = tslib_1.__importStar(require("./agents.js"));
8
8
  const agents_1 = require("./agents.js");
9
- const ChatAPI = tslib_1.__importStar(require("./chat.js"));
10
- const chat_1 = require("./chat.js");
11
9
  const ExecuteAPI = tslib_1.__importStar(require("./execute.js"));
12
10
  const execute_1 = require("./execute.js");
13
11
  const RunAPI = tslib_1.__importStar(require("./run.js"));
14
12
  const run_1 = require("./run.js");
13
+ const ChatAPI = tslib_1.__importStar(require("./chat/chat.js"));
14
+ const chat_1 = require("./chat/chat.js");
15
15
  class V1 extends resource_1.APIResource {
16
16
  constructor() {
17
17
  super(...arguments);
@@ -1 +1 @@
1
- {"version":3,"file":"v1.js","sourceRoot":"","sources":["../../../src/resources/agent/v1/v1.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,wDAAqD;AACrD,+DAAsC;AACtC,wCAUkB;AAClB,2DAAkC;AAClC,oCAYgB;AAChB,iEAAwC;AACxC,0CAAgF;AAChF,yDAAgC;AAChC,kCAce;AAEf,MAAa,EAAG,SAAQ,sBAAW;IAAnC;;QACE,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9D,QAAG,GAAe,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/C,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnE,SAAI,GAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;CAAA;AALD,gBAKC;AAED,EAAE,CAAC,MAAM,GAAG,eAAM,CAAC;AACnB,EAAE,CAAC,GAAG,GAAG,SAAG,CAAC;AACb,EAAE,CAAC,OAAO,GAAG,iBAAO,CAAC;AACrB,EAAE,CAAC,IAAI,GAAG,WAAI,CAAC"}
1
+ {"version":3,"file":"v1.js","sourceRoot":"","sources":["../../../src/resources/agent/v1/v1.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,wDAAqD;AACrD,+DAAsC;AACtC,wCAUkB;AAClB,iEAAwC;AACxC,0CAAgF;AAChF,yDAAgC;AAChC,kCAce;AACf,gEAAuC;AACvC,yCAYqB;AAErB,MAAa,EAAG,SAAQ,sBAAW;IAAnC;;QACE,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9D,QAAG,GAAe,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/C,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnE,SAAI,GAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;CAAA;AALD,gBAKC;AAED,EAAE,CAAC,MAAM,GAAG,eAAM,CAAC;AACnB,EAAE,CAAC,GAAG,GAAG,SAAG,CAAC;AACb,EAAE,CAAC,OAAO,GAAG,iBAAO,CAAC;AACrB,EAAE,CAAC,IAAI,GAAG,WAAI,CAAC"}
@@ -2,12 +2,12 @@
2
2
  import { APIResource } from "../../../core/resource.mjs";
3
3
  import * as AgentsAPI from "./agents.mjs";
4
4
  import { Agents, } from "./agents.mjs";
5
- import * as ChatAPI from "./chat.mjs";
6
- import { Chat, } from "./chat.mjs";
7
5
  import * as ExecuteAPI from "./execute.mjs";
8
6
  import { Execute } from "./execute.mjs";
9
7
  import * as RunAPI from "./run.mjs";
10
8
  import { Run, } from "./run.mjs";
9
+ import * as ChatAPI from "./chat/chat.mjs";
10
+ import { Chat, } from "./chat/chat.mjs";
11
11
  export class V1 extends APIResource {
12
12
  constructor() {
13
13
  super(...arguments);
@@ -1 +1 @@
1
- {"version":3,"file":"v1.mjs","sourceRoot":"","sources":["../../../src/resources/agent/v1/v1.ts"],"names":[],"mappings":"AAAA,sFAAsF;OA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AAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnE,SAAI,GAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;CAAA;AAED,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC;AACnB,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC;AACb,EAAE,CAAC,OAAO,GAAG,OAAO,CAAC;AACrB,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC"}
@@ -0,0 +1,267 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../../core/resource';
4
+ import * as FilesAPI from './files';
5
+ import { FileDownloadParams, FileListResponse, Files } from './files';
6
+ import { APIPromise } from '../../../../core/api-promise';
7
+ import { Stream } from '../../../../core/streaming';
8
+ import { buildHeaders } from '../../../../internal/headers';
9
+ import { RequestOptions } from '../../../../internal/request-options';
10
+ import { path } from '../../../../internal/utils/path';
11
+
12
+ /**
13
+ * Create, manage, and execute AI agents with tool access, sandbox environments, and async run workflows
14
+ */
15
+ export class Chat extends APIResource {
16
+ files: FilesAPI.Files = new FilesAPI.Files(this._client);
17
+
18
+ /**
19
+ * Creates a persistent OpenCode chat session in a Modal sandbox. Session state is
20
+ * retained and can be resumed across requests.
21
+ */
22
+ create(
23
+ body: ChatCreateParams | null | undefined = {},
24
+ options?: RequestOptions,
25
+ ): APIPromise<ChatCreateResponse> {
26
+ return this._client.post('/agent/v1/chat', { body, ...options });
27
+ }
28
+
29
+ /**
30
+ * Snapshots and terminates the active sandbox (if any), then marks the chat as
31
+ * ended.
32
+ */
33
+ delete(id: string, options?: RequestOptions): APIPromise<ChatDeleteResponse> {
34
+ return this._client.delete(path`/agent/v1/chat/${id}`, options);
35
+ }
36
+
37
+ /**
38
+ * Aborts the active OpenCode generation for this chat session.
39
+ */
40
+ cancel(id: string, options?: RequestOptions): APIPromise<ChatCancelResponse> {
41
+ return this._client.post(path`/agent/v1/chat/${id}/cancel`, options);
42
+ }
43
+
44
+ /**
45
+ * Answers a pending OpenCode question for the chat session bound to this agent
46
+ * chat.
47
+ */
48
+ replyToQuestion(
49
+ requestID: string,
50
+ params: ChatReplyToQuestionParams,
51
+ options?: RequestOptions,
52
+ ): APIPromise<void> {
53
+ const { id, ...body } = params;
54
+ return this._client.post(path`/agent/v1/chat/${id}/question/${requestID}/reply`, {
55
+ body,
56
+ ...options,
57
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
58
+ });
59
+ }
60
+
61
+ /**
62
+ * Streams a single assistant turn as normalized SSE events with stable turn,
63
+ * message, and part IDs. Emits events: `turn.started`, `turn.status`,
64
+ * `message.created`, `message.part.updated`, `message.completed`, `session.usage`,
65
+ * `turn.completed`.
66
+ *
67
+ * **When to use this endpoint:** Recommended for building custom chat UIs that
68
+ * need real-time streaming progress. This is the primary streaming endpoint for
69
+ * new integrations.
70
+ *
71
+ * **Alternatives:**
72
+ *
73
+ * - `POST /chat/:id/message` — synchronous, returns complete response as JSON
74
+ * (best for server-to-server)
75
+ */
76
+ respond(
77
+ id: string,
78
+ body: ChatRespondParams,
79
+ options?: RequestOptions,
80
+ ): APIPromise<Stream<ChatRespondResponse>> {
81
+ return this._client.post(path`/agent/v1/chat/${id}/respond`, {
82
+ body,
83
+ ...options,
84
+ headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
85
+ stream: true,
86
+ }) as APIPromise<Stream<ChatRespondResponse>>;
87
+ }
88
+
89
+ /**
90
+ * Sends a message and returns the complete response as a single JSON body. Blocks
91
+ * until the agent turn completes.
92
+ *
93
+ * **When to use this endpoint:** Best for server-to-server integrations,
94
+ * background processing, or any context where you want the full response in one
95
+ * call without managing an SSE stream.
96
+ *
97
+ * **Alternatives:**
98
+ *
99
+ * - `POST /chat/:id/respond` — streaming SSE with normalized events (recommended
100
+ * for custom chat UIs)
101
+ */
102
+ sendMessage(id: string, body: ChatSendMessageParams, options?: RequestOptions): APIPromise<void> {
103
+ return this._client.post(path`/agent/v1/chat/${id}/message`, {
104
+ body,
105
+ ...options,
106
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
107
+ });
108
+ }
109
+
110
+ /**
111
+ * Relays OpenCode SSE events for this chat. Supports replay from buffered events
112
+ * using Last-Event-ID.
113
+ */
114
+ stream(
115
+ id: string,
116
+ query: ChatStreamParams | undefined = {},
117
+ options?: RequestOptions,
118
+ ): APIPromise<Stream<ChatStreamResponse>> {
119
+ return this._client.get(path`/agent/v1/chat/${id}/stream`, {
120
+ query,
121
+ ...options,
122
+ headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
123
+ stream: true,
124
+ }) as APIPromise<Stream<ChatStreamResponse>>;
125
+ }
126
+ }
127
+
128
+ export interface ChatCreateResponse {
129
+ id?: string;
130
+
131
+ createdAt?: string;
132
+
133
+ idleTimeoutMs?: number;
134
+
135
+ status?: string;
136
+ }
137
+
138
+ export interface ChatDeleteResponse {
139
+ id?: string;
140
+
141
+ cost?: number;
142
+
143
+ runtimeMs?: number;
144
+
145
+ snapshotImageId?: string | null;
146
+
147
+ status?: string;
148
+ }
149
+
150
+ export interface ChatCancelResponse {
151
+ id?: string;
152
+
153
+ ok?: boolean;
154
+ }
155
+
156
+ export type ChatRespondResponse = string;
157
+
158
+ export type ChatStreamResponse = string;
159
+
160
+ export interface ChatCreateParams {
161
+ /**
162
+ * Idle timeout before session is eligible for snapshot/termination. Defaults to 15
163
+ * minutes.
164
+ */
165
+ idleTimeoutMs?: number | null;
166
+
167
+ /**
168
+ * Optional model override for the OpenCode session
169
+ */
170
+ model?: string | null;
171
+
172
+ /**
173
+ * Optional human-readable session title
174
+ */
175
+ title?: string;
176
+
177
+ /**
178
+ * Restrict the chat session to specific vault IDs
179
+ */
180
+ vaultIds?: Array<string> | null;
181
+ }
182
+
183
+ export interface ChatReplyToQuestionParams {
184
+ /**
185
+ * Path param: Chat session ID
186
+ */
187
+ id: string;
188
+
189
+ /**
190
+ * Body param: Answer selections for each prompt element in the pending question
191
+ */
192
+ answers: Array<Array<string>>;
193
+ }
194
+
195
+ export interface ChatRespondParams {
196
+ /**
197
+ * Message content parts. Currently only "text" type is supported. Additional types
198
+ * (e.g. file, image) may be added in future versions.
199
+ */
200
+ parts?: Array<ChatRespondParams.Part>;
201
+ }
202
+
203
+ export namespace ChatRespondParams {
204
+ export interface Part {
205
+ /**
206
+ * The message text content
207
+ */
208
+ text: string;
209
+
210
+ /**
211
+ * Part type. Currently only "text" is supported.
212
+ */
213
+ type: 'text';
214
+ }
215
+ }
216
+
217
+ export interface ChatSendMessageParams {
218
+ /**
219
+ * Message content parts. Currently only "text" type is supported. Additional types
220
+ * (e.g. file, image) may be added in future versions.
221
+ */
222
+ parts?: Array<ChatSendMessageParams.Part>;
223
+ }
224
+
225
+ export namespace ChatSendMessageParams {
226
+ export interface Part {
227
+ /**
228
+ * The message text content
229
+ */
230
+ text: string;
231
+
232
+ /**
233
+ * Part type. Currently only "text" is supported.
234
+ */
235
+ type: 'text';
236
+ }
237
+ }
238
+
239
+ export interface ChatStreamParams {
240
+ /**
241
+ * Replay events after this sequence number
242
+ */
243
+ lastEventId?: number;
244
+ }
245
+
246
+ Chat.Files = Files;
247
+
248
+ export declare namespace Chat {
249
+ export {
250
+ type ChatCreateResponse as ChatCreateResponse,
251
+ type ChatDeleteResponse as ChatDeleteResponse,
252
+ type ChatCancelResponse as ChatCancelResponse,
253
+ type ChatRespondResponse as ChatRespondResponse,
254
+ type ChatStreamResponse as ChatStreamResponse,
255
+ type ChatCreateParams as ChatCreateParams,
256
+ type ChatReplyToQuestionParams as ChatReplyToQuestionParams,
257
+ type ChatRespondParams as ChatRespondParams,
258
+ type ChatSendMessageParams as ChatSendMessageParams,
259
+ type ChatStreamParams as ChatStreamParams,
260
+ };
261
+
262
+ export {
263
+ Files as Files,
264
+ type FileListResponse as FileListResponse,
265
+ type FileDownloadParams as FileDownloadParams,
266
+ };
267
+ }
@@ -0,0 +1,63 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../../core/resource';
4
+ import { APIPromise } from '../../../../core/api-promise';
5
+ import { buildHeaders } from '../../../../internal/headers';
6
+ import { RequestOptions } from '../../../../internal/request-options';
7
+ import { path } from '../../../../internal/utils/path';
8
+
9
+ /**
10
+ * Create, manage, and execute AI agents with tool access, sandbox environments, and async run workflows
11
+ */
12
+ export class Files extends APIResource {
13
+ /**
14
+ * Lists files created by the agent in the sandbox workspace. Only available while
15
+ * the sandbox is running.
16
+ */
17
+ list(id: string, options?: RequestOptions): APIPromise<FileListResponse> {
18
+ return this._client.get(path`/agent/v1/chat/${id}/files`, options);
19
+ }
20
+
21
+ /**
22
+ * Downloads a file from the sandbox workspace by path. Only available while the
23
+ * sandbox is running.
24
+ */
25
+ download(path_: string, params: FileDownloadParams, options?: RequestOptions): APIPromise<Response> {
26
+ const { id } = params;
27
+ return this._client.get(path`/agent/v1/chat/${id}/files/${path_}`, {
28
+ ...options,
29
+ headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]),
30
+ __binaryResponse: true,
31
+ });
32
+ }
33
+ }
34
+
35
+ export interface FileListResponse {
36
+ chatId?: string;
37
+
38
+ files?: Array<FileListResponse.File>;
39
+ }
40
+
41
+ export namespace FileListResponse {
42
+ export interface File {
43
+ name?: string;
44
+
45
+ /**
46
+ * Relative path from /workspace
47
+ */
48
+ path?: string;
49
+
50
+ sizeBytes?: number;
51
+ }
52
+ }
53
+
54
+ export interface FileDownloadParams {
55
+ /**
56
+ * Chat session ID
57
+ */
58
+ id: string;
59
+ }
60
+
61
+ export declare namespace Files {
62
+ export { type FileListResponse as FileListResponse, type FileDownloadParams as FileDownloadParams };
63
+ }
@@ -0,0 +1,16 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ Chat,
5
+ type ChatCreateResponse,
6
+ type ChatDeleteResponse,
7
+ type ChatCancelResponse,
8
+ type ChatRespondResponse,
9
+ type ChatStreamResponse,
10
+ type ChatCreateParams,
11
+ type ChatReplyToQuestionParams,
12
+ type ChatRespondParams,
13
+ type ChatSendMessageParams,
14
+ type ChatStreamParams,
15
+ } from './chat';
16
+ export { Files, type FileListResponse, type FileDownloadParams } from './files';