@opencode-ai/sdk 0.1.0-alpha.14 → 0.1.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (302) hide show
  1. package/CHANGELOG.md +0 -113
  2. package/LICENSE +4 -198
  3. package/README.md +0 -18
  4. package/client.d.mts +48 -17
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +48 -17
  7. package/client.d.ts.map +1 -1
  8. package/client.js +48 -15
  9. package/client.js.map +1 -1
  10. package/client.mjs +48 -15
  11. package/client.mjs.map +1 -1
  12. package/internal/parse.d.mts.map +1 -1
  13. package/internal/parse.d.ts.map +1 -1
  14. package/internal/parse.js +0 -10
  15. package/internal/parse.js.map +1 -1
  16. package/internal/parse.mjs +0 -10
  17. package/internal/parse.mjs.map +1 -1
  18. package/internal/request-options.d.mts +0 -2
  19. package/internal/request-options.d.mts.map +1 -1
  20. package/internal/request-options.d.ts +0 -2
  21. package/internal/request-options.d.ts.map +1 -1
  22. package/internal/request-options.js.map +1 -1
  23. package/internal/request-options.mjs.map +1 -1
  24. package/internal/tslib.js +6 -6
  25. package/internal/types.d.mts +6 -8
  26. package/internal/types.d.mts.map +1 -1
  27. package/internal/types.d.ts +6 -8
  28. package/internal/types.d.ts.map +1 -1
  29. package/internal/uploads.js +1 -1
  30. package/internal/uploads.js.map +1 -1
  31. package/internal/uploads.mjs +1 -1
  32. package/internal/uploads.mjs.map +1 -1
  33. package/internal/utils/log.js +1 -1
  34. package/internal/utils/log.js.map +1 -1
  35. package/internal/utils/log.mjs +1 -1
  36. package/internal/utils/log.mjs.map +1 -1
  37. package/internal/utils/path.d.mts.map +1 -1
  38. package/internal/utils/path.d.ts.map +1 -1
  39. package/internal/utils/path.js +5 -26
  40. package/internal/utils/path.js.map +1 -1
  41. package/internal/utils/path.mjs +5 -26
  42. package/internal/utils/path.mjs.map +1 -1
  43. package/package.json +3 -13
  44. package/resources/app-info.d.mts +31 -0
  45. package/resources/app-info.d.mts.map +1 -0
  46. package/resources/app-info.d.ts +31 -0
  47. package/resources/app-info.d.ts.map +1 -0
  48. package/resources/app-info.js +15 -0
  49. package/resources/app-info.js.map +1 -0
  50. package/resources/app-info.mjs +11 -0
  51. package/resources/app-info.mjs.map +1 -0
  52. package/resources/app-initialize.d.mts +14 -0
  53. package/resources/app-initialize.d.mts.map +1 -0
  54. package/resources/app-initialize.d.ts +14 -0
  55. package/resources/app-initialize.d.ts.map +1 -0
  56. package/resources/app-initialize.js +15 -0
  57. package/resources/app-initialize.js.map +1 -0
  58. package/resources/app-initialize.mjs +11 -0
  59. package/resources/app-initialize.mjs.map +1 -0
  60. package/resources/config-get.d.mts +236 -0
  61. package/resources/config-get.d.mts.map +1 -0
  62. package/resources/config-get.d.ts +236 -0
  63. package/resources/config-get.d.ts.map +1 -0
  64. package/resources/config-get.js +15 -0
  65. package/resources/config-get.js.map +1 -0
  66. package/resources/config-get.mjs +11 -0
  67. package/resources/config-get.mjs.map +1 -0
  68. package/resources/event.d.mts +27 -81
  69. package/resources/event.d.mts.map +1 -1
  70. package/resources/event.d.ts +27 -81
  71. package/resources/event.d.ts.map +1 -1
  72. package/resources/event.js +1 -1
  73. package/resources/event.js.map +1 -1
  74. package/resources/event.mjs +1 -1
  75. package/resources/event.mjs.map +1 -1
  76. package/resources/file-search.d.mts +17 -0
  77. package/resources/file-search.d.mts.map +1 -0
  78. package/resources/file-search.d.ts +17 -0
  79. package/resources/file-search.d.ts.map +1 -0
  80. package/resources/file-search.js +15 -0
  81. package/resources/file-search.js.map +1 -0
  82. package/resources/file-search.mjs +11 -0
  83. package/resources/file-search.mjs.map +1 -0
  84. package/resources/index.d.mts +16 -6
  85. package/resources/index.d.mts.map +1 -1
  86. package/resources/index.d.ts +16 -6
  87. package/resources/index.d.ts.map +1 -1
  88. package/resources/index.js +33 -13
  89. package/resources/index.js.map +1 -1
  90. package/resources/index.mjs +16 -6
  91. package/resources/index.mjs.map +1 -1
  92. package/resources/installation-info.d.mts +17 -0
  93. package/resources/installation-info.d.mts.map +1 -0
  94. package/resources/installation-info.d.ts +17 -0
  95. package/resources/installation-info.d.ts.map +1 -0
  96. package/resources/installation-info.js +15 -0
  97. package/resources/installation-info.js.map +1 -0
  98. package/resources/installation-info.mjs +11 -0
  99. package/resources/installation-info.mjs.map +1 -0
  100. package/resources/path-get.d.mts +19 -0
  101. package/resources/path-get.d.mts.map +1 -0
  102. package/resources/path-get.d.ts +19 -0
  103. package/resources/path-get.d.ts.map +1 -0
  104. package/resources/path-get.js +15 -0
  105. package/resources/path-get.js.map +1 -0
  106. package/resources/path-get.mjs +11 -0
  107. package/resources/path-get.mjs.map +1 -0
  108. package/resources/provider-list.d.mts +58 -0
  109. package/resources/provider-list.d.mts.map +1 -0
  110. package/resources/provider-list.d.ts +58 -0
  111. package/resources/provider-list.d.ts.map +1 -0
  112. package/resources/provider-list.js +15 -0
  113. package/resources/provider-list.js.map +1 -0
  114. package/resources/provider-list.mjs +11 -0
  115. package/resources/provider-list.mjs.map +1 -0
  116. package/resources/session-abort.d.mts +17 -0
  117. package/resources/session-abort.d.mts.map +1 -0
  118. package/resources/session-abort.d.ts +17 -0
  119. package/resources/session-abort.d.ts.map +1 -0
  120. package/resources/session-abort.js +15 -0
  121. package/resources/session-abort.js.map +1 -0
  122. package/resources/session-abort.mjs +11 -0
  123. package/resources/session-abort.mjs.map +1 -0
  124. package/resources/session-chat.d.mts +160 -0
  125. package/resources/session-chat.d.mts.map +1 -0
  126. package/resources/session-chat.d.ts +160 -0
  127. package/resources/session-chat.d.ts.map +1 -0
  128. package/resources/session-chat.js +15 -0
  129. package/resources/session-chat.js.map +1 -0
  130. package/resources/session-chat.mjs +11 -0
  131. package/resources/session-chat.mjs.map +1 -0
  132. package/resources/session-create.d.mts +30 -0
  133. package/resources/session-create.d.mts.map +1 -0
  134. package/resources/session-create.d.ts +30 -0
  135. package/resources/session-create.d.ts.map +1 -0
  136. package/resources/session-create.js +15 -0
  137. package/resources/session-create.js.map +1 -0
  138. package/resources/session-create.mjs +11 -0
  139. package/resources/session-create.mjs.map +1 -0
  140. package/resources/session-initialize.d.mts +19 -0
  141. package/resources/session-initialize.d.mts.map +1 -0
  142. package/resources/session-initialize.d.ts +19 -0
  143. package/resources/session-initialize.d.ts.map +1 -0
  144. package/resources/session-initialize.js +15 -0
  145. package/resources/session-initialize.js.map +1 -0
  146. package/resources/session-initialize.mjs +11 -0
  147. package/resources/session-initialize.mjs.map +1 -0
  148. package/resources/session-list.d.mts +15 -0
  149. package/resources/session-list.d.mts.map +1 -0
  150. package/resources/session-list.d.ts +15 -0
  151. package/resources/session-list.d.ts.map +1 -0
  152. package/resources/session-list.js +15 -0
  153. package/resources/session-list.js.map +1 -0
  154. package/resources/session-list.mjs +11 -0
  155. package/resources/session-list.mjs.map +1 -0
  156. package/resources/session-messages.d.mts +18 -0
  157. package/resources/session-messages.d.mts.map +1 -0
  158. package/resources/session-messages.d.ts +18 -0
  159. package/resources/session-messages.d.ts.map +1 -0
  160. package/resources/session-messages.js +15 -0
  161. package/resources/session-messages.js.map +1 -0
  162. package/resources/session-messages.mjs +11 -0
  163. package/resources/session-messages.mjs.map +1 -0
  164. package/resources/session-share.d.mts +17 -0
  165. package/resources/session-share.d.mts.map +1 -0
  166. package/resources/session-share.d.ts +17 -0
  167. package/resources/session-share.d.ts.map +1 -0
  168. package/resources/session-share.js +15 -0
  169. package/resources/session-share.js.map +1 -0
  170. package/resources/session-share.mjs +11 -0
  171. package/resources/session-share.mjs.map +1 -0
  172. package/resources/session-summarize.d.mts +19 -0
  173. package/resources/session-summarize.d.mts.map +1 -0
  174. package/resources/session-summarize.d.ts +19 -0
  175. package/resources/session-summarize.d.ts.map +1 -0
  176. package/resources/session-summarize.js +15 -0
  177. package/resources/session-summarize.js.map +1 -0
  178. package/resources/session-summarize.mjs +11 -0
  179. package/resources/session-summarize.mjs.map +1 -0
  180. package/resources/session-unshare.d.mts +17 -0
  181. package/resources/session-unshare.d.mts.map +1 -0
  182. package/resources/session-unshare.d.ts +17 -0
  183. package/resources/session-unshare.d.ts.map +1 -0
  184. package/resources/session-unshare.js +15 -0
  185. package/resources/session-unshare.js.map +1 -0
  186. package/resources/session-unshare.mjs +11 -0
  187. package/resources/session-unshare.mjs.map +1 -0
  188. package/src/client.ts +118 -96
  189. package/src/internal/parse.ts +0 -14
  190. package/src/internal/request-options.ts +0 -2
  191. package/src/internal/types.ts +6 -9
  192. package/src/internal/uploads.ts +1 -1
  193. package/src/internal/utils/log.ts +1 -1
  194. package/src/internal/utils/path.ts +7 -32
  195. package/src/resources/app-info.ts +46 -0
  196. package/src/resources/app-initialize.ts +20 -0
  197. package/src/resources/config-get.ts +294 -0
  198. package/src/resources/event.ts +37 -115
  199. package/src/resources/file-search.ts +27 -0
  200. package/src/resources/index.ts +33 -44
  201. package/src/resources/installation-info.ts +24 -0
  202. package/src/resources/path-get.ts +28 -0
  203. package/src/resources/provider-list.ts +80 -0
  204. package/src/resources/session-abort.ts +27 -0
  205. package/src/resources/session-chat.ts +250 -0
  206. package/src/resources/session-create.ts +44 -0
  207. package/src/resources/session-initialize.ts +34 -0
  208. package/src/resources/session-list.ts +21 -0
  209. package/src/resources/session-messages.ts +31 -0
  210. package/src/resources/session-share.ts +23 -0
  211. package/src/resources/session-summarize.ts +34 -0
  212. package/src/resources/session-unshare.ts +26 -0
  213. package/src/version.ts +1 -1
  214. package/version.d.mts +1 -1
  215. package/version.d.mts.map +1 -1
  216. package/version.d.ts +1 -1
  217. package/version.d.ts.map +1 -1
  218. package/version.js +1 -1
  219. package/version.js.map +1 -1
  220. package/version.mjs +1 -1
  221. package/version.mjs.map +1 -1
  222. package/core/streaming.d.mts +0 -31
  223. package/core/streaming.d.mts.map +0 -1
  224. package/core/streaming.d.ts +0 -31
  225. package/core/streaming.d.ts.map +0 -1
  226. package/core/streaming.js +0 -257
  227. package/core/streaming.js.map +0 -1
  228. package/core/streaming.mjs +0 -252
  229. package/core/streaming.mjs.map +0 -1
  230. package/internal/decoders/line.d.mts +0 -17
  231. package/internal/decoders/line.d.mts.map +0 -1
  232. package/internal/decoders/line.d.ts +0 -17
  233. package/internal/decoders/line.d.ts.map +0 -1
  234. package/internal/decoders/line.js +0 -113
  235. package/internal/decoders/line.js.map +0 -1
  236. package/internal/decoders/line.mjs +0 -108
  237. package/internal/decoders/line.mjs.map +0 -1
  238. package/resources/app.d.mts +0 -37
  239. package/resources/app.d.mts.map +0 -1
  240. package/resources/app.d.ts +0 -37
  241. package/resources/app.d.ts.map +0 -1
  242. package/resources/app.js +0 -21
  243. package/resources/app.js.map +0 -1
  244. package/resources/app.mjs +0 -17
  245. package/resources/app.mjs.map +0 -1
  246. package/resources/config.d.mts +0 -318
  247. package/resources/config.d.mts.map +0 -1
  248. package/resources/config.d.ts +0 -318
  249. package/resources/config.d.ts.map +0 -1
  250. package/resources/config.js +0 -21
  251. package/resources/config.js.map +0 -1
  252. package/resources/config.mjs +0 -17
  253. package/resources/config.mjs.map +0 -1
  254. package/resources/file.d.mts +0 -33
  255. package/resources/file.d.mts.map +0 -1
  256. package/resources/file.d.ts +0 -33
  257. package/resources/file.d.ts.map +0 -1
  258. package/resources/file.js +0 -21
  259. package/resources/file.js.map +0 -1
  260. package/resources/file.mjs +0 -17
  261. package/resources/file.mjs.map +0 -1
  262. package/resources/find.d.mts +0 -60
  263. package/resources/find.d.mts.map +0 -1
  264. package/resources/find.d.ts +0 -60
  265. package/resources/find.d.ts.map +0 -1
  266. package/resources/find.js +0 -27
  267. package/resources/find.js.map +0 -1
  268. package/resources/find.mjs +0 -23
  269. package/resources/find.mjs.map +0 -1
  270. package/resources/session.d.mts +0 -215
  271. package/resources/session.d.mts.map +0 -1
  272. package/resources/session.d.ts +0 -215
  273. package/resources/session.d.ts.map +0 -1
  274. package/resources/session.js +0 -70
  275. package/resources/session.js.map +0 -1
  276. package/resources/session.mjs +0 -66
  277. package/resources/session.mjs.map +0 -1
  278. package/resources/shared.d.mts +0 -20
  279. package/resources/shared.d.mts.map +0 -1
  280. package/resources/shared.d.ts +0 -20
  281. package/resources/shared.d.ts.map +0 -1
  282. package/resources/shared.js +0 -4
  283. package/resources/shared.js.map +0 -1
  284. package/resources/shared.mjs +0 -3
  285. package/resources/shared.mjs.map +0 -1
  286. package/src/core/streaming.ts +0 -301
  287. package/src/internal/decoders/line.ts +0 -135
  288. package/src/resources/app.ts +0 -57
  289. package/src/resources/config.ts +0 -409
  290. package/src/resources/file.ts +0 -53
  291. package/src/resources/find.ts +0 -95
  292. package/src/resources/session.ts +0 -369
  293. package/src/resources/shared.ts +0 -27
  294. package/src/streaming.ts +0 -2
  295. package/streaming.d.mts +0 -2
  296. package/streaming.d.mts.map +0 -1
  297. package/streaming.d.ts +0 -2
  298. package/streaming.d.ts.map +0 -1
  299. package/streaming.js +0 -6
  300. package/streaming.js.map +0 -1
  301. package/streaming.mjs +0 -2
  302. package/streaming.mjs.map +0 -1
