@ex-machina/opencode-sdk 1.1.25-exmachina.1

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 (71) hide show
  1. package/client.d.ts +7 -0
  2. package/client.js +25 -0
  3. package/gen/client/client.gen.d.ts +2 -0
  4. package/gen/client/client.gen.js +165 -0
  5. package/gen/client/index.d.ts +7 -0
  6. package/gen/client/index.js +5 -0
  7. package/gen/client/types.gen.d.ts +127 -0
  8. package/gen/client/types.gen.js +2 -0
  9. package/gen/client/utils.gen.d.ts +38 -0
  10. package/gen/client/utils.gen.js +226 -0
  11. package/gen/client.gen.d.ts +12 -0
  12. package/gen/client.gen.js +5 -0
  13. package/gen/core/auth.gen.d.ts +18 -0
  14. package/gen/core/auth.gen.js +14 -0
  15. package/gen/core/bodySerializer.gen.d.ts +17 -0
  16. package/gen/core/bodySerializer.gen.js +57 -0
  17. package/gen/core/params.gen.d.ts +33 -0
  18. package/gen/core/params.gen.js +89 -0
  19. package/gen/core/pathSerializer.gen.d.ts +33 -0
  20. package/gen/core/pathSerializer.gen.js +106 -0
  21. package/gen/core/serverSentEvents.gen.d.ts +59 -0
  22. package/gen/core/serverSentEvents.gen.js +117 -0
  23. package/gen/core/types.gen.d.ts +78 -0
  24. package/gen/core/types.gen.js +2 -0
  25. package/gen/core/utils.gen.d.ts +14 -0
  26. package/gen/core/utils.gen.js +69 -0
  27. package/gen/sdk.gen.d.ts +403 -0
  28. package/gen/sdk.gen.js +881 -0
  29. package/gen/types.gen.d.ts +3372 -0
  30. package/gen/types.gen.js +2 -0
  31. package/index.d.ts +10 -0
  32. package/index.js +16 -0
  33. package/package.json +16 -0
  34. package/server.d.ts +23 -0
  35. package/server.js +94 -0
  36. package/v2/client.d.ts +7 -0
  37. package/v2/client.js +27 -0
  38. package/v2/gen/client/client.gen.d.ts +2 -0
  39. package/v2/gen/client/client.gen.js +232 -0
  40. package/v2/gen/client/index.d.ts +8 -0
  41. package/v2/gen/client/index.js +6 -0
  42. package/v2/gen/client/types.gen.d.ts +117 -0
  43. package/v2/gen/client/types.gen.js +2 -0
  44. package/v2/gen/client/utils.gen.d.ts +33 -0
  45. package/v2/gen/client/utils.gen.js +226 -0
  46. package/v2/gen/client.gen.d.ts +12 -0
  47. package/v2/gen/client.gen.js +3 -0
  48. package/v2/gen/core/auth.gen.d.ts +18 -0
  49. package/v2/gen/core/auth.gen.js +14 -0
  50. package/v2/gen/core/bodySerializer.gen.d.ts +25 -0
  51. package/v2/gen/core/bodySerializer.gen.js +57 -0
  52. package/v2/gen/core/params.gen.d.ts +43 -0
  53. package/v2/gen/core/params.gen.js +102 -0
  54. package/v2/gen/core/pathSerializer.gen.d.ts +33 -0
  55. package/v2/gen/core/pathSerializer.gen.js +106 -0
  56. package/v2/gen/core/queryKeySerializer.gen.d.ts +18 -0
  57. package/v2/gen/core/queryKeySerializer.gen.js +93 -0
  58. package/v2/gen/core/serverSentEvents.gen.d.ts +71 -0
  59. package/v2/gen/core/serverSentEvents.gen.js +133 -0
  60. package/v2/gen/core/types.gen.d.ts +78 -0
  61. package/v2/gen/core/types.gen.js +2 -0
  62. package/v2/gen/core/utils.gen.d.ts +19 -0
  63. package/v2/gen/core/utils.gen.js +87 -0
  64. package/v2/gen/sdk.gen.d.ts +1062 -0
  65. package/v2/gen/sdk.gen.js +2059 -0
  66. package/v2/gen/types.gen.d.ts +4226 -0
  67. package/v2/gen/types.gen.js +2 -0
  68. package/v2/index.d.ts +10 -0
  69. package/v2/index.js +16 -0
  70. package/v2/server.d.ts +23 -0
  71. package/v2/server.js +94 -0
