@martinbruu/sdk 0.0.0-dev-202601312004

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