package/src/client.ts CHANGED
@@ -16,52 +16,42 @@ import * as Errors from './core/error';
16
16
  import * as Uploads from './core/uploads';
17
17
  import * as API from './resources/index';
18
18
  import { APIPromise } from './core/api-promise';
19
- import { App, AppInitResponse, AppResource } from './resources/app';
20
- import {
21
- Config,
22
- ConfigProvidersResponse,
23
- ConfigResource,
24
- Keybinds,
25
- McpLocal,
26
- McpRemote,
27
- Model,
28
- Provider,
29
- } from './resources/config';
19
+ import { AppInfo, AppInfoCreateResponse } from './resources/app-info';
20
+ import { AppInitialize, AppInitializeInitializeResponse } from './resources/app-initialize';
21
+ import { ConfigGet, ConfigGetRetrieveResponse } from './resources/config-get';
30
22
  import { Event, EventListResponse } from './resources/event';
31
- import { File, FileReadParams, FileReadResponse, FileStatusResponse } from './resources/file';
32
- import {
33
- Find,
34
- FindFilesParams,
35
- FindFilesResponse,
36
- FindSymbolsParams,
37
- FindSymbolsResponse,
38
- FindTextParams,
39
- FindTextResponse,
40
- } from './resources/find';
23
+ import { FileSearch, FileSearchSearchParams, FileSearchSearchResponse } from './resources/file-search';
24
+ import { InstallationInfo, InstallationInfoCreateResponse } from './resources/installation-info';
25
+ import { PathGet, PathGetCreateResponse } from './resources/path-get';
26
+ import { ProviderList, ProviderListCreateResponse } from './resources/provider-list';
27
+ import { SessionAbort, SessionAbortAbortParams, SessionAbortAbortResponse } from './resources/session-abort';
41
28
  import {
42
- FilePart,
43
- Message,
29
+ MessageInfo,
44
30
  MessagePart,
45
- ReasoningPart,
46
- Session,
47
- SessionAbortResponse,
48
- SessionChatParams,
49
- SessionDeleteResponse,
50
- SessionInitParams,
51
- SessionInitResponse,
52
- SessionListResponse,
53
- SessionMessagesResponse,
54
- SessionResource,
55
- SessionSummarizeParams,
56
- SessionSummarizeResponse,
57
- SourceURLPart,
58
- StepStartPart,
59
- TextPart,
60
- ToolCall,
61
- ToolInvocationPart,
62
- ToolPartialCall,
63
- ToolResult,
64
- } from './resources/session';
31
+ ProviderAuthError,
32
+ SessionChat,
33
+ SessionChatCreateParams,
34
+ UnknownError,
35
+ } from './resources/session-chat';
36
+ import { SessionCreate, SessionInfo } from './resources/session-create';
37
+ import {
38
+ SessionInitialize,
39
+ SessionInitializeCreateParams,
40
+ SessionInitializeCreateResponse,
41
+ } from './resources/session-initialize';
42
+ import { SessionList, SessionListCreateResponse } from './resources/session-list';
43
+ import {
44
+ SessionMessageCreateParams,
45
+ SessionMessageCreateResponse,
46
+ SessionMessages,
47
+ } from './resources/session-messages';
48
+ import { SessionShare, SessionShareCreateParams } from './resources/session-share';
49
+ import {
50
+ SessionSummarize,
51
+ SessionSummarizeSummarizeParams,
52
+ SessionSummarizeSummarizeResponse,
53
+ } from './resources/session-summarize';
54
+ import { SessionUnshare, SessionUnshareUnshareParams } from './resources/session-unshare';
65
55
  import { type Fetch } from './internal/builtin-types';