@@ -0,0 +1,2059 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ import { client } from "./client.gen.js";
3
+ import { buildClientParams } from "./client/index.js";
4
+ class HeyApiClient {
5
+ client;
6
+ constructor(args) {
7
+ this.client = args?.client ?? client;
8
+ }
9
+ }
10
+ class HeyApiRegistry {
11
+ defaultKey = "default";
12
+ instances = new Map();
13
+ get(key) {
14
+ const instance = this.instances.get(key ?? this.defaultKey);
15
+ if (!instance) {
16
+ throw new Error(`No SDK client found. Create one with "new OpencodeClient()" to fix this error.`);
17
+ }
18
+ return instance;
19
+ }
20
+ set(value, key) {
21
+ this.instances.set(key ?? this.defaultKey, value);
22
+ }
23
+ }
24
+ export class Global extends HeyApiClient {
25
+ /**
26
+ * Get health
27
+ *
28
+ * Get health information about the OpenCode server.
29
+ */
30
+ health(options) {
31
+ return (options?.client ?? this.client).get({
32
+ url: "/global/health",
33
+ ...options,
34
+ });
35
+ }
36
+ /**
37
+ * Get global events
38
+ *
39
+ * Subscribe to global events from the OpenCode system using server-sent events.
40
+ */
41
+ event(options) {
42
+ return (options?.client ?? this.client).sse.get({
43
+ url: "/global/event",
44
+ ...options,
45
+ });
46
+ }
47
+ /**
48
+ * Dispose instance
49
+ *
50
+ * Clean up and dispose all OpenCode instances, releasing all resources.
51
+ */
52
+ dispose(options) {
53
+ return (options?.client ?? this.client).post({
54
+ url: "/global/dispose",
55
+ ...options,
56
+ });
57
+ }
58
+ }
59
+ export class Project extends HeyApiClient {
60
+ /**
61
+ * List all projects
62
+ *
63
+ * Get a list of projects that have been opened with OpenCode.
64
+ */
65
+ list(parameters, options) {
66
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
67
+ return (options?.client ?? this.client).get({
68
+ url: "/project",
69
+ ...options,
70
+ ...params,
71
+ });
72
+ }
73
+ /**
74
+ * Get current project
75
+ *
76
+ * Retrieve the currently active project that OpenCode is working with.
77
+ */
78
+ current(parameters, options) {
79
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
80
+ return (options?.client ?? this.client).get({
81
+ url: "/project/current",
82
+ ...options,
83
+ ...params,
84
+ });
85
+ }
86
+ /**
87
+ * Update project
88
+ *
89
+ * Update project properties such as name, icon and color.
90
+ */
91
+ update(parameters, options) {
92
+ const params = buildClientParams([parameters], [
93
+ {
94
+ args: [
95
+ { in: "path", key: "projectID" },
96
+ { in: "query", key: "directory" },
97
+ { in: "body", key: "name" },
98
+ { in: "body", key: "icon" },
99
+ ],
100
+ },
101
+ ]);
102
+ return (options?.client ?? this.client).patch({
103
+ url: "/project/{projectID}",
104
+ ...options,
105
+ ...params,
106
+ headers: {
107
+ "Content-Type": "application/json",
108
+ ...options?.headers,
109
+ ...params.headers,
110
+ },
111
+ });
112
+ }
113
+ }
114
+ export class Pty extends HeyApiClient {
115
+ /**
116
+ * List PTY sessions
117
+ *
118
+ * Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode.
119
+ */
120
+ list(parameters, options) {
121
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
122
+ return (options?.client ?? this.client).get({
123
+ url: "/pty",
124
+ ...options,
125
+ ...params,
126
+ });
127
+ }
128
+ /**
129
+ * Create PTY session
130
+ *
131
+ * Create a new pseudo-terminal (PTY) session for running shell commands and processes.
132
+ */
133
+ create(parameters, options) {
134
+ const params = buildClientParams([parameters], [
135
+ {
136
+ args: [
137
+ { in: "query", key: "directory" },
138
+ { in: "body", key: "command" },
139
+ { in: "body", key: "args" },
140
+ { in: "body", key: "cwd" },
141
+ { in: "body", key: "title" },
142
+ { in: "body", key: "env" },
143
+ ],
144
+ },
145
+ ]);
146
+ return (options?.client ?? this.client).post({
147
+ url: "/pty",
148
+ ...options,
149
+ ...params,
150
+ headers: {
151
+ "Content-Type": "application/json",
152
+ ...options?.headers,
153
+ ...params.headers,
154
+ },
155
+ });
156
+ }
157
+ /**
158
+ * Remove PTY session
159
+ *
160
+ * Remove and terminate a specific pseudo-terminal (PTY) session.
161
+ */
162
+ remove(parameters, options) {
163
+ const params = buildClientParams([parameters], [
164
+ {
165
+ args: [
166
+ { in: "path", key: "ptyID" },
167
+ { in: "query", key: "directory" },
168
+ ],
169
+ },
170
+ ]);
171
+ return (options?.client ?? this.client).delete({
172
+ url: "/pty/{ptyID}",
173
+ ...options,
174
+ ...params,
175
+ });
176
+ }
177
+ /**
178
+ * Get PTY session
179
+ *
180
+ * Retrieve detailed information about a specific pseudo-terminal (PTY) session.
181
+ */
182
+ get(parameters, options) {
183
+ const params = buildClientParams([parameters], [
184
+ {
185
+ args: [
186
+ { in: "path", key: "ptyID" },
187
+ { in: "query", key: "directory" },
188
+ ],
189
+ },
190
+ ]);
191
+ return (options?.client ?? this.client).get({
192
+ url: "/pty/{ptyID}",
193
+ ...options,
194
+ ...params,
195
+ });
196
+ }
197
+ /**
198
+ * Update PTY session
199
+ *
200
+ * Update properties of an existing pseudo-terminal (PTY) session.
201
+ */
202
+ update(parameters, options) {
203
+ const params = buildClientParams([parameters], [
204
+ {
205
+ args: [
206
+ { in: "path", key: "ptyID" },
207
+ { in: "query", key: "directory" },
208
+ { in: "body", key: "title" },
209
+ { in: "body", key: "size" },
210
+ ],
211
+ },
212
+ ]);
213
+ return (options?.client ?? this.client).put({
214
+ url: "/pty/{ptyID}",
215
+ ...options,
216
+ ...params,
217
+ headers: {
218
+ "Content-Type": "application/json",
219
+ ...options?.headers,
220
+ ...params.headers,
221
+ },
222
+ });
223
+ }
224
+ /**
225
+ * Connect to PTY session
226
+ *
227
+ * Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.
228
+ */
229
+ connect(parameters, options) {
230
+ const params = buildClientParams([parameters], [
231
+ {
232
+ args: [
233
+ { in: "path", key: "ptyID" },
234
+ { in: "query", key: "directory" },
235
+ ],
236
+ },
237
+ ]);
238
+ return (options?.client ?? this.client).get({
239
+ url: "/pty/{ptyID}/connect",
240
+ ...options,
241
+ ...params,
242
+ });
243
+ }
244
+ }
245
+ export class Config extends HeyApiClient {
246
+ /**
247
+ * Get configuration
248
+ *
249
+ * Retrieve the current OpenCode configuration settings and preferences.
250
+ */
251
+ get(parameters, options) {
252
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
253
+ return (options?.client ?? this.client).get({
254
+ url: "/config",
255
+ ...options,
256
+ ...params,
257
+ });
258
+ }
259
+ /**
260
+ * Update configuration
261
+ *
262
+ * Update OpenCode configuration settings and preferences.
263
+ */
264
+ update(parameters, options) {
265
+ const params = buildClientParams([parameters], [
266
+ {
267
+ args: [
268
+ { in: "query", key: "directory" },
269
+ { key: "config", map: "body" },
270
+ ],
271
+ },
272
+ ]);
273
+ return (options?.client ?? this.client).patch({
274
+ url: "/config",
275
+ ...options,
276
+ ...params,
277
+ headers: {
278
+ "Content-Type": "application/json",
279
+ ...options?.headers,
280
+ ...params.headers,
281
+ },
282
+ });
283
+ }
284
+ /**
285
+ * List config providers
286
+ *
287
+ * Get a list of all configured AI providers and their default models.
288
+ */
289
+ providers(parameters, options) {
290
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
291
+ return (options?.client ?? this.client).get({
292
+ url: "/config/providers",
293
+ ...options,
294
+ ...params,
295
+ });
296
+ }
297
+ }
298
+ export class Tool extends HeyApiClient {
299
+ /**
300
+ * List tool IDs
301
+ *
302
+ * Get a list of all available tool IDs, including both built-in tools and dynamically registered tools.
303
+ */
304
+ ids(parameters, options) {
305
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
306
+ return (options?.client ?? this.client).get({
307
+ url: "/experimental/tool/ids",
308
+ ...options,
309
+ ...params,
310
+ });
311
+ }
312
+ /**
313
+ * List tools
314
+ *
315
+ * Get a list of available tools with their JSON schema parameters for a specific provider and model combination.
316
+ */
317
+ list(parameters, options) {
318
+ const params = buildClientParams([parameters], [
319
+ {
320
+ args: [
321
+ { in: "query", key: "directory" },
322
+ { in: "query", key: "provider" },
323
+ { in: "query", key: "model" },
324
+ ],
325
+ },
326
+ ]);
327
+ return (options?.client ?? this.client).get({
328
+ url: "/experimental/tool",
329
+ ...options,
330
+ ...params,
331
+ });
332
+ }
333
+ }
334
+ export class Worktree extends HeyApiClient {
335
+ /**
336
+ * List worktrees
337
+ *
338
+ * List all sandbox worktrees for the current project.
339
+ */
340
+ list(parameters, options) {
341
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
342
+ return (options?.client ?? this.client).get({
343
+ url: "/experimental/worktree",
344
+ ...options,
345
+ ...params,
346
+ });
347
+ }
348
+ /**
349
+ * Create worktree
350
+ *
351
+ * Create a new git worktree for the current project.
352
+ */
353
+ create(parameters, options) {
354
+ const params = buildClientParams([parameters], [
355
+ {
356
+ args: [
357
+ { in: "query", key: "directory" },
358
+ { key: "worktreeCreateInput", map: "body" },
359
+ ],
360
+ },
361
+ ]);
362
+ return (options?.client ?? this.client).post({
363
+ url: "/experimental/worktree",
364
+ ...options,
365
+ ...params,
366
+ headers: {
367
+ "Content-Type": "application/json",
368
+ ...options?.headers,
369
+ ...params.headers,
370
+ },
371
+ });
372
+ }
373
+ }
374
+ export class Resource extends HeyApiClient {
375
+ /**
376
+ * Get MCP resources
377
+ *
378
+ * Get all available MCP resources from connected servers. Optionally filter by name.
379
+ */
380
+ list(parameters, options) {
381
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
382
+ return (options?.client ?? this.client).get({
383
+ url: "/experimental/resource",
384
+ ...options,
385
+ ...params,
386
+ });
387
+ }
388
+ }
389
+ export class Experimental extends HeyApiClient {
390
+ _resource;
391
+ get resource() {
392
+ return (this._resource ??= new Resource({ client: this.client }));
393
+ }
394
+ }
395
+ export class Session extends HeyApiClient {
396
+ /**
397
+ * List sessions
398
+ *
399
+ * Get a list of all OpenCode sessions, sorted by most recently updated.
400
+ */
401
+ list(parameters, options) {
402
+ const params = buildClientParams([parameters], [
403
+ {
404
+ args: [
405
+ { in: "query", key: "directory" },
406
+ { in: "query", key: "roots" },
407
+ { in: "query", key: "start" },
408
+ { in: "query", key: "search" },
409
+ { in: "query", key: "limit" },
410
+ ],
411
+ },
412
+ ]);
413
+ return (options?.client ?? this.client).get({
414
+ url: "/session",
415
+ ...options,
416
+ ...params,
417
+ });
418
+ }
419
+ /**
420
+ * Create session
421
+ *
422
+ * Create a new OpenCode session for interacting with AI assistants and managing conversations.
423
+ */
424
+ create(parameters, options) {
425
+ const params = buildClientParams([parameters], [
426
+ {
427
+ args: [
428
+ { in: "query", key: "directory" },
429
+ { in: "body", key: "parentID" },
430
+ { in: "body", key: "title" },
431
+ { in: "body", key: "permission" },
432
+ ],
433
+ },
434
+ ]);
435
+ return (options?.client ?? this.client).post({
436
+ url: "/session",
437
+ ...options,
438
+ ...params,
439
+ headers: {
440
+ "Content-Type": "application/json",
441
+ ...options?.headers,
442
+ ...params.headers,
443
+ },
444
+ });
445
+ }
446
+ /**
447
+ * Get session status
448
+ *
449
+ * Retrieve the current status of all sessions, including active, idle, and completed states.
450
+ */
451
+ status(parameters, options) {
452
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
453
+ return (options?.client ?? this.client).get({
454
+ url: "/session/status",
455
+ ...options,
456
+ ...params,
457
+ });
458
+ }
459
+ /**
460
+ * Delete session
461
+ *
462
+ * Delete a session and permanently remove all associated data, including messages and history.
463
+ */
464
+ delete(parameters, options) {
465
+ const params = buildClientParams([parameters], [
466
+ {
467
+ args: [
468
+ { in: "path", key: "sessionID" },
469
+ { in: "query", key: "directory" },
470
+ ],
471
+ },
472
+ ]);
473
+ return (options?.client ?? this.client).delete({
474
+ url: "/session/{sessionID}",
475
+ ...options,
476
+ ...params,
477
+ });
478
+ }
479
+ /**
480
+ * Get session
481
+ *
482
+ * Retrieve detailed information about a specific OpenCode session.
483
+ */
484
+ get(parameters, options) {
485
+ const params = buildClientParams([parameters], [
486
+ {
487
+ args: [
488
+ { in: "path", key: "sessionID" },
489
+ { in: "query", key: "directory" },
490
+ ],
491
+ },
492
+ ]);
493
+ return (options?.client ?? this.client).get({
494
+ url: "/session/{sessionID}",
495
+ ...options,
496
+ ...params,
497
+ });
498
+ }
499
+ /**
500
+ * Update session
501
+ *
502
+ * Update properties of an existing session, such as title or other metadata.
503
+ */
504
+ update(parameters, options) {
505
+ const params = buildClientParams([parameters], [
506
+ {
507
+ args: [
508
+ { in: "path", key: "sessionID" },
509
+ { in: "query", key: "directory" },
510
+ { in: "body", key: "title" },
511
+ { in: "body", key: "time" },
512
+ ],
513
+ },
514
+ ]);
515
+ return (options?.client ?? this.client).patch({
516
+ url: "/session/{sessionID}",
517
+ ...options,
518
+ ...params,
519
+ headers: {
520
+ "Content-Type": "application/json",
521
+ ...options?.headers,
522
+ ...params.headers,
523
+ },
524
+ });
525
+ }
526
+ /**
527
+ * Get session children
528
+ *
529
+ * Retrieve all child sessions that were forked from the specified parent session.
530
+ */
531
+ children(parameters, options) {
532
+ const params = buildClientParams([parameters], [
533
+ {
534
+ args: [
535
+ { in: "path", key: "sessionID" },
536
+ { in: "query", key: "directory" },
537
+ ],
538
+ },
539
+ ]);
540
+ return (options?.client ?? this.client).get({
541
+ url: "/session/{sessionID}/children",
542
+ ...options,
543
+ ...params,
544
+ });
545
+ }
546
+ /**
547
+ * Get session todos
548
+ *
549
+ * Retrieve the todo list associated with a specific session, showing tasks and action items.
550
+ */
551
+ todo(parameters, options) {
552
+ const params = buildClientParams([parameters], [
553
+ {
554
+ args: [
555
+ { in: "path", key: "sessionID" },
556
+ { in: "query", key: "directory" },
557
+ ],
558
+ },
559
+ ]);
560
+ return (options?.client ?? this.client).get({
561
+ url: "/session/{sessionID}/todo",
562
+ ...options,
563
+ ...params,
564
+ });
565
+ }
566
+ /**
567
+ * Initialize session
568
+ *
569
+ * Analyze the current application and create an AGENTS.md file with project-specific agent configurations.
570
+ */
571
+ init(parameters, options) {
572
+ const params = buildClientParams([parameters], [
573
+ {
574
+ args: [
575
+ { in: "path", key: "sessionID" },
576
+ { in: "query", key: "directory" },
577
+ { in: "body", key: "modelID" },
578
+ { in: "body", key: "providerID" },
579
+ { in: "body", key: "messageID" },
580
+ ],
581
+ },
582
+ ]);
583
+ return (options?.client ?? this.client).post({
584
+ url: "/session/{sessionID}/init",
585
+ ...options,
586
+ ...params,
587
+ headers: {
588
+ "Content-Type": "application/json",
589
+ ...options?.headers,
590
+ ...params.headers,
591
+ },
592
+ });
593
+ }
594
+ /**
595
+ * Fork session
596
+ *
597
+ * Create a new session by forking an existing session at a specific message point.
598
+ */
599
+ fork(parameters, options) {
600
+ const params = buildClientParams([parameters], [
601
+ {
602
+ args: [
603
+ { in: "path", key: "sessionID" },
604
+ { in: "query", key: "directory" },
605
+ { in: "body", key: "messageID" },
606
+ ],
607
+ },
608
+ ]);
609
+ return (options?.client ?? this.client).post({
610
+ url: "/session/{sessionID}/fork",
611
+ ...options,
612
+ ...params,
613
+ headers: {
614
+ "Content-Type": "application/json",
615
+ ...options?.headers,
616
+ ...params.headers,
617
+ },
618
+ });
619
+ }
620
+ /**
621
+ * Abort session
622
+ *
623
+ * Abort an active session and stop any ongoing AI processing or command execution.
624
+ */
625
+ abort(parameters, options) {
626
+ const params = buildClientParams([parameters], [
627
+ {
628
+ args: [
629
+ { in: "path", key: "sessionID" },
630
+ { in: "query", key: "directory" },
631
+ ],
632
+ },
633
+ ]);
634
+ return (options?.client ?? this.client).post({
635
+ url: "/session/{sessionID}/abort",
636
+ ...options,
637
+ ...params,
638
+ });
639
+ }
640
+ /**
641
+ * Unshare session
642
+ *
643
+ * Remove the shareable link for a session, making it private again.
644
+ */
645
+ unshare(parameters, options) {
646
+ const params = buildClientParams([parameters], [
647
+ {
648
+ args: [
649
+ { in: "path", key: "sessionID" },
650
+ { in: "query", key: "directory" },
651
+ ],
652
+ },
653
+ ]);
654
+ return (options?.client ?? this.client).delete({
655
+ url: "/session/{sessionID}/share",
656
+ ...options,
657
+ ...params,
658
+ });
659
+ }
660
+ /**
661
+ * Share session
662
+ *
663
+ * Create a shareable link for a session, allowing others to view the conversation.
664
+ */
665
+ share(parameters, options) {
666
+ const params = buildClientParams([parameters], [
667
+ {
668
+ args: [
669
+ { in: "path", key: "sessionID" },
670
+ { in: "query", key: "directory" },
671
+ ],
672
+ },
673
+ ]);
674
+ return (options?.client ?? this.client).post({
675
+ url: "/session/{sessionID}/share",
676
+ ...options,
677
+ ...params,
678
+ });
679
+ }
680
+ /**
681
+ * Get message diff
682
+ *
683
+ * Get the file changes (diff) that resulted from a specific user message in the session.
684
+ */
685
+ diff(parameters, options) {
686
+ const params = buildClientParams([parameters], [
687
+ {
688
+ args: [
689
+ { in: "path", key: "sessionID" },
690
+ { in: "query", key: "directory" },
691
+ { in: "query", key: "messageID" },
692
+ ],
693
+ },
694
+ ]);
695
+ return (options?.client ?? this.client).get({
696
+ url: "/session/{sessionID}/diff",
697
+ ...options,
698
+ ...params,
699
+ });
700
+ }
701
+ /**
702
+ * Summarize session
703
+ *
704
+ * Generate a concise summary of the session using AI compaction to preserve key information.
705
+ */
706
+ summarize(parameters, options) {
707
+ const params = buildClientParams([parameters], [
708
+ {
709
+ args: [
710
+ { in: "path", key: "sessionID" },
711
+ { in: "query", key: "directory" },
712
+ { in: "body", key: "providerID" },
713
+ { in: "body", key: "modelID" },
714
+ { in: "body", key: "auto" },
715
+ ],
716
+ },
717
+ ]);
718
+ return (options?.client ?? this.client).post({
719
+ url: "/session/{sessionID}/summarize",
720
+ ...options,
721
+ ...params,
722
+ headers: {
723
+ "Content-Type": "application/json",
724
+ ...options?.headers,
725
+ ...params.headers,
726
+ },
727
+ });
728
+ }
729
+ /**
730
+ * Get session messages
731
+ *
732
+ * Retrieve all messages in a session, including user prompts and AI responses.
733
+ */
734
+ messages(parameters, options) {
735
+ const params = buildClientParams([parameters], [
736
+ {
737
+ args: [
738
+ { in: "path", key: "sessionID" },
739
+ { in: "query", key: "directory" },
740
+ { in: "query", key: "limit" },
741
+ ],
742
+ },
743
+ ]);
744
+ return (options?.client ?? this.client).get({
745
+ url: "/session/{sessionID}/message",
746
+ ...options,
747
+ ...params,
748
+ });
749
+ }
750
+ /**
751
+ * Send message
752
+ *
753
+ * Create and send a new message to a session, streaming the AI response.
754
+ */
755
+ prompt(parameters, options) {
756
+ const params = buildClientParams([parameters], [
757
+ {
758
+ args: [
759
+ { in: "path", key: "sessionID" },
760
+ { in: "query", key: "directory" },
761
+ { in: "body", key: "messageID" },
762
+ { in: "body", key: "model" },
763
+ { in: "body", key: "agent" },
764
+ { in: "body", key: "noReply" },
765
+ { in: "body", key: "tools" },
766
+ { in: "body", key: "system" },
767
+ { in: "body", key: "variant" },
768
+ { in: "body", key: "parts" },
769
+ ],
770
+ },
771
+ ]);
772
+ return (options?.client ?? this.client).post({
773
+ url: "/session/{sessionID}/message",
774
+ ...options,
775
+ ...params,
776
+ headers: {
777
+ "Content-Type": "application/json",
778
+ ...options?.headers,
779
+ ...params.headers,
780
+ },
781
+ });
782
+ }
783
+ /**
784
+ * Get message
785
+ *
786
+ * Retrieve a specific message from a session by its message ID.
787
+ */
788
+ message(parameters, options) {
789
+ const params = buildClientParams([parameters], [
790
+ {
791
+ args: [
792
+ { in: "path", key: "sessionID" },
793
+ { in: "path", key: "messageID" },
794
+ { in: "query", key: "directory" },
795
+ ],
796
+ },
797
+ ]);
798
+ return (options?.client ?? this.client).get({
799
+ url: "/session/{sessionID}/message/{messageID}",
800
+ ...options,
801
+ ...params,
802
+ });
803
+ }
804
+ /**
805
+ * Send async message
806
+ *
807
+ * Create and send a new message to a session asynchronously, starting the session if needed and returning immediately.
808
+ */
809
+ promptAsync(parameters, options) {
810
+ const params = buildClientParams([parameters], [
811
+ {
812
+ args: [
813
+ { in: "path", key: "sessionID" },
814
+ { in: "query", key: "directory" },
815
+ { in: "body", key: "messageID" },
816
+ { in: "body", key: "model" },
817
+ { in: "body", key: "agent" },
818
+ { in: "body", key: "noReply" },
819
+ { in: "body", key: "tools" },
820
+ { in: "body", key: "system" },
821
+ { in: "body", key: "variant" },
822
+ { in: "body", key: "parts" },
823
+ ],
824
+ },
825
+ ]);
826
+ return (options?.client ?? this.client).post({
827
+ url: "/session/{sessionID}/prompt_async",
828
+ ...options,
829
+ ...params,
830
+ headers: {
831
+ "Content-Type": "application/json",
832
+ ...options?.headers,
833
+ ...params.headers,
834
+ },
835
+ });
836
+ }
837
+ /**
838
+ * Send command
839
+ *
840
+ * Send a new command to a session for execution by the AI assistant.
841
+ */
842
+ command(parameters, options) {
843
+ const params = buildClientParams([parameters], [
844
+ {
845
+ args: [
846
+ { in: "path", key: "sessionID" },
847
+ { in: "query", key: "directory" },
848
+ { in: "body", key: "messageID" },
849
+ { in: "body", key: "agent" },
850
+ { in: "body", key: "model" },
851
+ { in: "body", key: "arguments" },
852
+ { in: "body", key: "command" },
853
+ { in: "body", key: "variant" },
854
+ { in: "body", key: "parts" },
855
+ ],
856
+ },
857
+ ]);
858
+ return (options?.client ?? this.client).post({
859
+ url: "/session/{sessionID}/command",
860
+ ...options,
861
+ ...params,
862
+ headers: {
863
+ "Content-Type": "application/json",
864
+ ...options?.headers,
865
+ ...params.headers,
866
+ },
867
+ });
868
+ }
869
+ /**
870
+ * Run shell command
871
+ *
872
+ * Execute a shell command within the session context and return the AI's response.
873
+ */
874
+ shell(parameters, options) {
875
+ const params = buildClientParams([parameters], [
876
+ {
877
+ args: [
878
+ { in: "path", key: "sessionID" },
879
+ { in: "query", key: "directory" },
880
+ { in: "body", key: "agent" },
881
+ { in: "body", key: "model" },
882
+ { in: "body", key: "command" },
883
+ ],
884
+ },
885
+ ]);
886
+ return (options?.client ?? this.client).post({
887
+ url: "/session/{sessionID}/shell",
888
+ ...options,
889
+ ...params,
890
+ headers: {
891
+ "Content-Type": "application/json",
892
+ ...options?.headers,
893
+ ...params.headers,
894
+ },
895
+ });
896
+ }
897
+ /**
898
+ * Revert message
899
+ *
900
+ * Revert a specific message in a session, undoing its effects and restoring the previous state.
901
+ */
902
+ revert(parameters, options) {
903
+ const params = buildClientParams([parameters], [
904
+ {
905
+ args: [
906
+ { in: "path", key: "sessionID" },
907
+ { in: "query", key: "directory" },
908
+ { in: "body", key: "messageID" },
909
+ { in: "body", key: "partID" },
910
+ ],
911
+ },
912
+ ]);
913
+ return (options?.client ?? this.client).post({
914
+ url: "/session/{sessionID}/revert",
915
+ ...options,
916
+ ...params,
917
+ headers: {
918
+ "Content-Type": "application/json",
919
+ ...options?.headers,
920
+ ...params.headers,
921
+ },
922
+ });
923
+ }
924
+ /**
925
+ * Restore reverted messages
926
+ *
927
+ * Restore all previously reverted messages in a session.
928
+ */
929
+ unrevert(parameters, options) {
930
+ const params = buildClientParams([parameters], [
931
+ {
932
+ args: [
933
+ { in: "path", key: "sessionID" },
934
+ { in: "query", key: "directory" },
935
+ ],
936
+ },
937
+ ]);
938
+ return (options?.client ?? this.client).post({
939
+ url: "/session/{sessionID}/unrevert",
940
+ ...options,
941
+ ...params,
942
+ });
943
+ }
944
+ }
945
+ export class Part extends HeyApiClient {
946
+ /**
947
+ * Delete a part from a message
948
+ */
949
+ delete(parameters, options) {
950
+ const params = buildClientParams([parameters], [
951
+ {
952
+ args: [
953
+ { in: "path", key: "sessionID" },
954
+ { in: "path", key: "messageID" },
955
+ { in: "path", key: "partID" },
956
+ { in: "query", key: "directory" },
957
+ ],
958
+ },
959
+ ]);
960
+ return (options?.client ?? this.client).delete({
961
+ url: "/session/{sessionID}/message/{messageID}/part/{partID}",
962
+ ...options,
963
+ ...params,
964
+ });
965
+ }
966
+ /**
967
+ * Update a part in a message
968
+ */
969
+ update(parameters, options) {
970
+ const params = buildClientParams([parameters], [
971
+ {
972
+ args: [
973
+ { in: "path", key: "sessionID" },
974
+ { in: "path", key: "messageID" },
975
+ { in: "path", key: "partID" },
976
+ { in: "query", key: "directory" },
977
+ { key: "part", map: "body" },
978
+ ],
979
+ },
980
+ ]);
981
+ return (options?.client ?? this.client).patch({
982
+ url: "/session/{sessionID}/message/{messageID}/part/{partID}",
983
+ ...options,
984
+ ...params,
985
+ headers: {
986
+ "Content-Type": "application/json",
987
+ ...options?.headers,
988
+ ...params.headers,
989
+ },
990
+ });
991
+ }
992
+ }
993
+ export class Permission extends HeyApiClient {
994
+ /**
995
+ * Respond to permission
996
+ *
997
+ * Approve or deny a permission request from the AI assistant.
998
+ *
999
+ * @deprecated
1000
+ */
1001
+ respond(parameters, options) {
1002
+ const params = buildClientParams([parameters], [
1003
+ {
1004
+ args: [
1005
+ { in: "path", key: "sessionID" },
1006
+ { in: "path", key: "permissionID" },
1007
+ { in: "query", key: "directory" },
1008
+ { in: "body", key: "response" },
1009
+ ],
1010
+ },
1011
+ ]);
1012
+ return (options?.client ?? this.client).post({
1013
+ url: "/session/{sessionID}/permissions/{permissionID}",
1014
+ ...options,
1015
+ ...params,
1016
+ headers: {
1017
+ "Content-Type": "application/json",
1018
+ ...options?.headers,
1019
+ ...params.headers,
1020
+ },
1021
+ });
1022
+ }
1023
+ /**
1024
+ * Respond to permission request
1025
+ *
1026
+ * Approve or deny a permission request from the AI assistant.
1027
+ */
1028
+ reply(parameters, options) {
1029
+ const params = buildClientParams([parameters], [
1030
+ {
1031
+ args: [
1032
+ { in: "path", key: "requestID" },
1033
+ { in: "query", key: "directory" },
1034
+ { in: "body", key: "reply" },
1035
+ { in: "body", key: "message" },
1036
+ ],
1037
+ },
1038
+ ]);
1039
+ return (options?.client ?? this.client).post({
1040
+ url: "/permission/{requestID}/reply",
1041
+ ...options,
1042
+ ...params,
1043
+ headers: {
1044
+ "Content-Type": "application/json",
1045
+ ...options?.headers,
1046
+ ...params.headers,
1047
+ },
1048
+ });
1049
+ }
1050
+ /**
1051
+ * List pending permissions
1052
+ *
1053
+ * Get all pending permission requests across all sessions.
1054
+ */
1055
+ list(parameters, options) {
1056
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1057
+ return (options?.client ?? this.client).get({
1058
+ url: "/permission",
1059
+ ...options,
1060
+ ...params,
1061
+ });
1062
+ }
1063
+ }
1064
+ export class Question extends HeyApiClient {
1065
+ /**
1066
+ * List pending questions
1067
+ *
1068
+ * Get all pending question requests across all sessions.
1069
+ */
1070
+ list(parameters, options) {
1071
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1072
+ return (options?.client ?? this.client).get({
1073
+ url: "/question",
1074
+ ...options,
1075
+ ...params,
1076
+ });
1077
+ }
1078
+ /**
1079
+ * Ask a question
1080
+ *
1081
+ * Ask a question to the AI assistant.
1082
+ */
1083
+ ask(parameters, options) {
1084
+ const params = buildClientParams([parameters], [
1085
+ {
1086
+ args: [
1087
+ { in: "query", key: "directory" },
1088
+ { key: "questionAskInput", map: "body" },
1089
+ ],
1090
+ },
1091
+ ]);
1092
+ return (options?.client ?? this.client).post({
1093
+ url: "/question/ask",
1094
+ ...options,
1095
+ ...params,
1096
+ headers: {
1097
+ "Content-Type": "application/json",
1098
+ ...options?.headers,
1099
+ ...params.headers,
1100
+ },
1101
+ });
1102
+ }
1103
+ /**
1104
+ * Reply to question request
1105
+ *
1106
+ * Provide answers to a question request from the AI assistant.
1107
+ */
1108
+ reply(parameters, options) {
1109
+ const params = buildClientParams([parameters], [
1110
+ {
1111
+ args: [
1112
+ { in: "path", key: "requestID" },
1113
+ { in: "query", key: "directory" },
1114
+ { in: "body", key: "answers" },
1115
+ ],
1116
+ },
1117
+ ]);
1118
+ return (options?.client ?? this.client).post({
1119
+ url: "/question/{requestID}/reply",
1120
+ ...options,
1121
+ ...params,
1122
+ headers: {
1123
+ "Content-Type": "application/json",
1124
+ ...options?.headers,
1125
+ ...params.headers,
1126
+ },
1127
+ });
1128
+ }
1129
+ /**
1130
+ * Reject question request
1131
+ *
1132
+ * Reject a question request from the AI assistant.
1133
+ */
1134
+ reject(parameters, options) {
1135
+ const params = buildClientParams([parameters], [
1136
+ {
1137
+ args: [
1138
+ { in: "path", key: "requestID" },
1139
+ { in: "query", key: "directory" },
1140
+ ],
1141
+ },
1142
+ ]);
1143
+ return (options?.client ?? this.client).post({
1144
+ url: "/question/{requestID}/reject",
1145
+ ...options,
1146
+ ...params,
1147
+ });
1148
+ }
1149
+ }
1150
+ export class Oauth extends HeyApiClient {
1151
+ /**
1152
+ * OAuth authorize
1153
+ *
1154
+ * Initiate OAuth authorization for a specific AI provider to get an authorization URL.
1155
+ */
1156
+ authorize(parameters, options) {
1157
+ const params = buildClientParams([parameters], [
1158
+ {
1159
+ args: [
1160
+ { in: "path", key: "providerID" },
1161
+ { in: "query", key: "directory" },
1162
+ { in: "body", key: "method" },
1163
+ ],
1164
+ },
1165
+ ]);
1166
+ return (options?.client ?? this.client).post({
1167
+ url: "/provider/{providerID}/oauth/authorize",
1168
+ ...options,
1169
+ ...params,
1170
+ headers: {
1171
+ "Content-Type": "application/json",
1172
+ ...options?.headers,
1173
+ ...params.headers,
1174
+ },
1175
+ });
1176
+ }
1177
+ /**
1178
+ * OAuth callback
1179
+ *
1180
+ * Handle the OAuth callback from a provider after user authorization.
1181
+ */
1182
+ callback(parameters, options) {
1183
+ const params = buildClientParams([parameters], [
1184
+ {
1185
+ args: [
1186
+ { in: "path", key: "providerID" },
1187
+ { in: "query", key: "directory" },
1188
+ { in: "body", key: "method" },
1189
+ { in: "body", key: "code" },
1190
+ ],
1191
+ },
1192
+ ]);
1193
+ return (options?.client ?? this.client).post({
1194
+ url: "/provider/{providerID}/oauth/callback",
1195
+ ...options,
1196
+ ...params,
1197
+ headers: {
1198
+ "Content-Type": "application/json",
1199
+ ...options?.headers,
1200
+ ...params.headers,
1201
+ },
1202
+ });
1203
+ }
1204
+ }
1205
+ export class Provider extends HeyApiClient {
1206
+ /**
1207
+ * List providers
1208
+ *
1209
+ * Get a list of all available AI providers, including both available and connected ones.
1210
+ */
1211
+ list(parameters, options) {
1212
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1213
+ return (options?.client ?? this.client).get({
1214
+ url: "/provider",
1215
+ ...options,
1216
+ ...params,
1217
+ });
1218
+ }
1219
+ /**
1220
+ * Get provider auth methods
1221
+ *
1222
+ * Retrieve available authentication methods for all AI providers.
1223
+ */
1224
+ auth(parameters, options) {
1225
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1226
+ return (options?.client ?? this.client).get({
1227
+ url: "/provider/auth",
1228
+ ...options,
1229
+ ...params,
1230
+ });
1231
+ }
1232
+ _oauth;
1233
+ get oauth() {
1234
+ return (this._oauth ??= new Oauth({ client: this.client }));
1235
+ }
1236
+ }
1237
+ export class Find extends HeyApiClient {
1238
+ /**
1239
+ * Find text
1240
+ *
1241
+ * Search for text patterns across files in the project using ripgrep.
1242
+ */
1243
+ text(parameters, options) {
1244
+ const params = buildClientParams([parameters], [
1245
+ {
1246
+ args: [
1247
+ { in: "query", key: "directory" },
1248
+ { in: "query", key: "pattern" },
1249
+ ],
1250
+ },
1251
+ ]);
1252
+ return (options?.client ?? this.client).get({
1253
+ url: "/find",
1254
+ ...options,
1255
+ ...params,
1256
+ });
1257
+ }
1258
+ /**
1259
+ * Find files
1260
+ *
1261
+ * Search for files or directories by name or pattern in the project directory.
1262
+ */
1263
+ files(parameters, options) {
1264
+ const params = buildClientParams([parameters], [
1265
+ {
1266
+ args: [
1267
+ { in: "query", key: "directory" },
1268
+ { in: "query", key: "query" },
1269
+ { in: "query", key: "dirs" },
1270
+ { in: "query", key: "type" },
1271
+ { in: "query", key: "limit" },
1272
+ ],
1273
+ },
1274
+ ]);
1275
+ return (options?.client ?? this.client).get({
1276
+ url: "/find/file",
1277
+ ...options,
1278
+ ...params,
1279
+ });
1280
+ }
1281
+ /**
1282
+ * Find symbols
1283
+ *
1284
+ * Search for workspace symbols like functions, classes, and variables using LSP.
1285
+ */
1286
+ symbols(parameters, options) {
1287
+ const params = buildClientParams([parameters], [
1288
+ {
1289
+ args: [
1290
+ { in: "query", key: "directory" },
1291
+ { in: "query", key: "query" },
1292
+ ],
1293
+ },
1294
+ ]);
1295
+ return (options?.client ?? this.client).get({
1296
+ url: "/find/symbol",
1297
+ ...options,
1298
+ ...params,
1299
+ });
1300
+ }
1301
+ }
1302
+ export class File extends HeyApiClient {
1303
+ /**
1304
+ * List files
1305
+ *
1306
+ * List files and directories in a specified path.
1307
+ */
1308
+ list(parameters, options) {
1309
+ const params = buildClientParams([parameters], [
1310
+ {
1311
+ args: [
1312
+ { in: "query", key: "directory" },
1313
+ { in: "query", key: "path" },
1314
+ ],
1315
+ },
1316
+ ]);
1317
+ return (options?.client ?? this.client).get({
1318
+ url: "/file",
1319
+ ...options,
1320
+ ...params,
1321
+ });
1322
+ }
1323
+ /**
1324
+ * Read file
1325
+ *
1326
+ * Read the content of a specified file.
1327
+ */
1328
+ read(parameters, options) {
1329
+ const params = buildClientParams([parameters], [
1330
+ {
1331
+ args: [
1332
+ { in: "query", key: "directory" },
1333
+ { in: "query", key: "path" },
1334
+ ],
1335
+ },
1336
+ ]);
1337
+ return (options?.client ?? this.client).get({
1338
+ url: "/file/content",
1339
+ ...options,
1340
+ ...params,
1341
+ });
1342
+ }
1343
+ /**
1344
+ * Get file status
1345
+ *
1346
+ * Get the git status of all files in the project.
1347
+ */
1348
+ status(parameters, options) {
1349
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1350
+ return (options?.client ?? this.client).get({
1351
+ url: "/file/status",
1352
+ ...options,
1353
+ ...params,
1354
+ });
1355
+ }
1356
+ }
1357
+ export class Auth extends HeyApiClient {
1358
+ /**
1359
+ * Remove MCP OAuth
1360
+ *
1361
+ * Remove OAuth credentials for an MCP server
1362
+ */
1363
+ remove(parameters, options) {
1364
+ const params = buildClientParams([parameters], [
1365
+ {
1366
+ args: [
1367
+ { in: "path", key: "name" },
1368
+ { in: "query", key: "directory" },
1369
+ ],
1370
+ },
1371
+ ]);
1372
+ return (options?.client ?? this.client).delete({
1373
+ url: "/mcp/{name}/auth",
1374
+ ...options,
1375
+ ...params,
1376
+ });
1377
+ }
1378
+ /**
1379
+ * Start MCP OAuth
1380
+ *
1381
+ * Start OAuth authentication flow for a Model Context Protocol (MCP) server.
1382
+ */
1383
+ start(parameters, options) {
1384
+ const params = buildClientParams([parameters], [
1385
+ {
1386
+ args: [
1387
+ { in: "path", key: "name" },
1388
+ { in: "query", key: "directory" },
1389
+ ],
1390
+ },
1391
+ ]);
1392
+ return (options?.client ?? this.client).post({
1393
+ url: "/mcp/{name}/auth",
1394
+ ...options,
1395
+ ...params,
1396
+ });
1397
+ }
1398
+ /**
1399
+ * Complete MCP OAuth
1400
+ *
1401
+ * Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code.
1402
+ */
1403
+ callback(parameters, options) {
1404
+ const params = buildClientParams([parameters], [
1405
+ {
1406
+ args: [
1407
+ { in: "path", key: "name" },
1408
+ { in: "query", key: "directory" },
1409
+ { in: "body", key: "code" },
1410
+ ],
1411
+ },
1412
+ ]);
1413
+ return (options?.client ?? this.client).post({
1414
+ url: "/mcp/{name}/auth/callback",
1415
+ ...options,
1416
+ ...params,
1417
+ headers: {
1418
+ "Content-Type": "application/json",
1419
+ ...options?.headers,
1420
+ ...params.headers,
1421
+ },
1422
+ });
1423
+ }
1424
+ /**
1425
+ * Authenticate MCP OAuth
1426
+ *
1427
+ * Start OAuth flow and wait for callback (opens browser)
1428
+ */
1429
+ authenticate(parameters, options) {
1430
+ const params = buildClientParams([parameters], [
1431
+ {
1432
+ args: [
1433
+ { in: "path", key: "name" },
1434
+ { in: "query", key: "directory" },
1435
+ ],
1436
+ },
1437
+ ]);
1438
+ return (options?.client ?? this.client).post({
1439
+ url: "/mcp/{name}/auth/authenticate",
1440
+ ...options,
1441
+ ...params,
1442
+ });
1443
+ }
1444
+ }
1445
+ export class Mcp extends HeyApiClient {
1446
+ /**
1447
+ * Get MCP status
1448
+ *
1449
+ * Get the status of all Model Context Protocol (MCP) servers.
1450
+ */
1451
+ status(parameters, options) {
1452
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1453
+ return (options?.client ?? this.client).get({
1454
+ url: "/mcp",
1455
+ ...options,
1456
+ ...params,
1457
+ });
1458
+ }
1459
+ /**
1460
+ * Add MCP server
1461
+ *
1462
+ * Dynamically add a new Model Context Protocol (MCP) server to the system.
1463
+ */
1464
+ add(parameters, options) {
1465
+ const params = buildClientParams([parameters], [
1466
+ {
1467
+ args: [
1468
+ { in: "query", key: "directory" },
1469
+ { in: "body", key: "name" },
1470
+ { in: "body", key: "config" },
1471
+ ],
1472
+ },
1473
+ ]);
1474
+ return (options?.client ?? this.client).post({
1475
+ url: "/mcp",
1476
+ ...options,
1477
+ ...params,
1478
+ headers: {
1479
+ "Content-Type": "application/json",
1480
+ ...options?.headers,
1481
+ ...params.headers,
1482
+ },
1483
+ });
1484
+ }
1485
+ /**
1486
+ * Connect an MCP server
1487
+ */
1488
+ connect(parameters, options) {
1489
+ const params = buildClientParams([parameters], [
1490
+ {
1491
+ args: [
1492
+ { in: "path", key: "name" },
1493
+ { in: "query", key: "directory" },
1494
+ ],
1495
+ },
1496
+ ]);
1497
+ return (options?.client ?? this.client).post({
1498
+ url: "/mcp/{name}/connect",
1499
+ ...options,
1500
+ ...params,
1501
+ });
1502
+ }
1503
+ /**
1504
+ * Disconnect an MCP server
1505
+ */
1506
+ disconnect(parameters, options) {
1507
+ const params = buildClientParams([parameters], [
1508
+ {
1509
+ args: [
1510
+ { in: "path", key: "name" },
1511
+ { in: "query", key: "directory" },
1512
+ ],
1513
+ },
1514
+ ]);
1515
+ return (options?.client ?? this.client).post({
1516
+ url: "/mcp/{name}/disconnect",
1517
+ ...options,
1518
+ ...params,
1519
+ });
1520
+ }
1521
+ _auth;
1522
+ get auth() {
1523
+ return (this._auth ??= new Auth({ client: this.client }));
1524
+ }
1525
+ }
1526
+ export class Control extends HeyApiClient {
1527
+ /**
1528
+ * Get next TUI request
1529
+ *
1530
+ * Retrieve the next TUI (Terminal User Interface) request from the queue for processing.
1531
+ */
1532
+ next(parameters, options) {
1533
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1534
+ return (options?.client ?? this.client).get({
1535
+ url: "/tui/control/next",
1536
+ ...options,
1537
+ ...params,
1538
+ });
1539
+ }
1540
+ /**
1541
+ * Submit TUI response
1542
+ *
1543
+ * Submit a response to the TUI request queue to complete a pending request.
1544
+ */
1545
+ response(parameters, options) {
1546
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }, { in: "body" }] }]);
1547
+ return (options?.client ?? this.client).post({
1548
+ url: "/tui/control/response",
1549
+ ...options,
1550
+ ...params,
1551
+ headers: {
1552
+ "Content-Type": "application/json",
1553
+ ...options?.headers,
1554
+ ...params.headers,
1555
+ },
1556
+ });
1557
+ }
1558
+ }
1559
+ export class Tui extends HeyApiClient {
1560
+ /**
1561
+ * Append TUI prompt
1562
+ *
1563
+ * Append prompt to the TUI
1564
+ */
1565
+ appendPrompt(parameters, options) {
1566
+ const params = buildClientParams([parameters], [
1567
+ {
1568
+ args: [
1569
+ { in: "query", key: "directory" },
1570
+ { in: "body", key: "text" },
1571
+ ],
1572
+ },
1573
+ ]);
1574
+ return (options?.client ?? this.client).post({
1575
+ url: "/tui/append-prompt",
1576
+ ...options,
1577
+ ...params,
1578
+ headers: {
1579
+ "Content-Type": "application/json",
1580
+ ...options?.headers,
1581
+ ...params.headers,
1582
+ },
1583
+ });
1584
+ }
1585
+ /**
1586
+ * Open help dialog
1587
+ *
1588
+ * Open the help dialog in the TUI to display user assistance information.
1589
+ */
1590
+ openHelp(parameters, options) {
1591
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1592
+ return (options?.client ?? this.client).post({
1593
+ url: "/tui/open-help",
1594
+ ...options,
1595
+ ...params,
1596
+ });
1597
+ }
1598
+ /**
1599
+ * Open sessions dialog
1600
+ *
1601
+ * Open the session dialog
1602
+ */
1603
+ openSessions(parameters, options) {
1604
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1605
+ return (options?.client ?? this.client).post({
1606
+ url: "/tui/open-sessions",
1607
+ ...options,
1608
+ ...params,
1609
+ });
1610
+ }
1611
+ /**
1612
+ * Open themes dialog
1613
+ *
1614
+ * Open the theme dialog
1615
+ */
1616
+ openThemes(parameters, options) {
1617
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1618
+ return (options?.client ?? this.client).post({
1619
+ url: "/tui/open-themes",
1620
+ ...options,
1621
+ ...params,
1622
+ });
1623
+ }
1624
+ /**
1625
+ * Open models dialog
1626
+ *
1627
+ * Open the model dialog
1628
+ */
1629
+ openModels(parameters, options) {
1630
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1631
+ return (options?.client ?? this.client).post({
1632
+ url: "/tui/open-models",
1633
+ ...options,
1634
+ ...params,
1635
+ });
1636
+ }
1637
+ /**
1638
+ * Submit TUI prompt
1639
+ *
1640
+ * Submit the prompt
1641
+ */
1642
+ submitPrompt(parameters, options) {
1643
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1644
+ return (options?.client ?? this.client).post({
1645
+ url: "/tui/submit-prompt",
1646
+ ...options,
1647
+ ...params,
1648
+ });
1649
+ }
1650
+ /**
1651
+ * Clear TUI prompt
1652
+ *
1653
+ * Clear the prompt
1654
+ */
1655
+ clearPrompt(parameters, options) {
1656
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1657
+ return (options?.client ?? this.client).post({
1658
+ url: "/tui/clear-prompt",
1659
+ ...options,
1660
+ ...params,
1661
+ });
1662
+ }
1663
+ /**
1664
+ * Execute TUI command
1665
+ *
1666
+ * Execute a TUI command (e.g. agent_cycle)
1667
+ */
1668
+ executeCommand(parameters, options) {
1669
+ const params = buildClientParams([parameters], [
1670
+ {
1671
+ args: [
1672
+ { in: "query", key: "directory" },
1673
+ { in: "body", key: "command" },
1674
+ ],
1675
+ },
1676
+ ]);
1677
+ return (options?.client ?? this.client).post({
1678
+ url: "/tui/execute-command",
1679
+ ...options,
1680
+ ...params,
1681
+ headers: {
1682
+ "Content-Type": "application/json",
1683
+ ...options?.headers,
1684
+ ...params.headers,
1685
+ },
1686
+ });
1687
+ }
1688
+ /**
1689
+ * Show TUI toast
1690
+ *
1691
+ * Show a toast notification in the TUI
1692
+ */
1693
+ showToast(parameters, options) {
1694
+ const params = buildClientParams([parameters], [
1695
+ {
1696
+ args: [
1697
+ { in: "query", key: "directory" },
1698
+ { in: "body", key: "title" },
1699
+ { in: "body", key: "message" },
1700
+ { in: "body", key: "variant" },
1701
+ { in: "body", key: "duration" },
1702
+ ],
1703
+ },
1704
+ ]);
1705
+ return (options?.client ?? this.client).post({
1706
+ url: "/tui/show-toast",
1707
+ ...options,
1708
+ ...params,
1709
+ headers: {
1710
+ "Content-Type": "application/json",
1711
+ ...options?.headers,
1712
+ ...params.headers,
1713
+ },
1714
+ });
1715
+ }
1716
+ /**
1717
+ * Publish TUI event
1718
+ *
1719
+ * Publish a TUI event
1720
+ */
1721
+ publish(parameters, options) {
1722
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }, { in: "body" }] }]);
1723
+ return (options?.client ?? this.client).post({
1724
+ url: "/tui/publish",
1725
+ ...options,
1726
+ ...params,
1727
+ headers: {
1728
+ "Content-Type": "application/json",
1729
+ ...options?.headers,
1730
+ ...params.headers,
1731
+ },
1732
+ });
1733
+ }
1734
+ /**
1735
+ * Select session
1736
+ *
1737
+ * Navigate the TUI to display the specified session.
1738
+ */
1739
+ selectSession(parameters, options) {
1740
+ const params = buildClientParams([parameters], [
1741
+ {
1742
+ args: [
1743
+ { in: "query", key: "directory" },
1744
+ { in: "body", key: "sessionID" },
1745
+ ],
1746
+ },
1747
+ ]);
1748
+ return (options?.client ?? this.client).post({
1749
+ url: "/tui/select-session",
1750
+ ...options,
1751
+ ...params,
1752
+ headers: {
1753
+ "Content-Type": "application/json",
1754
+ ...options?.headers,
1755
+ ...params.headers,
1756
+ },
1757
+ });
1758
+ }
1759
+ _control;
1760
+ get control() {
1761
+ return (this._control ??= new Control({ client: this.client }));
1762
+ }
1763
+ }
1764
+ export class Instance extends HeyApiClient {
1765
+ /**
1766
+ * Dispose instance
1767
+ *
1768
+ * Clean up and dispose the current OpenCode instance, releasing all resources.
1769
+ */
1770
+ dispose(parameters, options) {
1771
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1772
+ return (options?.client ?? this.client).post({
1773
+ url: "/instance/dispose",
1774
+ ...options,
1775
+ ...params,
1776
+ });
1777
+ }
1778
+ }
1779
+ export class Path extends HeyApiClient {
1780
+ /**
1781
+ * Get paths
1782
+ *
1783
+ * Retrieve the current working directory and related path information for the OpenCode instance.
1784
+ */
1785
+ get(parameters, options) {
1786
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1787
+ return (options?.client ?? this.client).get({
1788
+ url: "/path",
1789
+ ...options,
1790
+ ...params,
1791
+ });
1792
+ }
1793
+ }
1794
+ export class Vcs extends HeyApiClient {
1795
+ /**
1796
+ * Get VCS info
1797
+ *
1798
+ * Retrieve version control system (VCS) information for the current project, such as git branch.
1799
+ */
1800
+ get(parameters, options) {
1801
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1802
+ return (options?.client ?? this.client).get({
1803
+ url: "/vcs",
1804
+ ...options,
1805
+ ...params,
1806
+ });
1807
+ }
1808
+ }
1809
+ export class Command extends HeyApiClient {
1810
+ /**
1811
+ * List commands
1812
+ *
1813
+ * Get a list of all available commands in the OpenCode system.
1814
+ */
1815
+ list(parameters, options) {
1816
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1817
+ return (options?.client ?? this.client).get({
1818
+ url: "/command",
1819
+ ...options,
1820
+ ...params,
1821
+ });
1822
+ }
1823
+ }
1824
+ export class App extends HeyApiClient {
1825
+ /**
1826
+ * Write log
1827
+ *
1828
+ * Write a log entry to the server logs with specified level and metadata.
1829
+ */
1830
+ log(parameters, options) {
1831
+ const params = buildClientParams([parameters], [
1832
+ {
1833
+ args: [
1834
+ { in: "query", key: "directory" },
1835
+ { in: "body", key: "service" },
1836
+ { in: "body", key: "level" },
1837
+ { in: "body", key: "message" },
1838
+ { in: "body", key: "extra" },
1839
+ ],
1840
+ },
1841
+ ]);
1842
+ return (options?.client ?? this.client).post({
1843
+ url: "/log",
1844
+ ...options,
1845
+ ...params,
1846
+ headers: {
1847
+ "Content-Type": "application/json",
1848
+ ...options?.headers,
1849
+ ...params.headers,
1850
+ },
1851
+ });
1852
+ }
1853
+ /**
1854
+ * List agents
1855
+ *
1856
+ * Get a list of all available AI agents in the OpenCode system.
1857
+ */
1858
+ agents(parameters, options) {
1859
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1860
+ return (options?.client ?? this.client).get({
1861
+ url: "/agent",
1862
+ ...options,
1863
+ ...params,
1864
+ });
1865
+ }
1866
+ /**
1867
+ * List skills
1868
+ *
1869
+ * Get a list of all available skills in the OpenCode system.
1870
+ */
1871
+ skills(parameters, options) {
1872
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1873
+ return (options?.client ?? this.client).get({
1874
+ url: "/skill",
1875
+ ...options,
1876
+ ...params,
1877
+ });
1878
+ }
1879
+ }
1880
+ export class Lsp extends HeyApiClient {
1881
+ /**
1882
+ * Get LSP status
1883
+ *
1884
+ * Get LSP server status
1885
+ */
1886
+ status(parameters, options) {
1887
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1888
+ return (options?.client ?? this.client).get({
1889
+ url: "/lsp",
1890
+ ...options,
1891
+ ...params,
1892
+ });
1893
+ }
1894
+ }
1895
+ export class Formatter extends HeyApiClient {
1896
+ /**
1897
+ * Get formatter status
1898
+ *
1899
+ * Get formatter status
1900
+ */
1901
+ status(parameters, options) {
1902
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1903
+ return (options?.client ?? this.client).get({
1904
+ url: "/formatter",
1905
+ ...options,
1906
+ ...params,
1907
+ });
1908
+ }
1909
+ }
1910
+ export class Auth2 extends HeyApiClient {
1911
+ /**
1912
+ * Set auth credentials
1913
+ *
1914
+ * Set authentication credentials
1915
+ */
1916
+ set(parameters, options) {
1917
+ const params = buildClientParams([parameters], [
1918
+ {
1919
+ args: [
1920
+ { in: "path", key: "providerID" },
1921
+ { in: "query", key: "directory" },
1922
+ { key: "auth", map: "body" },
1923
+ ],
1924
+ },
1925
+ ]);
1926
+ return (options?.client ?? this.client).put({
1927
+ url: "/auth/{providerID}",
1928
+ ...options,
1929
+ ...params,
1930
+ headers: {
1931
+ "Content-Type": "application/json",
1932
+ ...options?.headers,
1933
+ ...params.headers,
1934
+ },
1935
+ });
1936
+ }
1937
+ }
1938
+ export class Event extends HeyApiClient {
1939
+ /**
1940
+ * Subscribe to events
1941
+ *
1942
+ * Get events
1943
+ */
1944
+ subscribe(parameters, options) {
1945
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
1946
+ return (options?.client ?? this.client).sse.get({
1947
+ url: "/event",
1948
+ ...options,
1949
+ ...params,
1950
+ });
1951
+ }
1952
+ }
1953
+ export class OpencodeClient extends HeyApiClient {
1954
+ static __registry = new HeyApiRegistry();
1955
+ constructor(args) {
1956
+ super(args);
1957
+ OpencodeClient.__registry.set(this, args?.key);
1958
+ }
1959
+ _global;
1960
+ get global() {
1961
+ return (this._global ??= new Global({ client: this.client }));
1962
+ }
1963
+ _project;
1964
+ get project() {
1965
+ return (this._project ??= new Project({ client: this.client }));
1966
+ }
1967
+ _pty;
1968
+ get pty() {
1969
+ return (this._pty ??= new Pty({ client: this.client }));
1970
+ }
1971
+ _config;
1972
+ get config() {
1973
+ return (this._config ??= new Config({ client: this.client }));
1974
+ }
1975
+ _tool;
1976
+ get tool() {
1977
+ return (this._tool ??= new Tool({ client: this.client }));
1978
+ }
1979
+ _worktree;
1980
+ get worktree() {
1981
+ return (this._worktree ??= new Worktree({ client: this.client }));
1982
+ }
1983
+ _experimental;
1984
+ get experimental() {
1985
+ return (this._experimental ??= new Experimental({ client: this.client }));
1986
+ }
1987
+ _session;
1988
+ get session() {
1989
+ return (this._session ??= new Session({ client: this.client }));
1990
+ }
1991
+ _part;
1992
+ get part() {
1993
+ return (this._part ??= new Part({ client: this.client }));
1994
+ }
1995
+ _permission;
1996
+ get permission() {
1997
+ return (this._permission ??= new Permission({ client: this.client }));
1998
+ }
1999
+ _question;
2000
+ get question() {
2001
+ return (this._question ??= new Question({ client: this.client }));
2002
+ }
2003
+ _provider;
2004
+ get provider() {
2005
+ return (this._provider ??= new Provider({ client: this.client }));
2006
+ }
2007
+ _find;
2008
+ get find() {
2009
+ return (this._find ??= new Find({ client: this.client }));
2010
+ }
2011
+ _file;
2012
+ get file() {
2013
+ return (this._file ??= new File({ client: this.client }));
2014
+ }
2015
+ _mcp;
2016
+ get mcp() {
2017
+ return (this._mcp ??= new Mcp({ client: this.client }));
2018
+ }
2019
+ _tui;
2020
+ get tui() {
2021
+ return (this._tui ??= new Tui({ client: this.client }));
2022
+ }
2023
+ _instance;
2024
+ get instance() {
2025
+ return (this._instance ??= new Instance({ client: this.client }));
2026
+ }
2027
+ _path;
2028
+ get path() {
2029
+ return (this._path ??= new Path({ client: this.client }));
2030
+ }
2031
+ _vcs;
2032
+ get vcs() {
2033
+ return (this._vcs ??= new Vcs({ client: this.client }));
2034
+ }
2035
+ _command;
2036
+ get command() {
2037
+ return (this._command ??= new Command({ client: this.client }));
2038
+ }
2039
+ _app;
2040
+ get app() {
2041
+ return (this._app ??= new App({ client: this.client }));
2042
+ }
2043
+ _lsp;
2044
+ get lsp() {
2045
+ return (this._lsp ??= new Lsp({ client: this.client }));
2046
+ }
2047
+ _formatter;
2048
+ get formatter() {
2049
+ return (this._formatter ??= new Formatter({ client: this.client }));
2050
+ }
2051
+ _auth;
2052
+ get auth() {
2053
+ return (this._auth ??= new Auth2({ client: this.client }));
2054
+ }
2055
+ _event;
2056
+ get event() {
2057
+ return (this._event ??= new Event({ client: this.client }));
2058
+ }
2059
+ }