66
56
  import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
67
57
  import { FinalRequestOptions, RequestOptions } from './internal/request-options';
@@ -728,78 +718,110 @@ export class Opencode {
728
718
  static toFile = Uploads.toFile;
729
719
 
730
720
  event: API.Event = new API.Event(this);
731
- app: API.AppResource = new API.AppResource(this);
732
- find: API.Find = new API.Find(this);
733
- file: API.File = new API.File(this);
734
- config: API.ConfigResource = new API.ConfigResource(this);
735
- session: API.SessionResource = new API.SessionResource(this);
721
+ appInfo: API.AppInfo = new API.AppInfo(this);
722
+ configGet: API.ConfigGet = new API.ConfigGet(this);
723
+ appInitialize: API.AppInitialize = new API.AppInitialize(this);
724
+ sessionInitialize: API.SessionInitialize = new API.SessionInitialize(this);
725
+ pathGet: API.PathGet = new API.PathGet(this);
726
+ sessionCreate: API.SessionCreate = new API.SessionCreate(this);
727
+ sessionShare: API.SessionShare = new API.SessionShare(this);
728
+ sessionUnshare: API.SessionUnshare = new API.SessionUnshare(this);
729
+ sessionMessages: API.SessionMessages = new API.SessionMessages(this);
730
+ sessionList: API.SessionList = new API.SessionList(this);
731
+ sessionAbort: API.SessionAbort = new API.SessionAbort(this);
732
+ sessionSummarize: API.SessionSummarize = new API.SessionSummarize(this);
733
+ sessionChat: API.SessionChat = new API.SessionChat(this);
734
+ providerList: API.ProviderList = new API.ProviderList(this);
735
+ fileSearch: API.FileSearch = new API.FileSearch(this);
736
+ installationInfo: API.InstallationInfo = new API.InstallationInfo(this);
736
737
  }
737
738
  Opencode.Event = Event;
738
- Opencode.AppResource = AppResource;
739
- Opencode.Find = Find;
740
- Opencode.File = File;
741
- Opencode.ConfigResource = ConfigResource;
742
- Opencode.SessionResource = SessionResource;
739
+ Opencode.AppInfo = AppInfo;
740
+ Opencode.ConfigGet = ConfigGet;
741
+ Opencode.AppInitialize = AppInitialize;
742
+ Opencode.SessionInitialize = SessionInitialize;
743
+ Opencode.PathGet = PathGet;
744
+ Opencode.SessionCreate = SessionCreate;
745
+ Opencode.SessionShare = SessionShare;
746
+ Opencode.SessionUnshare = SessionUnshare;
747
+ Opencode.SessionMessages = SessionMessages;
748
+ Opencode.SessionList = SessionList;
749
+ Opencode.SessionAbort = SessionAbort;
750
+ Opencode.SessionSummarize = SessionSummarize;
751
+ Opencode.SessionChat = SessionChat;
752
+ Opencode.ProviderList = ProviderList;
753
+ Opencode.FileSearch = FileSearch;
754
+ Opencode.InstallationInfo = InstallationInfo;
743
755
  export declare namespace Opencode {
744
756
  export type RequestOptions = Opts.RequestOptions;
745
757
 
746
758
  export { Event as Event, type EventListResponse as EventListResponse };
747
759
 
748
- export { AppResource as AppResource, type App as App, type AppInitResponse as AppInitResponse };
760
+ export { AppInfo as AppInfo, type AppInfoCreateResponse as AppInfoCreateResponse };
761
+
762
+ export { ConfigGet as ConfigGet, type ConfigGetRetrieveResponse as ConfigGetRetrieveResponse };
749
763
 
750
764
  export {
751
- Find as Find,
752
- type FindFilesResponse as FindFilesResponse,
753
- type FindSymbolsResponse as FindSymbolsResponse,
754
- type FindTextResponse as FindTextResponse,
755
- type FindFilesParams as FindFilesParams,
756
- type FindSymbolsParams as FindSymbolsParams,
757
- type FindTextParams as FindTextParams,
765
+ AppInitialize as AppInitialize,
766
+ type AppInitializeInitializeResponse as AppInitializeInitializeResponse,
758
767
  };
759
768
 
760
769
  export {
761
- File as File,
762
- type FileReadResponse as FileReadResponse,
763
- type FileStatusResponse as FileStatusResponse,
764
- type FileReadParams as FileReadParams,
770
+ SessionInitialize as SessionInitialize,
771
+ type SessionInitializeCreateResponse as SessionInitializeCreateResponse,
772
+ type SessionInitializeCreateParams as SessionInitializeCreateParams,
773
+ };
774
+
775
+ export { PathGet as PathGet, type PathGetCreateResponse as PathGetCreateResponse };
776
+
777
+ export { SessionCreate as SessionCreate, type SessionInfo as SessionInfo };
778
+
779
+ export { SessionShare as SessionShare, type SessionShareCreateParams as SessionShareCreateParams };
780
+
781
+ export {
782
+ SessionUnshare as SessionUnshare,
783
+ type SessionUnshareUnshareParams as SessionUnshareUnshareParams,
765
784
  };
766
785
 
767
786
  export {
768
- ConfigResource as ConfigResource,
769
- type Config as Config,
770
- type Keybinds as Keybinds,
771
- type McpLocal as McpLocal,
772
- type McpRemote as McpRemote,
773
- type Model as Model,
774
- type Provider as Provider,
775
- type ConfigProvidersResponse as ConfigProvidersResponse,
787
+ SessionMessages as SessionMessages,
788
+ type SessionMessageCreateResponse as SessionMessageCreateResponse,
789
+ type SessionMessageCreateParams as SessionMessageCreateParams,
776
790
  };
777
791
 
792
+ export { SessionList as SessionList, type SessionListCreateResponse as SessionListCreateResponse };
793
+
778
794
  export {
779
- SessionResource as SessionResource,
780
- type FilePart as FilePart,
781
- type Message as Message,
795
+ SessionAbort as SessionAbort,
796
+ type SessionAbortAbortResponse as SessionAbortAbortResponse,
797
+ type SessionAbortAbortParams as SessionAbortAbortParams,
798
+ };
799
+
800
+ export {
801
+ SessionSummarize as SessionSummarize,
802
+ type SessionSummarizeSummarizeResponse as SessionSummarizeSummarizeResponse,
803
+ type SessionSummarizeSummarizeParams as SessionSummarizeSummarizeParams,
804
+ };
805
+
806
+ export {
807
+ SessionChat as SessionChat,
808
+ type MessageInfo as MessageInfo,
782
809
  type MessagePart as MessagePart,
783
- type ReasoningPart as ReasoningPart,
784
- type Session as Session,
785
- type SourceURLPart as SourceURLPart,
786
- type StepStartPart as StepStartPart,
787
- type TextPart as TextPart,
788
- type ToolCall as ToolCall,
789
- type ToolInvocationPart as ToolInvocationPart,
790
- type ToolPartialCall as ToolPartialCall,
791
- type ToolResult as ToolResult,
792
- type SessionListResponse as SessionListResponse,
793
- type SessionDeleteResponse as SessionDeleteResponse,
794
- type SessionAbortResponse as SessionAbortResponse,
795
- type SessionInitResponse as SessionInitResponse,
796
- type SessionMessagesResponse as SessionMessagesResponse,
797
- type SessionSummarizeResponse as SessionSummarizeResponse,
798
- type SessionChatParams as SessionChatParams,
799
- type SessionInitParams as SessionInitParams,
800
- type SessionSummarizeParams as SessionSummarizeParams,
810
+ type ProviderAuthError as ProviderAuthError,
811
+ type UnknownError as UnknownError,
812
+ type SessionChatCreateParams as SessionChatCreateParams,
801
813
  };
802
814
 
803
- export type ProviderAuthError = API.ProviderAuthError;
804
- export type UnknownError = API.UnknownError;
815
+ export { ProviderList as ProviderList, type ProviderListCreateResponse as ProviderListCreateResponse };
816
+
817
+ export {
818
+ FileSearch as FileSearch,
819
+ type FileSearchSearchResponse as FileSearchSearchResponse,
820
+ type FileSearchSearchParams as FileSearchSearchParams,
821
+ };
822
+
823
+ export {
824
+ InstallationInfo as InstallationInfo,
825
+ type InstallationInfoCreateResponse as InstallationInfoCreateResponse,
826
+ };
805
827
  }
@@ -1,7 +1,6 @@
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';
5
4
  import { type Opencode } from '../client';
6
5
  import { formatRequestDetails, loggerFor } from './utils/log';
7
6
 
@@ -17,19 +16,6 @@ export type APIResponseProps = {
17
16
  export async function defaultParseResponse<T>(client: Opencode, props: APIResponseProps): Promise<T> {
18
17
  const { response, requestLogID, retryOfRequestLogID, startTime } = props;
19
18
  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) as any;
28
- }
29
-
30
- return Stream.fromSSEResponse(response, props.controller) as any;
31
- }
32
-
33
19
  // fetch refuses to read the body when the status code is 204.
34
20
  if (response.status === 204) {
35
21
  return null as T;
@@ -3,7 +3,6 @@
3
3
  import { NullableHeaders } from './headers';
4
4
 
5
5
  import type { BodyInit } from './builtin-types';
6
- import { Stream } from '../core/streaming';
7
6
  import type { HTTPMethod, MergedRequestInit } from './types';
8
7
  import { type HeadersLike } from './headers';
9
8
 
@@ -24,7 +23,6 @@ export type RequestOptions = {
24
23
  defaultBaseURL?: string | undefined;
25
24
 
26
25
  __binaryResponse?: boolean | undefined;
27
- __streamClass?: typeof Stream;
28
26
  };
29
27
 
30
28
  export type EncodedContent = { bodyHeaders: HeadersLike; body: BodyInit };
@@ -7,7 +7,7 @@ export type KeysEnum<T> = { [P in keyof Required<T>]: true };
7
7
 
8
8
  export type FinalizedRequestInit = RequestInit & { headers: Headers };
9
9
 
10
- type NotAny<T> = [0] extends [1 & T] ? never : T;
10
+ type NotAny<T> = [unknown] extends [T] ? never : T;
11
11
 
12
12
  /**
13
13
  * Some environments overload the global fetch function, and Parameters<T> only gets the last signature.
@@ -64,15 +64,13 @@ type OverloadedParameters<T> =
64
64
  * [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition
65
65
  */
66
66
  /** @ts-ignore For users with \@types/node */
67
- type UndiciTypesRequestInit = NotAny<import('../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit>;
67
+ type UndiciTypesRequestInit = NotAny<import('../node_modules/undici-types').RequestInit> | NotAny<import('../../node_modules/undici-types').RequestInit> | NotAny<import('../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici-types').RequestInit>;
68
68
  /** @ts-ignore For users with undici */
69
- type UndiciRequestInit = NotAny<import('../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici/index.d.ts').RequestInit>;
69
+ type UndiciRequestInit = NotAny<import('../node_modules/undici').RequestInit> | NotAny<import('../../node_modules/undici').RequestInit> | NotAny<import('../../../node_modules/undici').RequestInit> | NotAny<import('../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici').RequestInit>;
70
70
  /** @ts-ignore For users with \@types/bun */
71
71
  type BunRequestInit = globalThis.FetchRequestInit;
72
- /** @ts-ignore For users with node-fetch@2 */
73
- type NodeFetch2RequestInit = NotAny<import('../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit>;
74
- /** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */
75
- type NodeFetch3RequestInit = NotAny<import('../node_modules/node-fetch').RequestInit> | NotAny<import('../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/node-fetch').RequestInit>;
72
+ /** @ts-ignore For users with node-fetch */
73
+ type NodeFetchRequestInit = NotAny<import('../node_modules/node-fetch').RequestInit> | NotAny<import('../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/node-fetch').RequestInit>;
76
74
  /** @ts-ignore For users who use Deno */
77
75
  type FetchRequestInit = NonNullable<OverloadedParameters<typeof fetch>[1]>;
78
76
  /* eslint-enable */
@@ -81,8 +79,7 @@ type RequestInits =
81
79
  | NotAny<UndiciTypesRequestInit>
82
80
  | NotAny<UndiciRequestInit>
83
81
  | NotAny<BunRequestInit>
84
- | NotAny<NodeFetch2RequestInit>
85
- | NotAny<NodeFetch3RequestInit>
82
+ | NotAny<NodeFetchRequestInit>
86
83
  | NotAny<RequestInit>
87
84
  | NotAny<FetchRequestInit>;
88
85
 
@@ -90,7 +90,7 @@ export const multipartFormRequestOptions = async (
90
90
  return { ...opts, body: await createForm(opts.body, fetch) };
91
91
  };
92
92
 
93
- const supportsFormDataMap = /* @__PURE__ */ new WeakMap<Fetch, Promise<boolean>>();
93
+ const supportsFormDataMap = /** @__PURE__ */ new WeakMap<Fetch, Promise<boolean>>();
94
94
 
95
95
  /**
96
96
  * node-fetch doesn't support the global FormData object in recent node versions. Instead of sending
@@ -58,7 +58,7 @@ const noopLogger = {
58
58
  debug: noop,
59
59
  };
60
60
 
61
- let cachedLoggers = /* @__PURE__ */ new WeakMap<Logger, [LogLevel, Logger]>();
61
+ let cachedLoggers = /** @__PURE__ */ new WeakMap<Logger, [LogLevel, Logger]>();
62
62
 
63
63
  export function loggerFor(client: Opencode): Logger {
64
64
  const logger = client.logger;
@@ -12,43 +12,25 @@ export function encodeURIPath(str: string) {
12
12
  return str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
13
13
  }
14
14
 
15
- const EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
16
-
17
15
  export const createPathTagFunction = (pathEncoder = encodeURIPath) =>
18
16
  function path(statics: readonly string[], ...params: readonly unknown[]): string {
19
17
  // If there are no params, no processing is needed.
20
18
  if (statics.length === 1) return statics[0]!;
21
19
 
22
20
  let postPath = false;
23
- const invalidSegments = [];
24
21
  const path = statics.reduce((previousValue, currentValue, index) => {
25
22
  if (/[?#]/.test(currentValue)) {
26
23
  postPath = true;
27
24
  }
28
- const value = params[index];
29
- let encoded = (postPath ? encodeURIComponent : pathEncoder)('' + value);
30
- if (
31
- index !== params.length &&
32
- (value == null ||
33
- (typeof value === 'object' &&
34
- // handle values from other realms
35
- value.toString ===
36
- Object.getPrototypeOf(Object.getPrototypeOf((value as any).hasOwnProperty ?? EMPTY) ?? EMPTY)
37
- ?.toString))
38
- ) {
39
- encoded = value + '';
40
- invalidSegments.push({
41
- start: previousValue.length + currentValue.length,
42
- length: encoded.length,
43
- error: `Value of type ${Object.prototype.toString
44
- .call(value)
45
- .slice(8, -1)} is not a valid path parameter`,
46
- });
47
- }
48
- return previousValue + currentValue + (index === params.length ? '' : encoded);
25
+ return (
26
+ previousValue +
27
+ currentValue +
28
+ (index === params.length ? '' : (postPath ? encodeURIComponent : pathEncoder)(String(params[index])))
29
+ );
49
30
  }, '');
50
31
 
51
32
  const pathOnly = path.split(/[?#]/, 1)[0]!;
33
+ const invalidSegments = [];
52
34
  const invalidSegmentPattern = /(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
53
35
  let match;
54
36
 
@@ -57,12 +39,9 @@ export const createPathTagFunction = (pathEncoder = encodeURIPath) =>
57
39
  invalidSegments.push({
58
40
  start: match.index,
59
41
  length: match[0].length,
60
- error: `Value "${match[0]}" can\'t be safely passed as a path parameter`,
61
42
  });
62
43
  }
63
44
 
64
- invalidSegments.sort((a, b) => a.start - b.start);
65
-
66
45
  if (invalidSegments.length > 0) {
67
46
  let lastEnd = 0;
68
47
  const underline = invalidSegments.reduce((acc, segment) => {
@@ -72,11 +51,7 @@ export const createPathTagFunction = (pathEncoder = encodeURIPath) =>
72
51
  return acc + spaces + arrows;
73
52
  }, '');
74
53
 
75
- throw new OpencodeError(
76
- `Path parameters result in path with invalid segments:\n${invalidSegments
77
- .map((e) => e.error)
78
- .join('\n')}\n${path}\n${underline}`,
79
- );
54
+ throw new OpencodeError(`Path parameters result in path with invalid segments:\n${path}\n${underline}`);
80
55
  }
81
56
 
82
57
  return path;
@@ -0,0 +1,46 @@
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 { RequestOptions } from '../internal/request-options';
6
+
7
+ export class AppInfo extends APIResource {
8
+ /**
9
+ * Get app info
10
+ */
11
+ create(options?: RequestOptions): APIPromise<AppInfoCreateResponse> {
12
+ return this._client.post('/app_info', options);
13
+ }
14
+ }
15
+
16
+ export interface AppInfoCreateResponse {
17
+ git: boolean;
18
+
19
+ path: AppInfoCreateResponse.Path;
20
+
21
+ time: AppInfoCreateResponse.Time;
22
+
23
+ user: string;
24
+ }
25
+
26
+ export namespace AppInfoCreateResponse {
27
+ export interface Path {
28
+ config: string;
29
+
30
+ cwd: string;
31
+
32
+ data: string;
33
+
34
+ root: string;
35
+
36
+ state: string;
37
+ }
38
+
39
+ export interface Time {
40
+ initialized?: number;
41
+ }
42
+ }
43
+
44
+ export declare namespace AppInfo {
45
+ export { type AppInfoCreateResponse as AppInfoCreateResponse };
46
+ }
@@ -0,0 +1,20 @@
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 { RequestOptions } from '../internal/request-options';
6
+
7
+ export class AppInitialize extends APIResource {
8
+ /**
9
+ * Initialize the app
10
+ */
11
+ initialize(options?: RequestOptions): APIPromise<AppInitializeInitializeResponse> {
12
+ return this._client.post('/app_initialize', options);
13
+ }
14
+ }
15
+
16
+ export type AppInitializeInitializeResponse = boolean;
17
+
18
+ export declare namespace AppInitialize {
19
+ export { type AppInitializeInitializeResponse as AppInitializeInitializeResponse };
20
+ }