@opencode-ai/sdk 0.0.0-dev-202605030205 → 0.0.0-dev-202605030312

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.
@@ -21,94 +21,6 @@ class HeyApiRegistry {
21
21
  this.instances.set(key ?? this.defaultKey, value);
22
22
  }
23
23
  }
24
- export class Config extends HeyApiClient {
25
- /**
26
- * Get global configuration
27
- *
28
- * Retrieve the current global OpenCode configuration settings and preferences.
29
- */
30
- get(options) {
31
- return (options?.client ?? this.client).get({
32
- url: "/global/config",
33
- ...options,
34
- });
35
- }
36
- /**
37
- * Update global configuration
38
- *
39
- * Update global OpenCode configuration settings and preferences.
40
- */
41
- update(parameters, options) {
42
- const params = buildClientParams([parameters], [{ args: [{ key: "config", map: "body" }] }]);
43
- return (options?.client ?? this.client).patch({
44
- url: "/global/config",
45
- ...options,
46
- ...params,
47
- headers: {
48
- "Content-Type": "application/json",
49
- ...options?.headers,
50
- ...params.headers,
51
- },
52
- });
53
- }
54
- }
55
- export class Global extends HeyApiClient {
56
- /**
57
- * Get health
58
- *
59
- * Get health information about the OpenCode server.
60
- */
61
- health(options) {
62
- return (options?.client ?? this.client).get({
63
- url: "/global/health",
64
- ...options,
65
- });
66
- }
67
- /**
68
- * Get global events
69
- *
70
- * Subscribe to global events from the OpenCode system using server-sent events.
71
- */
72
- event(options) {
73
- return (options?.client ?? this.client).sse.get({
74
- url: "/global/event",
75
- ...options,
76
- });
77
- }
78
- /**
79
- * Dispose instance
80
- *
81
- * Clean up and dispose all OpenCode instances, releasing all resources.
82
- */
83
- dispose(options) {
84
- return (options?.client ?? this.client).post({
85
- url: "/global/dispose",
86
- ...options,
87
- });
88
- }
89
- /**
90
- * Upgrade opencode
91
- *
92
- * Upgrade opencode to the specified version or latest if not specified.
93
- */
94
- upgrade(parameters, options) {
95
- const params = buildClientParams([parameters], [{ args: [{ in: "body", key: "target" }] }]);
96
- return (options?.client ?? this.client).post({
97
- url: "/global/upgrade",
98
- ...options,
99
- ...params,
100
- headers: {
101
- "Content-Type": "application/json",
102
- ...options?.headers,
103
- ...params.headers,
104
- },
105
- });
106
- }
107
- _config;
108
- get config() {
109
- return (this._config ??= new Config({ client: this.client }));
110
- }
111
- }
112
24
  export class Auth extends HeyApiClient {
113
25
  /**
114
26
  * Remove auth credentials
@@ -220,69 +132,80 @@ export class App extends HeyApiClient {
220
132
  });
221
133
  }
222
134
  }
223
- export class Adapter extends HeyApiClient {
135
+ export class Config extends HeyApiClient {
224
136
  /**
225
- * List workspace adapters
137
+ * Get global configuration
226
138
  *
227
- * List all available workspace adapters for the current project.
139
+ * Retrieve the current global OpenCode configuration settings and preferences.
228
140
  */
229
- list(parameters, options) {
230
- const params = buildClientParams([parameters], [
231
- {
232
- args: [
233
- { in: "query", key: "directory" },
234
- { in: "query", key: "workspace" },
235
- ],
236
- },
237
- ]);
141
+ get(options) {
238
142
  return (options?.client ?? this.client).get({
239
- url: "/experimental/workspace/adapter",
143
+ url: "/global/config",
144
+ ...options,
145
+ });
146
+ }
147
+ /**
148
+ * Update global configuration
149
+ *
150
+ * Update global OpenCode configuration settings and preferences.
151
+ */
152
+ update(parameters, options) {
153
+ const params = buildClientParams([parameters], [{ args: [{ key: "config", map: "body" }] }]);
154
+ return (options?.client ?? this.client).patch({
155
+ url: "/global/config",
240
156
  ...options,
241
157
  ...params,
158
+ headers: {
159
+ "Content-Type": "application/json",
160
+ ...options?.headers,
161
+ ...params.headers,
162
+ },
242
163
  });
243
164
  }
244
165
  }
245
- export class Workspace extends HeyApiClient {
166
+ export class Global extends HeyApiClient {
246
167
  /**
247
- * List workspaces
168
+ * Get health
248
169
  *
249
- * List all workspaces.
170
+ * Get health information about the OpenCode server.
250
171
  */
251
- list(parameters, options) {
252
- const params = buildClientParams([parameters], [
253
- {
254
- args: [
255
- { in: "query", key: "directory" },
256
- { in: "query", key: "workspace" },
257
- ],
258
- },
259
- ]);
172
+ health(options) {
260
173
  return (options?.client ?? this.client).get({
261
- url: "/experimental/workspace",
174
+ url: "/global/health",
262
175
  ...options,
263
- ...params,
264
176
  });
265
177
  }
266
178
  /**
267
- * Create workspace
179
+ * Get global events
268
180
  *
269
- * Create a workspace for the current project.
181
+ * Subscribe to global events from the OpenCode system using server-sent events.
270
182
  */
271
- create(parameters, options) {
272
- const params = buildClientParams([parameters], [
273
- {
274
- args: [
275
- { in: "query", key: "directory" },
276
- { in: "query", key: "workspace" },
277
- { in: "body", key: "id" },
278
- { in: "body", key: "type" },
279
- { in: "body", key: "branch" },
280
- { in: "body", key: "extra" },
281
- ],
282
- },
283
- ]);
183
+ event(options) {
184
+ return (options?.client ?? this.client).sse.get({
185
+ url: "/global/event",
186
+ ...options,
187
+ });
188
+ }
189
+ /**
190
+ * Dispose instance
191
+ *
192
+ * Clean up and dispose all OpenCode instances, releasing all resources.
193
+ */
194
+ dispose(options) {
284
195
  return (options?.client ?? this.client).post({
285
- url: "/experimental/workspace",
196
+ url: "/global/dispose",
197
+ ...options,
198
+ });
199
+ }
200
+ /**
201
+ * Upgrade opencode
202
+ *
203
+ * Upgrade opencode to the specified version or latest if not specified.
204
+ */
205
+ upgrade(parameters, options) {
206
+ const params = buildClientParams([parameters], [{ args: [{ in: "body", key: "target" }] }]);
207
+ return (options?.client ?? this.client).post({
208
+ url: "/global/upgrade",
286
209
  ...options,
287
210
  ...params,
288
211
  headers: {
@@ -292,12 +215,18 @@ export class Workspace extends HeyApiClient {
292
215
  },
293
216
  });
294
217
  }
218
+ _config;
219
+ get config() {
220
+ return (this._config ??= new Config({ client: this.client }));
221
+ }
222
+ }
223
+ export class Event extends HeyApiClient {
295
224
  /**
296
- * Workspace status
225
+ * Subscribe to events
297
226
  *
298
- * Get connection status for workspaces in the current project.
227
+ * Get events
299
228
  */
300
- status(parameters, options) {
229
+ subscribe(parameters, options) {
301
230
  const params = buildClientParams([parameters], [
302
231
  {
303
232
  args: [
@@ -306,51 +235,51 @@ export class Workspace extends HeyApiClient {
306
235
  ],
307
236
  },
308
237
  ]);
309
- return (options?.client ?? this.client).get({
310
- url: "/experimental/workspace/status",
238
+ return (options?.client ?? this.client).sse.get({
239
+ url: "/event",
311
240
  ...options,
312
241
  ...params,
313
242
  });
314
243
  }
244
+ }
245
+ export class Config2 extends HeyApiClient {
315
246
  /**
316
- * Remove workspace
247
+ * Get configuration
317
248
  *
318
- * Remove an existing workspace.
249
+ * Retrieve the current OpenCode configuration settings and preferences.
319
250
  */
320
- remove(parameters, options) {
251
+ get(parameters, options) {
321
252
  const params = buildClientParams([parameters], [
322
253
  {
323
254
  args: [
324
- { in: "path", key: "id" },
325
255
  { in: "query", key: "directory" },
326
256
  { in: "query", key: "workspace" },
327
257
  ],
328
258
  },
329
259
  ]);
330
- return (options?.client ?? this.client).delete({
331
- url: "/experimental/workspace/{id}",
260
+ return (options?.client ?? this.client).get({
261
+ url: "/config",
332
262
  ...options,
333
263
  ...params,
334
264
  });
335
265
  }
336
266
  /**
337
- * Restore session into workspace
267
+ * Update configuration
338
268
  *
339
- * Replay a session's sync events into the target workspace in batches.
269
+ * Update OpenCode configuration settings and preferences.
340
270
  */
341
- sessionRestore(parameters, options) {
271
+ update(parameters, options) {
342
272
  const params = buildClientParams([parameters], [
343
273
  {
344
274
  args: [
345
- { in: "path", key: "id" },
346
275
  { in: "query", key: "directory" },
347
276
  { in: "query", key: "workspace" },
348
- { in: "body", key: "sessionID" },
277
+ { key: "config", map: "body" },
349
278
  ],
350
279
  },
351
280
  ]);
352
- return (options?.client ?? this.client).post({
353
- url: "/experimental/workspace/{id}/session-restore",
281
+ return (options?.client ?? this.client).patch({
282
+ url: "/config",
354
283
  ...options,
355
284
  ...params,
356
285
  headers: {
@@ -360,9 +289,25 @@ export class Workspace extends HeyApiClient {
360
289
  },
361
290
  });
362
291
  }
363
- _adapter;
364
- get adapter() {
365
- return (this._adapter ??= new Adapter({ client: this.client }));
292
+ /**
293
+ * List config providers
294
+ *
295
+ * Get a list of all configured AI providers and their default models.
296
+ */
297
+ providers(parameters, options) {
298
+ const params = buildClientParams([parameters], [
299
+ {
300
+ args: [
301
+ { in: "query", key: "directory" },
302
+ { in: "query", key: "workspace" },
303
+ ],
304
+ },
305
+ ]);
306
+ return (options?.client ?? this.client).get({
307
+ url: "/config/providers",
308
+ ...options,
309
+ ...params,
310
+ });
366
311
  }
367
312
  }
368
313
  export class Console extends HeyApiClient {
@@ -484,29 +429,11 @@ export class Resource extends HeyApiClient {
484
429
  });
485
430
  }
486
431
  }
487
- export class Experimental extends HeyApiClient {
488
- _workspace;
489
- get workspace() {
490
- return (this._workspace ??= new Workspace({ client: this.client }));
491
- }
492
- _console;
493
- get console() {
494
- return (this._console ??= new Console({ client: this.client }));
495
- }
496
- _session;
497
- get session() {
498
- return (this._session ??= new Session({ client: this.client }));
499
- }
500
- _resource;
501
- get resource() {
502
- return (this._resource ??= new Resource({ client: this.client }));
503
- }
504
- }
505
- export class Project extends HeyApiClient {
432
+ export class Adapter extends HeyApiClient {
506
433
  /**
507
- * List all projects
434
+ * List workspace adapters
508
435
  *
509
- * Get a list of projects that have been opened with OpenCode.
436
+ * List all available workspace adapters for the current project.
510
437
  */
511
438
  list(parameters, options) {
512
439
  const params = buildClientParams([parameters], [
@@ -518,17 +445,19 @@ export class Project extends HeyApiClient {
518
445
  },
519
446
  ]);
520
447
  return (options?.client ?? this.client).get({
521
- url: "/project",
448
+ url: "/experimental/workspace/adapter",
522
449
  ...options,
523
450
  ...params,
524
451
  });
525
452
  }
453
+ }
454
+ export class Workspace extends HeyApiClient {
526
455
  /**
527
- * Get current project
456
+ * List workspaces
528
457
  *
529
- * Retrieve the currently active project that OpenCode is working with.
458
+ * List all workspaces.
530
459
  */
531
- current(parameters, options) {
460
+ list(parameters, options) {
532
461
  const params = buildClientParams([parameters], [
533
462
  {
534
463
  args: [
@@ -538,51 +467,31 @@ export class Project extends HeyApiClient {
538
467
  },
539
468
  ]);
540
469
  return (options?.client ?? this.client).get({
541
- url: "/project/current",
470
+ url: "/experimental/workspace",
542
471
  ...options,
543
472
  ...params,
544
473
  });
545
474
  }
546
475
  /**
547
- * Initialize git repository
476
+ * Create workspace
548
477
  *
549
- * Create a git repository for the current project and return the refreshed project info.
478
+ * Create a workspace for the current project.
550
479
  */
551
- initGit(parameters, options) {
480
+ create(parameters, options) {
552
481
  const params = buildClientParams([parameters], [
553
482
  {
554
483
  args: [
555
484
  { in: "query", key: "directory" },
556
485
  { in: "query", key: "workspace" },
486
+ { in: "body", key: "id" },
487
+ { in: "body", key: "type" },
488
+ { in: "body", key: "branch" },
489
+ { in: "body", key: "extra" },
557
490
  ],
558
491
  },
559
492
  ]);
560
493
  return (options?.client ?? this.client).post({
561
- url: "/project/git/init",
562
- ...options,
563
- ...params,
564
- });
565
- }
566
- /**
567
- * Update project
568
- *
569
- * Update project properties such as name, icon, and commands.
570
- */
571
- update(parameters, options) {
572
- const params = buildClientParams([parameters], [
573
- {
574
- args: [
575
- { in: "path", key: "projectID" },
576
- { in: "query", key: "directory" },
577
- { in: "query", key: "workspace" },
578
- { in: "body", key: "name" },
579
- { in: "body", key: "icon" },
580
- { in: "body", key: "commands" },
581
- ],
582
- },
583
- ]);
584
- return (options?.client ?? this.client).patch({
585
- url: "/project/{projectID}",
494
+ url: "/experimental/workspace",
586
495
  ...options,
587
496
  ...params,
588
497
  headers: {
@@ -592,14 +501,12 @@ export class Project extends HeyApiClient {
592
501
  },
593
502
  });
594
503
  }
595
- }
596
- export class Pty extends HeyApiClient {
597
504
  /**
598
- * List available shells
505
+ * Workspace status
599
506
  *
600
- * Get a list of available shells on the system.
507
+ * Get connection status for workspaces in the current project.
601
508
  */
602
- shells(parameters, options) {
509
+ status(parameters, options) {
603
510
  const params = buildClientParams([parameters], [
604
511
  {
605
512
  args: [
@@ -609,52 +516,50 @@ export class Pty extends HeyApiClient {
609
516
  },
610
517
  ]);
611
518
  return (options?.client ?? this.client).get({
612
- url: "/pty/shells",
519
+ url: "/experimental/workspace/status",
613
520
  ...options,
614
521
  ...params,
615
522
  });
616
523
  }
617
524
  /**
618
- * List PTY sessions
525
+ * Remove workspace
619
526
  *
620
- * Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode.
527
+ * Remove an existing workspace.
621
528
  */
622
- list(parameters, options) {
529
+ remove(parameters, options) {
623
530
  const params = buildClientParams([parameters], [
624
531
  {
625
532
  args: [
533
+ { in: "path", key: "id" },
626
534
  { in: "query", key: "directory" },
627
535
  { in: "query", key: "workspace" },
628
536
  ],
629
537
  },
630
538
  ]);
631
- return (options?.client ?? this.client).get({
632
- url: "/pty",
539
+ return (options?.client ?? this.client).delete({
540
+ url: "/experimental/workspace/{id}",
633
541
  ...options,
634
542
  ...params,
635
543
  });
636
544
  }
637
545
  /**
638
- * Create PTY session
546
+ * Restore session into workspace
639
547
  *
640
- * Create a new pseudo-terminal (PTY) session for running shell commands and processes.
548
+ * Replay a session's sync events into the target workspace in batches.
641
549
  */
642
- create(parameters, options) {
550
+ sessionRestore(parameters, options) {
643
551
  const params = buildClientParams([parameters], [
644
552
  {
645
553
  args: [
554
+ { in: "path", key: "id" },
646
555
  { in: "query", key: "directory" },
647
556
  { in: "query", key: "workspace" },
648
- { in: "body", key: "command" },
649
- { in: "body", key: "args" },
650
- { in: "body", key: "cwd" },
651
- { in: "body", key: "title" },
652
- { in: "body", key: "env" },
557
+ { in: "body", key: "sessionID" },
653
558
  ],
654
559
  },
655
560
  ]);
656
561
  return (options?.client ?? this.client).post({
657
- url: "/pty",
562
+ url: "/experimental/workspace/{id}/session-restore",
658
563
  ...options,
659
564
  ...params,
660
565
  headers: {
@@ -664,67 +569,91 @@ export class Pty extends HeyApiClient {
664
569
  },
665
570
  });
666
571
  }
572
+ _adapter;
573
+ get adapter() {
574
+ return (this._adapter ??= new Adapter({ client: this.client }));
575
+ }
576
+ }
577
+ export class Experimental extends HeyApiClient {
578
+ _console;
579
+ get console() {
580
+ return (this._console ??= new Console({ client: this.client }));
581
+ }
582
+ _session;
583
+ get session() {
584
+ return (this._session ??= new Session({ client: this.client }));
585
+ }
586
+ _resource;
587
+ get resource() {
588
+ return (this._resource ??= new Resource({ client: this.client }));
589
+ }
590
+ _workspace;
591
+ get workspace() {
592
+ return (this._workspace ??= new Workspace({ client: this.client }));
593
+ }
594
+ }
595
+ export class Tool extends HeyApiClient {
667
596
  /**
668
- * Remove PTY session
597
+ * List tools
669
598
  *
670
- * Remove and terminate a specific pseudo-terminal (PTY) session.
599
+ * Get a list of available tools with their JSON schema parameters for a specific provider and model combination.
671
600
  */
672
- remove(parameters, options) {
601
+ list(parameters, options) {
673
602
  const params = buildClientParams([parameters], [
674
603
  {
675
604
  args: [
676
- { in: "path", key: "ptyID" },
677
605
  { in: "query", key: "directory" },
678
606
  { in: "query", key: "workspace" },
607
+ { in: "query", key: "provider" },
608
+ { in: "query", key: "model" },
679
609
  ],
680
610
  },
681
611
  ]);
682
- return (options?.client ?? this.client).delete({
683
- url: "/pty/{ptyID}",
612
+ return (options?.client ?? this.client).get({
613
+ url: "/experimental/tool",
684
614
  ...options,
685
615
  ...params,
686
616
  });
687
617
  }
688
618
  /**
689
- * Get PTY session
619
+ * List tool IDs
690
620
  *
691
- * Retrieve detailed information about a specific pseudo-terminal (PTY) session.
621
+ * Get a list of all available tool IDs, including both built-in tools and dynamically registered tools.
692
622
  */
693
- get(parameters, options) {
623
+ ids(parameters, options) {
694
624
  const params = buildClientParams([parameters], [
695
625
  {
696
626
  args: [
697
- { in: "path", key: "ptyID" },
698
627
  { in: "query", key: "directory" },
699
628
  { in: "query", key: "workspace" },
700
629
  ],
701
630
  },
702
631
  ]);
703
632
  return (options?.client ?? this.client).get({
704
- url: "/pty/{ptyID}",
633
+ url: "/experimental/tool/ids",
705
634
  ...options,
706
635
  ...params,
707
636
  });
708
637
  }
638
+ }
639
+ export class Worktree extends HeyApiClient {
709
640
  /**
710
- * Update PTY session
641
+ * Remove worktree
711
642
  *
712
- * Update properties of an existing pseudo-terminal (PTY) session.
643
+ * Remove a git worktree and delete its branch.
713
644
  */
714
- update(parameters, options) {
645
+ remove(parameters, options) {
715
646
  const params = buildClientParams([parameters], [
716
647
  {
717
648
  args: [
718
- { in: "path", key: "ptyID" },
719
649
  { in: "query", key: "directory" },
720
650
  { in: "query", key: "workspace" },
721
- { in: "body", key: "title" },
722
- { in: "body", key: "size" },
651
+ { key: "worktreeRemoveInput", map: "body" },
723
652
  ],
724
653
  },
725
654
  ]);
726
- return (options?.client ?? this.client).put({
727
- url: "/pty/{ptyID}",
655
+ return (options?.client ?? this.client).delete({
656
+ url: "/experimental/worktree",
728
657
  ...options,
729
658
  ...params,
730
659
  headers: {
@@ -735,65 +664,68 @@ export class Pty extends HeyApiClient {
735
664
  });
736
665
  }
737
666
  /**
738
- * Connect to PTY session
667
+ * List worktrees
739
668
  *
740
- * Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.
669
+ * List all sandbox worktrees for the current project.
741
670
  */
742
- connect(parameters, options) {
671
+ list(parameters, options) {
743
672
  const params = buildClientParams([parameters], [
744
673
  {
745
674
  args: [
746
- { in: "path", key: "ptyID" },
747
675
  { in: "query", key: "directory" },
748
676
  { in: "query", key: "workspace" },
749
677
  ],
750
678
  },
751
679
  ]);
752
680
  return (options?.client ?? this.client).get({
753
- url: "/pty/{ptyID}/connect",
681
+ url: "/experimental/worktree",
754
682
  ...options,
755
683
  ...params,
756
684
  });
757
685
  }
758
- }
759
- export class Config2 extends HeyApiClient {
760
686
  /**
761
- * Get configuration
687
+ * Create worktree
762
688
  *
763
- * Retrieve the current OpenCode configuration settings and preferences.
689
+ * Create a new git worktree for the current project and run any configured startup scripts.
764
690
  */
765
- get(parameters, options) {
691
+ create(parameters, options) {
766
692
  const params = buildClientParams([parameters], [
767
693
  {
768
694
  args: [
769
695
  { in: "query", key: "directory" },
770
696
  { in: "query", key: "workspace" },
697
+ { key: "worktreeCreateInput", map: "body" },
771
698
  ],
772
699
  },
773
700
  ]);
774
- return (options?.client ?? this.client).get({
775
- url: "/config",
701
+ return (options?.client ?? this.client).post({
702
+ url: "/experimental/worktree",
776
703
  ...options,
777
704
  ...params,
705
+ headers: {
706
+ "Content-Type": "application/json",
707
+ ...options?.headers,
708
+ ...params.headers,
709
+ },
778
710
  });
779
711
  }
780
712
  /**
781
- * Update configuration
713
+ * Reset worktree
782
714
  *
783
- * Update OpenCode configuration settings and preferences.
715
+ * Reset a worktree branch to the primary default branch.
784
716
  */
785
- update(parameters, options) {
717
+ reset(parameters, options) {
786
718
  const params = buildClientParams([parameters], [
787
719
  {
788
720
  args: [
789
721
  { in: "query", key: "directory" },
790
722
  { in: "query", key: "workspace" },
791
- { key: "config", map: "body" },
723
+ { key: "worktreeResetInput", map: "body" },
792
724
  ],
793
725
  },
794
726
  ]);
795
- return (options?.client ?? this.client).patch({
796
- url: "/config",
727
+ return (options?.client ?? this.client).post({
728
+ url: "/experimental/worktree/reset",
797
729
  ...options,
798
730
  ...params,
799
731
  headers: {
@@ -803,380 +735,353 @@ export class Config2 extends HeyApiClient {
803
735
  },
804
736
  });
805
737
  }
738
+ }
739
+ export class Find extends HeyApiClient {
806
740
  /**
807
- * List config providers
741
+ * Find text
808
742
  *
809
- * Get a list of all configured AI providers and their default models.
743
+ * Search for text patterns across files in the project using ripgrep.
810
744
  */
811
- providers(parameters, options) {
745
+ text(parameters, options) {
812
746
  const params = buildClientParams([parameters], [
813
747
  {
814
748
  args: [
815
749
  { in: "query", key: "directory" },
816
750
  { in: "query", key: "workspace" },
751
+ { in: "query", key: "pattern" },
817
752
  ],
818
753
  },
819
754
  ]);
820
755
  return (options?.client ?? this.client).get({
821
- url: "/config/providers",
756
+ url: "/find",
822
757
  ...options,
823
758
  ...params,
824
759
  });
825
760
  }
826
- }
827
- export class Tool extends HeyApiClient {
828
761
  /**
829
- * List tool IDs
762
+ * Find files
830
763
  *
831
- * Get a list of all available tool IDs, including both built-in tools and dynamically registered tools.
764
+ * Search for files or directories by name or pattern in the project directory.
832
765
  */
833
- ids(parameters, options) {
766
+ files(parameters, options) {
834
767
  const params = buildClientParams([parameters], [
835
768
  {
836
769
  args: [
837
770
  { in: "query", key: "directory" },
838
771
  { in: "query", key: "workspace" },
772
+ { in: "query", key: "query" },
773
+ { in: "query", key: "dirs" },
774
+ { in: "query", key: "type" },
775
+ { in: "query", key: "limit" },
839
776
  ],
840
777
  },
841
778
  ]);
842
779
  return (options?.client ?? this.client).get({
843
- url: "/experimental/tool/ids",
780
+ url: "/find/file",
844
781
  ...options,
845
782
  ...params,
846
783
  });
847
784
  }
848
785
  /**
849
- * List tools
786
+ * Find symbols
850
787
  *
851
- * Get a list of available tools with their JSON schema parameters for a specific provider and model combination.
788
+ * Search for workspace symbols like functions, classes, and variables using LSP.
852
789
  */
853
- list(parameters, options) {
790
+ symbols(parameters, options) {
854
791
  const params = buildClientParams([parameters], [
855
792
  {
856
793
  args: [
857
794
  { in: "query", key: "directory" },
858
795
  { in: "query", key: "workspace" },
859
- { in: "query", key: "provider" },
860
- { in: "query", key: "model" },
796
+ { in: "query", key: "query" },
861
797
  ],
862
798
  },
863
799
  ]);
864
800
  return (options?.client ?? this.client).get({
865
- url: "/experimental/tool",
801
+ url: "/find/symbol",
866
802
  ...options,
867
803
  ...params,
868
804
  });
869
805
  }
870
806
  }
871
- export class Worktree extends HeyApiClient {
807
+ export class File extends HeyApiClient {
872
808
  /**
873
- * Remove worktree
809
+ * List files
874
810
  *
875
- * Remove a git worktree and delete its branch.
811
+ * List files and directories in a specified path.
876
812
  */
877
- remove(parameters, options) {
813
+ list(parameters, options) {
878
814
  const params = buildClientParams([parameters], [
879
815
  {
880
816
  args: [
881
817
  { in: "query", key: "directory" },
882
818
  { in: "query", key: "workspace" },
883
- { key: "worktreeRemoveInput", map: "body" },
819
+ { in: "query", key: "path" },
884
820
  ],
885
821
  },
886
822
  ]);
887
- return (options?.client ?? this.client).delete({
888
- url: "/experimental/worktree",
823
+ return (options?.client ?? this.client).get({
824
+ url: "/file",
889
825
  ...options,
890
826
  ...params,
891
- headers: {
892
- "Content-Type": "application/json",
893
- ...options?.headers,
894
- ...params.headers,
895
- },
896
827
  });
897
828
  }
898
829
  /**
899
- * List worktrees
830
+ * Read file
900
831
  *
901
- * List all sandbox worktrees for the current project.
832
+ * Read the content of a specified file.
902
833
  */
903
- list(parameters, options) {
834
+ read(parameters, options) {
904
835
  const params = buildClientParams([parameters], [
905
836
  {
906
837
  args: [
907
838
  { in: "query", key: "directory" },
908
839
  { in: "query", key: "workspace" },
840
+ { in: "query", key: "path" },
909
841
  ],
910
842
  },
911
843
  ]);
912
844
  return (options?.client ?? this.client).get({
913
- url: "/experimental/worktree",
845
+ url: "/file/content",
914
846
  ...options,
915
847
  ...params,
916
848
  });
917
849
  }
918
850
  /**
919
- * Create worktree
851
+ * Get file status
920
852
  *
921
- * Create a new git worktree for the current project and run any configured startup scripts.
853
+ * Get the git status of all files in the project.
922
854
  */
923
- create(parameters, options) {
855
+ status(parameters, options) {
924
856
  const params = buildClientParams([parameters], [
925
857
  {
926
858
  args: [
927
859
  { in: "query", key: "directory" },
928
860
  { in: "query", key: "workspace" },
929
- { key: "worktreeCreateInput", map: "body" },
930
861
  ],
931
862
  },
932
863
  ]);
933
- return (options?.client ?? this.client).post({
934
- url: "/experimental/worktree",
864
+ return (options?.client ?? this.client).get({
865
+ url: "/file/status",
935
866
  ...options,
936
867
  ...params,
937
- headers: {
938
- "Content-Type": "application/json",
939
- ...options?.headers,
940
- ...params.headers,
941
- },
942
868
  });
943
869
  }
870
+ }
871
+ export class Instance extends HeyApiClient {
944
872
  /**
945
- * Reset worktree
873
+ * Dispose instance
946
874
  *
947
- * Reset a worktree branch to the primary default branch.
875
+ * Clean up and dispose the current OpenCode instance, releasing all resources.
948
876
  */
949
- reset(parameters, options) {
877
+ dispose(parameters, options) {
950
878
  const params = buildClientParams([parameters], [
951
879
  {
952
880
  args: [
953
881
  { in: "query", key: "directory" },
954
882
  { in: "query", key: "workspace" },
955
- { key: "worktreeResetInput", map: "body" },
956
883
  ],
957
884
  },
958
885
  ]);
959
886
  return (options?.client ?? this.client).post({
960
- url: "/experimental/worktree/reset",
887
+ url: "/instance/dispose",
961
888
  ...options,
962
889
  ...params,
963
- headers: {
964
- "Content-Type": "application/json",
965
- ...options?.headers,
966
- ...params.headers,
967
- },
968
890
  });
969
891
  }
970
892
  }
971
- export class Session2 extends HeyApiClient {
893
+ export class Path extends HeyApiClient {
972
894
  /**
973
- * List sessions
895
+ * Get paths
974
896
  *
975
- * Get a list of all OpenCode sessions, sorted by most recently updated.
897
+ * Retrieve the current working directory and related path information for the OpenCode instance.
976
898
  */
977
- list(parameters, options) {
899
+ get(parameters, options) {
978
900
  const params = buildClientParams([parameters], [
979
901
  {
980
902
  args: [
981
903
  { in: "query", key: "directory" },
982
904
  { in: "query", key: "workspace" },
983
- { in: "query", key: "scope" },
984
- { in: "query", key: "path" },
985
- { in: "query", key: "roots" },
986
- { in: "query", key: "start" },
987
- { in: "query", key: "search" },
988
- { in: "query", key: "limit" },
989
905
  ],
990
906
  },
991
907
  ]);
992
908
  return (options?.client ?? this.client).get({
993
- url: "/session",
909
+ url: "/path",
994
910
  ...options,
995
911
  ...params,
996
912
  });
997
913
  }
914
+ }
915
+ export class Vcs extends HeyApiClient {
998
916
  /**
999
- * Create session
917
+ * Get VCS info
1000
918
  *
1001
- * Create a new OpenCode session for interacting with AI assistants and managing conversations.
919
+ * Retrieve version control system (VCS) information for the current project, such as git branch.
1002
920
  */
1003
- create(parameters, options) {
921
+ get(parameters, options) {
1004
922
  const params = buildClientParams([parameters], [
1005
923
  {
1006
924
  args: [
1007
925
  { in: "query", key: "directory" },
1008
926
  { in: "query", key: "workspace" },
1009
- { in: "body", key: "parentID" },
1010
- { in: "body", key: "title" },
1011
- { in: "body", key: "permission" },
1012
- { in: "body", key: "workspaceID" },
1013
927
  ],
1014
928
  },
1015
929
  ]);
1016
- return (options?.client ?? this.client).post({
1017
- url: "/session",
930
+ return (options?.client ?? this.client).get({
931
+ url: "/vcs",
1018
932
  ...options,
1019
933
  ...params,
1020
- headers: {
1021
- "Content-Type": "application/json",
1022
- ...options?.headers,
1023
- ...params.headers,
1024
- },
1025
934
  });
1026
935
  }
1027
936
  /**
1028
- * Get session status
937
+ * Get VCS diff
1029
938
  *
1030
- * Retrieve the current status of all sessions, including active, idle, and completed states.
939
+ * Retrieve the current git diff for the working tree or against the default branch.
1031
940
  */
1032
- status(parameters, options) {
941
+ diff(parameters, options) {
1033
942
  const params = buildClientParams([parameters], [
1034
943
  {
1035
944
  args: [
1036
945
  { in: "query", key: "directory" },
1037
946
  { in: "query", key: "workspace" },
947
+ { in: "query", key: "mode" },
1038
948
  ],
1039
949
  },
1040
950
  ]);
1041
951
  return (options?.client ?? this.client).get({
1042
- url: "/session/status",
952
+ url: "/vcs/diff",
1043
953
  ...options,
1044
954
  ...params,
1045
955
  });
1046
956
  }
957
+ }
958
+ export class Command extends HeyApiClient {
1047
959
  /**
1048
- * Delete session
960
+ * List commands
1049
961
  *
1050
- * Delete a session and permanently remove all associated data, including messages and history.
962
+ * Get a list of all available commands in the OpenCode system.
1051
963
  */
1052
- delete(parameters, options) {
964
+ list(parameters, options) {
1053
965
  const params = buildClientParams([parameters], [
1054
966
  {
1055
967
  args: [
1056
- { in: "path", key: "sessionID" },
1057
968
  { in: "query", key: "directory" },
1058
969
  { in: "query", key: "workspace" },
1059
970
  ],
1060
971
  },
1061
972
  ]);
1062
- return (options?.client ?? this.client).delete({
1063
- url: "/session/{sessionID}",
973
+ return (options?.client ?? this.client).get({
974
+ url: "/command",
1064
975
  ...options,
1065
976
  ...params,
1066
977
  });
1067
978
  }
979
+ }
980
+ export class Lsp extends HeyApiClient {
1068
981
  /**
1069
- * Get session
982
+ * Get LSP status
1070
983
  *
1071
- * Retrieve detailed information about a specific OpenCode session.
984
+ * Get LSP server status
1072
985
  */
1073
- get(parameters, options) {
986
+ status(parameters, options) {
1074
987
  const params = buildClientParams([parameters], [
1075
988
  {
1076
989
  args: [
1077
- { in: "path", key: "sessionID" },
1078
990
  { in: "query", key: "directory" },
1079
991
  { in: "query", key: "workspace" },
1080
992
  ],
1081
993
  },
1082
994
  ]);
1083
995
  return (options?.client ?? this.client).get({
1084
- url: "/session/{sessionID}",
996
+ url: "/lsp",
1085
997
  ...options,
1086
998
  ...params,
1087
999
  });
1088
1000
  }
1001
+ }
1002
+ export class Formatter extends HeyApiClient {
1089
1003
  /**
1090
- * Update session
1004
+ * Get formatter status
1091
1005
  *
1092
- * Update properties of an existing session, such as title or other metadata.
1006
+ * Get formatter status
1093
1007
  */
1094
- update(parameters, options) {
1008
+ status(parameters, options) {
1095
1009
  const params = buildClientParams([parameters], [
1096
1010
  {
1097
1011
  args: [
1098
- { in: "path", key: "sessionID" },
1099
1012
  { in: "query", key: "directory" },
1100
1013
  { in: "query", key: "workspace" },
1101
- { in: "body", key: "title" },
1102
- { in: "body", key: "permission" },
1103
- { in: "body", key: "time" },
1104
1014
  ],
1105
1015
  },
1106
1016
  ]);
1107
- return (options?.client ?? this.client).patch({
1108
- url: "/session/{sessionID}",
1017
+ return (options?.client ?? this.client).get({
1018
+ url: "/formatter",
1109
1019
  ...options,
1110
1020
  ...params,
1111
- headers: {
1112
- "Content-Type": "application/json",
1113
- ...options?.headers,
1114
- ...params.headers,
1115
- },
1116
1021
  });
1117
1022
  }
1023
+ }
1024
+ export class Auth2 extends HeyApiClient {
1118
1025
  /**
1119
- * Get session children
1026
+ * Remove MCP OAuth
1120
1027
  *
1121
- * Retrieve all child sessions that were forked from the specified parent session.
1028
+ * Remove OAuth credentials for an MCP server.
1122
1029
  */
1123
- children(parameters, options) {
1030
+ remove(parameters, options) {
1124
1031
  const params = buildClientParams([parameters], [
1125
1032
  {
1126
1033
  args: [
1127
- { in: "path", key: "sessionID" },
1034
+ { in: "path", key: "name" },
1128
1035
  { in: "query", key: "directory" },
1129
1036
  { in: "query", key: "workspace" },
1130
1037
  ],
1131
1038
  },
1132
1039
  ]);
1133
- return (options?.client ?? this.client).get({
1134
- url: "/session/{sessionID}/children",
1040
+ return (options?.client ?? this.client).delete({
1041
+ url: "/mcp/{name}/auth",
1135
1042
  ...options,
1136
1043
  ...params,
1137
1044
  });
1138
1045
  }
1139
1046
  /**
1140
- * Get session todos
1047
+ * Start MCP OAuth
1141
1048
  *
1142
- * Retrieve the todo list associated with a specific session, showing tasks and action items.
1049
+ * Start OAuth authentication flow for a Model Context Protocol (MCP) server.
1143
1050
  */
1144
- todo(parameters, options) {
1051
+ start(parameters, options) {
1145
1052
  const params = buildClientParams([parameters], [
1146
1053
  {
1147
1054
  args: [
1148
- { in: "path", key: "sessionID" },
1055
+ { in: "path", key: "name" },
1149
1056
  { in: "query", key: "directory" },
1150
1057
  { in: "query", key: "workspace" },
1151
1058
  ],
1152
1059
  },
1153
1060
  ]);
1154
- return (options?.client ?? this.client).get({
1155
- url: "/session/{sessionID}/todo",
1061
+ return (options?.client ?? this.client).post({
1062
+ url: "/mcp/{name}/auth",
1156
1063
  ...options,
1157
1064
  ...params,
1158
1065
  });
1159
1066
  }
1160
1067
  /**
1161
- * Initialize session
1068
+ * Complete MCP OAuth
1162
1069
  *
1163
- * Analyze the current application and create an AGENTS.md file with project-specific agent configurations.
1070
+ * Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code.
1164
1071
  */
1165
- init(parameters, options) {
1072
+ callback(parameters, options) {
1166
1073
  const params = buildClientParams([parameters], [
1167
1074
  {
1168
1075
  args: [
1169
- { in: "path", key: "sessionID" },
1076
+ { in: "path", key: "name" },
1170
1077
  { in: "query", key: "directory" },
1171
1078
  { in: "query", key: "workspace" },
1172
- { in: "body", key: "modelID" },
1173
- { in: "body", key: "providerID" },
1174
- { in: "body", key: "messageID" },
1079
+ { in: "body", key: "code" },
1175
1080
  ],
1176
1081
  },
1177
1082
  ]);
1178
1083
  return (options?.client ?? this.client).post({
1179
- url: "/session/{sessionID}/init",
1084
+ url: "/mcp/{name}/auth/callback",
1180
1085
  ...options,
1181
1086
  ...params,
1182
1087
  headers: {
@@ -1187,307 +1092,271 @@ export class Session2 extends HeyApiClient {
1187
1092
  });
1188
1093
  }
1189
1094
  /**
1190
- * Fork session
1095
+ * Authenticate MCP OAuth
1191
1096
  *
1192
- * Create a new session by forking an existing session at a specific message point.
1097
+ * Start OAuth flow and wait for callback (opens browser).
1193
1098
  */
1194
- fork(parameters, options) {
1099
+ authenticate(parameters, options) {
1195
1100
  const params = buildClientParams([parameters], [
1196
1101
  {
1197
1102
  args: [
1198
- { in: "path", key: "sessionID" },
1103
+ { in: "path", key: "name" },
1199
1104
  { in: "query", key: "directory" },
1200
1105
  { in: "query", key: "workspace" },
1201
- { in: "body", key: "messageID" },
1202
1106
  ],
1203
1107
  },
1204
1108
  ]);
1205
1109
  return (options?.client ?? this.client).post({
1206
- url: "/session/{sessionID}/fork",
1110
+ url: "/mcp/{name}/auth/authenticate",
1207
1111
  ...options,
1208
1112
  ...params,
1209
- headers: {
1210
- "Content-Type": "application/json",
1211
- ...options?.headers,
1212
- ...params.headers,
1213
- },
1214
1113
  });
1215
1114
  }
1115
+ }
1116
+ export class Mcp extends HeyApiClient {
1216
1117
  /**
1217
- * Abort session
1118
+ * Get MCP status
1218
1119
  *
1219
- * Abort an active session and stop any ongoing AI processing or command execution.
1120
+ * Get the status of all Model Context Protocol (MCP) servers.
1220
1121
  */
1221
- abort(parameters, options) {
1122
+ status(parameters, options) {
1222
1123
  const params = buildClientParams([parameters], [
1223
1124
  {
1224
1125
  args: [
1225
- { in: "path", key: "sessionID" },
1226
1126
  { in: "query", key: "directory" },
1227
1127
  { in: "query", key: "workspace" },
1228
1128
  ],
1229
1129
  },
1230
1130
  ]);
1231
- return (options?.client ?? this.client).post({
1232
- url: "/session/{sessionID}/abort",
1131
+ return (options?.client ?? this.client).get({
1132
+ url: "/mcp",
1233
1133
  ...options,
1234
1134
  ...params,
1235
1135
  });
1236
1136
  }
1237
1137
  /**
1238
- * Unshare session
1138
+ * Add MCP server
1239
1139
  *
1240
- * Remove the shareable link for a session, making it private again.
1140
+ * Dynamically add a new Model Context Protocol (MCP) server to the system.
1241
1141
  */
1242
- unshare(parameters, options) {
1142
+ add(parameters, options) {
1243
1143
  const params = buildClientParams([parameters], [
1244
1144
  {
1245
1145
  args: [
1246
- { in: "path", key: "sessionID" },
1247
1146
  { in: "query", key: "directory" },
1248
1147
  { in: "query", key: "workspace" },
1148
+ { in: "body", key: "name" },
1149
+ { in: "body", key: "config" },
1249
1150
  ],
1250
1151
  },
1251
1152
  ]);
1252
- return (options?.client ?? this.client).delete({
1253
- url: "/session/{sessionID}/share",
1153
+ return (options?.client ?? this.client).post({
1154
+ url: "/mcp",
1254
1155
  ...options,
1255
1156
  ...params,
1157
+ headers: {
1158
+ "Content-Type": "application/json",
1159
+ ...options?.headers,
1160
+ ...params.headers,
1161
+ },
1256
1162
  });
1257
1163
  }
1258
1164
  /**
1259
- * Share session
1260
- *
1261
- * Create a shareable link for a session, allowing others to view the conversation.
1165
+ * Connect an MCP server.
1262
1166
  */
1263
- share(parameters, options) {
1167
+ connect(parameters, options) {
1264
1168
  const params = buildClientParams([parameters], [
1265
1169
  {
1266
1170
  args: [
1267
- { in: "path", key: "sessionID" },
1171
+ { in: "path", key: "name" },
1268
1172
  { in: "query", key: "directory" },
1269
1173
  { in: "query", key: "workspace" },
1270
1174
  ],
1271
1175
  },
1272
1176
  ]);
1273
1177
  return (options?.client ?? this.client).post({
1274
- url: "/session/{sessionID}/share",
1178
+ url: "/mcp/{name}/connect",
1275
1179
  ...options,
1276
1180
  ...params,
1277
1181
  });
1278
1182
  }
1279
1183
  /**
1280
- * Get message diff
1281
- *
1282
- * Get the file changes (diff) that resulted from a specific user message in the session.
1184
+ * Disconnect an MCP server.
1283
1185
  */
1284
- diff(parameters, options) {
1186
+ disconnect(parameters, options) {
1285
1187
  const params = buildClientParams([parameters], [
1286
1188
  {
1287
1189
  args: [
1288
- { in: "path", key: "sessionID" },
1190
+ { in: "path", key: "name" },
1289
1191
  { in: "query", key: "directory" },
1290
1192
  { in: "query", key: "workspace" },
1291
- { in: "query", key: "messageID" },
1292
1193
  ],
1293
1194
  },
1294
1195
  ]);
1295
- return (options?.client ?? this.client).get({
1296
- url: "/session/{sessionID}/diff",
1196
+ return (options?.client ?? this.client).post({
1197
+ url: "/mcp/{name}/disconnect",
1297
1198
  ...options,
1298
1199
  ...params,
1299
1200
  });
1300
1201
  }
1202
+ _auth;
1203
+ get auth() {
1204
+ return (this._auth ??= new Auth2({ client: this.client }));
1205
+ }
1206
+ }
1207
+ export class Project extends HeyApiClient {
1301
1208
  /**
1302
- * Summarize session
1209
+ * List all projects
1303
1210
  *
1304
- * Generate a concise summary of the session using AI compaction to preserve key information.
1211
+ * Get a list of projects that have been opened with OpenCode.
1305
1212
  */
1306
- summarize(parameters, options) {
1213
+ list(parameters, options) {
1307
1214
  const params = buildClientParams([parameters], [
1308
1215
  {
1309
1216
  args: [
1310
- { in: "path", key: "sessionID" },
1311
1217
  { in: "query", key: "directory" },
1312
1218
  { in: "query", key: "workspace" },
1313
- { in: "body", key: "providerID" },
1314
- { in: "body", key: "modelID" },
1315
- { in: "body", key: "auto" },
1316
1219
  ],
1317
1220
  },
1318
1221
  ]);
1319
- return (options?.client ?? this.client).post({
1320
- url: "/session/{sessionID}/summarize",
1222
+ return (options?.client ?? this.client).get({
1223
+ url: "/project",
1321
1224
  ...options,
1322
1225
  ...params,
1323
- headers: {
1324
- "Content-Type": "application/json",
1325
- ...options?.headers,
1326
- ...params.headers,
1327
- },
1328
1226
  });
1329
1227
  }
1330
1228
  /**
1331
- * Get session messages
1229
+ * Get current project
1332
1230
  *
1333
- * Retrieve all messages in a session, including user prompts and AI responses.
1231
+ * Retrieve the currently active project that OpenCode is working with.
1334
1232
  */
1335
- messages(parameters, options) {
1233
+ current(parameters, options) {
1336
1234
  const params = buildClientParams([parameters], [
1337
1235
  {
1338
1236
  args: [
1339
- { in: "path", key: "sessionID" },
1340
1237
  { in: "query", key: "directory" },
1341
1238
  { in: "query", key: "workspace" },
1342
- { in: "query", key: "limit" },
1343
- { in: "query", key: "before" },
1344
1239
  ],
1345
1240
  },
1346
1241
  ]);
1347
1242
  return (options?.client ?? this.client).get({
1348
- url: "/session/{sessionID}/message",
1243
+ url: "/project/current",
1349
1244
  ...options,
1350
1245
  ...params,
1351
1246
  });
1352
1247
  }
1353
1248
  /**
1354
- * Send message
1249
+ * Initialize git repository
1355
1250
  *
1356
- * Create and send a new message to a session, streaming the AI response.
1251
+ * Create a git repository for the current project and return the refreshed project info.
1357
1252
  */
1358
- prompt(parameters, options) {
1253
+ initGit(parameters, options) {
1359
1254
  const params = buildClientParams([parameters], [
1360
1255
  {
1361
1256
  args: [
1362
- { in: "path", key: "sessionID" },
1363
1257
  { in: "query", key: "directory" },
1364
1258
  { in: "query", key: "workspace" },
1365
- { in: "body", key: "messageID" },
1366
- { in: "body", key: "model" },
1367
- { in: "body", key: "agent" },
1368
- { in: "body", key: "noReply" },
1369
- { in: "body", key: "tools" },
1370
- { in: "body", key: "format" },
1371
- { in: "body", key: "system" },
1372
- { in: "body", key: "variant" },
1373
- { in: "body", key: "parts" },
1374
1259
  ],
1375
1260
  },
1376
1261
  ]);
1377
1262
  return (options?.client ?? this.client).post({
1378
- url: "/session/{sessionID}/message",
1263
+ url: "/project/git/init",
1379
1264
  ...options,
1380
1265
  ...params,
1381
- headers: {
1382
- "Content-Type": "application/json",
1383
- ...options?.headers,
1384
- ...params.headers,
1385
- },
1386
1266
  });
1387
1267
  }
1388
1268
  /**
1389
- * Delete message
1269
+ * Update project
1390
1270
  *
1391
- * Permanently delete a specific message (and all of its parts) from a session. This does not revert any file changes that may have been made while processing the message.
1271
+ * Update project properties such as name, icon, and commands.
1392
1272
  */
1393
- deleteMessage(parameters, options) {
1273
+ update(parameters, options) {
1394
1274
  const params = buildClientParams([parameters], [
1395
1275
  {
1396
1276
  args: [
1397
- { in: "path", key: "sessionID" },
1398
- { in: "path", key: "messageID" },
1277
+ { in: "path", key: "projectID" },
1399
1278
  { in: "query", key: "directory" },
1400
1279
  { in: "query", key: "workspace" },
1280
+ { in: "body", key: "name" },
1281
+ { in: "body", key: "icon" },
1282
+ { in: "body", key: "commands" },
1401
1283
  ],
1402
1284
  },
1403
1285
  ]);
1404
- return (options?.client ?? this.client).delete({
1405
- url: "/session/{sessionID}/message/{messageID}",
1286
+ return (options?.client ?? this.client).patch({
1287
+ url: "/project/{projectID}",
1406
1288
  ...options,
1407
1289
  ...params,
1290
+ headers: {
1291
+ "Content-Type": "application/json",
1292
+ ...options?.headers,
1293
+ ...params.headers,
1294
+ },
1408
1295
  });
1409
1296
  }
1297
+ }
1298
+ export class Pty extends HeyApiClient {
1410
1299
  /**
1411
- * Get message
1300
+ * List available shells
1412
1301
  *
1413
- * Retrieve a specific message from a session by its message ID.
1302
+ * Get a list of available shells on the system.
1414
1303
  */
1415
- message(parameters, options) {
1304
+ shells(parameters, options) {
1416
1305
  const params = buildClientParams([parameters], [
1417
1306
  {
1418
1307
  args: [
1419
- { in: "path", key: "sessionID" },
1420
- { in: "path", key: "messageID" },
1421
1308
  { in: "query", key: "directory" },
1422
1309
  { in: "query", key: "workspace" },
1423
1310
  ],
1424
1311
  },
1425
1312
  ]);
1426
1313
  return (options?.client ?? this.client).get({
1427
- url: "/session/{sessionID}/message/{messageID}",
1314
+ url: "/pty/shells",
1428
1315
  ...options,
1429
1316
  ...params,
1430
1317
  });
1431
1318
  }
1432
1319
  /**
1433
- * Send async message
1320
+ * List PTY sessions
1434
1321
  *
1435
- * Create and send a new message to a session asynchronously, starting the session if needed and returning immediately.
1322
+ * Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode.
1436
1323
  */
1437
- promptAsync(parameters, options) {
1324
+ list(parameters, options) {
1438
1325
  const params = buildClientParams([parameters], [
1439
1326
  {
1440
1327
  args: [
1441
- { in: "path", key: "sessionID" },
1442
1328
  { in: "query", key: "directory" },
1443
1329
  { in: "query", key: "workspace" },
1444
- { in: "body", key: "messageID" },
1445
- { in: "body", key: "model" },
1446
- { in: "body", key: "agent" },
1447
- { in: "body", key: "noReply" },
1448
- { in: "body", key: "tools" },
1449
- { in: "body", key: "format" },
1450
- { in: "body", key: "system" },
1451
- { in: "body", key: "variant" },
1452
- { in: "body", key: "parts" },
1453
1330
  ],
1454
1331
  },
1455
1332
  ]);
1456
- return (options?.client ?? this.client).post({
1457
- url: "/session/{sessionID}/prompt_async",
1333
+ return (options?.client ?? this.client).get({
1334
+ url: "/pty",
1458
1335
  ...options,
1459
1336
  ...params,
1460
- headers: {
1461
- "Content-Type": "application/json",
1462
- ...options?.headers,
1463
- ...params.headers,
1464
- },
1465
1337
  });
1466
1338
  }
1467
1339
  /**
1468
- * Send command
1340
+ * Create PTY session
1469
1341
  *
1470
- * Send a new command to a session for execution by the AI assistant.
1342
+ * Create a new pseudo-terminal (PTY) session for running shell commands and processes.
1471
1343
  */
1472
- command(parameters, options) {
1344
+ create(parameters, options) {
1473
1345
  const params = buildClientParams([parameters], [
1474
1346
  {
1475
1347
  args: [
1476
- { in: "path", key: "sessionID" },
1477
1348
  { in: "query", key: "directory" },
1478
1349
  { in: "query", key: "workspace" },
1479
- { in: "body", key: "messageID" },
1480
- { in: "body", key: "agent" },
1481
- { in: "body", key: "model" },
1482
- { in: "body", key: "arguments" },
1483
1350
  { in: "body", key: "command" },
1484
- { in: "body", key: "variant" },
1485
- { in: "body", key: "parts" },
1351
+ { in: "body", key: "args" },
1352
+ { in: "body", key: "cwd" },
1353
+ { in: "body", key: "title" },
1354
+ { in: "body", key: "env" },
1486
1355
  ],
1487
1356
  },
1488
1357
  ]);
1489
1358
  return (options?.client ?? this.client).post({
1490
- url: "/session/{sessionID}/command",
1359
+ url: "/pty",
1491
1360
  ...options,
1492
1361
  ...params,
1493
1362
  headers: {
@@ -1498,157 +1367,136 @@ export class Session2 extends HeyApiClient {
1498
1367
  });
1499
1368
  }
1500
1369
  /**
1501
- * Run shell command
1370
+ * Remove PTY session
1502
1371
  *
1503
- * Execute a shell command within the session context and return the AI's response.
1372
+ * Remove and terminate a specific pseudo-terminal (PTY) session.
1504
1373
  */
1505
- shell(parameters, options) {
1374
+ remove(parameters, options) {
1506
1375
  const params = buildClientParams([parameters], [
1507
1376
  {
1508
1377
  args: [
1509
- { in: "path", key: "sessionID" },
1378
+ { in: "path", key: "ptyID" },
1510
1379
  { in: "query", key: "directory" },
1511
1380
  { in: "query", key: "workspace" },
1512
- { in: "body", key: "messageID" },
1513
- { in: "body", key: "agent" },
1514
- { in: "body", key: "model" },
1515
- { in: "body", key: "command" },
1516
1381
  ],
1517
1382
  },
1518
1383
  ]);
1519
- return (options?.client ?? this.client).post({
1520
- url: "/session/{sessionID}/shell",
1384
+ return (options?.client ?? this.client).delete({
1385
+ url: "/pty/{ptyID}",
1521
1386
  ...options,
1522
1387
  ...params,
1523
- headers: {
1524
- "Content-Type": "application/json",
1525
- ...options?.headers,
1526
- ...params.headers,
1527
- },
1528
1388
  });
1529
1389
  }
1530
1390
  /**
1531
- * Revert message
1391
+ * Get PTY session
1532
1392
  *
1533
- * Revert a specific message in a session, undoing its effects and restoring the previous state.
1393
+ * Retrieve detailed information about a specific pseudo-terminal (PTY) session.
1534
1394
  */
1535
- revert(parameters, options) {
1395
+ get(parameters, options) {
1536
1396
  const params = buildClientParams([parameters], [
1537
1397
  {
1538
1398
  args: [
1539
- { in: "path", key: "sessionID" },
1399
+ { in: "path", key: "ptyID" },
1540
1400
  { in: "query", key: "directory" },
1541
1401
  { in: "query", key: "workspace" },
1542
- { in: "body", key: "messageID" },
1543
- { in: "body", key: "partID" },
1544
1402
  ],
1545
1403
  },
1546
1404
  ]);
1547
- return (options?.client ?? this.client).post({
1548
- url: "/session/{sessionID}/revert",
1405
+ return (options?.client ?? this.client).get({
1406
+ url: "/pty/{ptyID}",
1549
1407
  ...options,
1550
1408
  ...params,
1551
- headers: {
1552
- "Content-Type": "application/json",
1553
- ...options?.headers,
1554
- ...params.headers,
1555
- },
1556
1409
  });
1557
1410
  }
1558
1411
  /**
1559
- * Restore reverted messages
1412
+ * Update PTY session
1560
1413
  *
1561
- * Restore all previously reverted messages in a session.
1414
+ * Update properties of an existing pseudo-terminal (PTY) session.
1562
1415
  */
1563
- unrevert(parameters, options) {
1416
+ update(parameters, options) {
1564
1417
  const params = buildClientParams([parameters], [
1565
1418
  {
1566
1419
  args: [
1567
- { in: "path", key: "sessionID" },
1420
+ { in: "path", key: "ptyID" },
1568
1421
  { in: "query", key: "directory" },
1569
1422
  { in: "query", key: "workspace" },
1423
+ { in: "body", key: "title" },
1424
+ { in: "body", key: "size" },
1570
1425
  ],
1571
1426
  },
1572
1427
  ]);
1573
- return (options?.client ?? this.client).post({
1574
- url: "/session/{sessionID}/unrevert",
1428
+ return (options?.client ?? this.client).put({
1429
+ url: "/pty/{ptyID}",
1575
1430
  ...options,
1576
1431
  ...params,
1432
+ headers: {
1433
+ "Content-Type": "application/json",
1434
+ ...options?.headers,
1435
+ ...params.headers,
1436
+ },
1577
1437
  });
1578
1438
  }
1579
- }
1580
- export class Part extends HeyApiClient {
1581
1439
  /**
1582
- * Delete a part from a message
1440
+ * Connect to PTY session
1441
+ *
1442
+ * Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.
1583
1443
  */
1584
- delete(parameters, options) {
1444
+ connect(parameters, options) {
1585
1445
  const params = buildClientParams([parameters], [
1586
1446
  {
1587
1447
  args: [
1588
- { in: "path", key: "sessionID" },
1589
- { in: "path", key: "messageID" },
1590
- { in: "path", key: "partID" },
1448
+ { in: "path", key: "ptyID" },
1591
1449
  { in: "query", key: "directory" },
1592
1450
  { in: "query", key: "workspace" },
1593
1451
  ],
1594
1452
  },
1595
1453
  ]);
1596
- return (options?.client ?? this.client).delete({
1597
- url: "/session/{sessionID}/message/{messageID}/part/{partID}",
1454
+ return (options?.client ?? this.client).get({
1455
+ url: "/pty/{ptyID}/connect",
1598
1456
  ...options,
1599
1457
  ...params,
1600
1458
  });
1601
1459
  }
1460
+ }
1461
+ export class Question extends HeyApiClient {
1602
1462
  /**
1603
- * Update a part in a message
1463
+ * List pending questions
1464
+ *
1465
+ * Get all pending question requests across all sessions.
1604
1466
  */
1605
- update(parameters, options) {
1467
+ list(parameters, options) {
1606
1468
  const params = buildClientParams([parameters], [
1607
1469
  {
1608
1470
  args: [
1609
- { in: "path", key: "sessionID" },
1610
- { in: "path", key: "messageID" },
1611
- { in: "path", key: "partID" },
1612
1471
  { in: "query", key: "directory" },
1613
1472
  { in: "query", key: "workspace" },
1614
- { key: "part", map: "body" },
1615
1473
  ],
1616
1474
  },
1617
1475
  ]);
1618
- return (options?.client ?? this.client).patch({
1619
- url: "/session/{sessionID}/message/{messageID}/part/{partID}",
1476
+ return (options?.client ?? this.client).get({
1477
+ url: "/question",
1620
1478
  ...options,
1621
1479
  ...params,
1622
- headers: {
1623
- "Content-Type": "application/json",
1624
- ...options?.headers,
1625
- ...params.headers,
1626
- },
1627
1480
  });
1628
1481
  }
1629
- }
1630
- export class Permission extends HeyApiClient {
1631
1482
  /**
1632
- * Respond to permission
1633
- *
1634
- * Approve or deny a permission request from the AI assistant.
1483
+ * Reply to question request
1635
1484
  *
1636
- * @deprecated
1485
+ * Provide answers to a question request from the AI assistant.
1637
1486
  */
1638
- respond(parameters, options) {
1487
+ reply(parameters, options) {
1639
1488
  const params = buildClientParams([parameters], [
1640
1489
  {
1641
1490
  args: [
1642
- { in: "path", key: "sessionID" },
1643
- { in: "path", key: "permissionID" },
1491
+ { in: "path", key: "requestID" },
1644
1492
  { in: "query", key: "directory" },
1645
1493
  { in: "query", key: "workspace" },
1646
- { in: "body", key: "response" },
1494
+ { in: "body", key: "answers" },
1647
1495
  ],
1648
1496
  },
1649
1497
  ]);
1650
1498
  return (options?.client ?? this.client).post({
1651
- url: "/session/{sessionID}/permissions/{permissionID}",
1499
+ url: "/question/{requestID}/reply",
1652
1500
  ...options,
1653
1501
  ...params,
1654
1502
  headers: {
@@ -1659,33 +1507,28 @@ export class Permission extends HeyApiClient {
1659
1507
  });
1660
1508
  }
1661
1509
  /**
1662
- * Respond to permission request
1510
+ * Reject question request
1663
1511
  *
1664
- * Approve or deny a permission request from the AI assistant.
1512
+ * Reject a question request from the AI assistant.
1665
1513
  */
1666
- reply(parameters, options) {
1514
+ reject(parameters, options) {
1667
1515
  const params = buildClientParams([parameters], [
1668
1516
  {
1669
1517
  args: [
1670
1518
  { in: "path", key: "requestID" },
1671
1519
  { in: "query", key: "directory" },
1672
1520
  { in: "query", key: "workspace" },
1673
- { in: "body", key: "reply" },
1674
- { in: "body", key: "message" },
1675
1521
  ],
1676
1522
  },
1677
1523
  ]);
1678
1524
  return (options?.client ?? this.client).post({
1679
- url: "/permission/{requestID}/reply",
1525
+ url: "/question/{requestID}/reject",
1680
1526
  ...options,
1681
1527
  ...params,
1682
- headers: {
1683
- "Content-Type": "application/json",
1684
- ...options?.headers,
1685
- ...params.headers,
1686
- },
1687
1528
  });
1688
1529
  }
1530
+ }
1531
+ export class Permission extends HeyApiClient {
1689
1532
  /**
1690
1533
  * List pending permissions
1691
1534
  *
@@ -1706,46 +1549,25 @@ export class Permission extends HeyApiClient {
1706
1549
  ...params,
1707
1550
  });
1708
1551
  }
1709
- }
1710
- export class Question extends HeyApiClient {
1711
1552
  /**
1712
- * List pending questions
1553
+ * Respond to permission request
1713
1554
  *
1714
- * Get all pending question requests across all sessions.
1555
+ * Approve or deny a permission request from the AI assistant.
1715
1556
  */
1716
- list(parameters, options) {
1557
+ reply(parameters, options) {
1717
1558
  const params = buildClientParams([parameters], [
1718
1559
  {
1719
1560
  args: [
1561
+ { in: "path", key: "requestID" },
1720
1562
  { in: "query", key: "directory" },
1721
1563
  { in: "query", key: "workspace" },
1722
- ],
1723
- },
1724
- ]);
1725
- return (options?.client ?? this.client).get({
1726
- url: "/question",
1727
- ...options,
1728
- ...params,
1729
- });
1730
- }
1731
- /**
1732
- * Reply to question request
1733
- *
1734
- * Provide answers to a question request from the AI assistant.
1735
- */
1736
- reply(parameters, options) {
1737
- const params = buildClientParams([parameters], [
1738
- {
1739
- args: [
1740
- { in: "path", key: "requestID" },
1741
- { in: "query", key: "directory" },
1742
- { in: "query", key: "workspace" },
1743
- { in: "body", key: "answers" },
1564
+ { in: "body", key: "reply" },
1565
+ { in: "body", key: "message" },
1744
1566
  ],
1745
1567
  },
1746
1568
  ]);
1747
1569
  return (options?.client ?? this.client).post({
1748
- url: "/question/{requestID}/reply",
1570
+ url: "/permission/{requestID}/reply",
1749
1571
  ...options,
1750
1572
  ...params,
1751
1573
  headers: {
@@ -1756,32 +1578,41 @@ export class Question extends HeyApiClient {
1756
1578
  });
1757
1579
  }
1758
1580
  /**
1759
- * Reject question request
1581
+ * Respond to permission
1760
1582
  *
1761
- * Reject a question request from the AI assistant.
1583
+ * Approve or deny a permission request from the AI assistant.
1584
+ *
1585
+ * @deprecated
1762
1586
  */
1763
- reject(parameters, options) {
1587
+ respond(parameters, options) {
1764
1588
  const params = buildClientParams([parameters], [
1765
1589
  {
1766
1590
  args: [
1767
- { in: "path", key: "requestID" },
1591
+ { in: "path", key: "sessionID" },
1592
+ { in: "path", key: "permissionID" },
1768
1593
  { in: "query", key: "directory" },
1769
1594
  { in: "query", key: "workspace" },
1595
+ { in: "body", key: "response" },
1770
1596
  ],
1771
1597
  },
1772
1598
  ]);
1773
1599
  return (options?.client ?? this.client).post({
1774
- url: "/question/{requestID}/reject",
1600
+ url: "/session/{sessionID}/permissions/{permissionID}",
1775
1601
  ...options,
1776
1602
  ...params,
1603
+ headers: {
1604
+ "Content-Type": "application/json",
1605
+ ...options?.headers,
1606
+ ...params.headers,
1607
+ },
1777
1608
  });
1778
1609
  }
1779
1610
  }
1780
1611
  export class Oauth extends HeyApiClient {
1781
1612
  /**
1782
- * OAuth authorize
1613
+ * Start OAuth authorization
1783
1614
  *
1784
- * Initiate OAuth authorization for a specific AI provider to get an authorization URL.
1615
+ * Start the OAuth authorization flow for a provider.
1785
1616
  */
1786
1617
  authorize(parameters, options) {
1787
1618
  const params = buildClientParams([parameters], [
@@ -1807,7 +1638,7 @@ export class Oauth extends HeyApiClient {
1807
1638
  });
1808
1639
  }
1809
1640
  /**
1810
- * OAuth callback
1641
+ * Handle OAuth callback
1811
1642
  *
1812
1643
  * Handle the OAuth callback from a provider after user authorization.
1813
1644
  */
@@ -1881,11 +1712,11 @@ export class Provider extends HeyApiClient {
1881
1712
  return (this._oauth ??= new Oauth({ client: this.client }));
1882
1713
  }
1883
1714
  }
1884
- export class History extends HeyApiClient {
1715
+ export class Session2 extends HeyApiClient {
1885
1716
  /**
1886
- * List sync events
1717
+ * List sessions
1887
1718
  *
1888
- * List sync events for all aggregates. Keys are aggregate IDs the client already knows about, values are the last known sequence ID. Events with seq > value are returned for those aggregates. Aggregates not listed in the input get their full history.
1719
+ * Get a list of all OpenCode sessions, sorted by most recently updated.
1889
1720
  */
1890
1721
  list(parameters, options) {
1891
1722
  const params = buildClientParams([parameters], [
@@ -1893,69 +1724,43 @@ export class History extends HeyApiClient {
1893
1724
  args: [
1894
1725
  { in: "query", key: "directory" },
1895
1726
  { in: "query", key: "workspace" },
1896
- { key: "body", map: "body" },
1727
+ { in: "query", key: "scope" },
1728
+ { in: "query", key: "path" },
1729
+ { in: "query", key: "roots" },
1730
+ { in: "query", key: "start" },
1731
+ { in: "query", key: "search" },
1732
+ { in: "query", key: "limit" },
1897
1733
  ],
1898
1734
  },
1899
1735
  ]);
1900
- return (options?.client ?? this.client).post({
1901
- url: "/sync/history",
1736
+ return (options?.client ?? this.client).get({
1737
+ url: "/session",
1902
1738
  ...options,
1903
1739
  ...params,
1904
- headers: {
1905
- "Content-Type": "application/json",
1906
- ...options?.headers,
1907
- ...params.headers,
1908
- },
1909
1740
  });
1910
1741
  }
1911
- }
1912
- export class Sync extends HeyApiClient {
1913
1742
  /**
1914
- * Start workspace sync
1743
+ * Create session
1915
1744
  *
1916
- * Start sync loops for workspaces in the current project that have active sessions.
1745
+ * Create a new OpenCode session for interacting with AI assistants and managing conversations.
1917
1746
  */
1918
- start(parameters, options) {
1747
+ create(parameters, options) {
1919
1748
  const params = buildClientParams([parameters], [
1920
1749
  {
1921
1750
  args: [
1922
1751
  { in: "query", key: "directory" },
1923
1752
  { in: "query", key: "workspace" },
1753
+ { in: "body", key: "parentID" },
1754
+ { in: "body", key: "title" },
1755
+ { in: "body", key: "agent" },
1756
+ { in: "body", key: "model" },
1757
+ { in: "body", key: "permission" },
1758
+ { in: "body", key: "workspaceID" },
1924
1759
  ],
1925
1760
  },
1926
1761
  ]);
1927
1762
  return (options?.client ?? this.client).post({
1928
- url: "/sync/start",
1929
- ...options,
1930
- ...params,
1931
- });
1932
- }
1933
- /**
1934
- * Replay sync events
1935
- *
1936
- * Validate and replay a complete sync event history.
1937
- */
1938
- replay(parameters, options) {
1939
- const params = buildClientParams([parameters], [
1940
- {
1941
- args: [
1942
- {
1943
- in: "query",
1944
- key: "query_directory",
1945
- map: "directory",
1946
- },
1947
- { in: "query", key: "workspace" },
1948
- {
1949
- in: "body",
1950
- key: "body_directory",
1951
- map: "directory",
1952
- },
1953
- { in: "body", key: "events" },
1954
- ],
1955
- },
1956
- ]);
1957
- return (options?.client ?? this.client).post({
1958
- url: "/sync/replay",
1763
+ url: "/session",
1959
1764
  ...options,
1960
1765
  ...params,
1961
1766
  headers: {
@@ -1965,226 +1770,281 @@ export class Sync extends HeyApiClient {
1965
1770
  },
1966
1771
  });
1967
1772
  }
1968
- _history;
1969
- get history() {
1970
- return (this._history ??= new History({ client: this.client }));
1971
- }
1972
- }
1973
- export class Find extends HeyApiClient {
1974
1773
  /**
1975
- * Find text
1774
+ * Get session status
1976
1775
  *
1977
- * Search for text patterns across files in the project using ripgrep.
1776
+ * Retrieve the current status of all sessions, including active, idle, and completed states.
1978
1777
  */
1979
- text(parameters, options) {
1778
+ status(parameters, options) {
1980
1779
  const params = buildClientParams([parameters], [
1981
1780
  {
1982
1781
  args: [
1983
1782
  { in: "query", key: "directory" },
1984
1783
  { in: "query", key: "workspace" },
1985
- { in: "query", key: "pattern" },
1986
1784
  ],
1987
1785
  },
1988
1786
  ]);
1989
1787
  return (options?.client ?? this.client).get({
1990
- url: "/find",
1788
+ url: "/session/status",
1991
1789
  ...options,
1992
1790
  ...params,
1993
1791
  });
1994
1792
  }
1995
1793
  /**
1996
- * Find files
1794
+ * Delete session
1997
1795
  *
1998
- * Search for files or directories by name or pattern in the project directory.
1796
+ * Delete a session and permanently remove all associated data, including messages and history.
1999
1797
  */
2000
- files(parameters, options) {
1798
+ delete(parameters, options) {
2001
1799
  const params = buildClientParams([parameters], [
2002
1800
  {
2003
1801
  args: [
1802
+ { in: "path", key: "sessionID" },
2004
1803
  { in: "query", key: "directory" },
2005
1804
  { in: "query", key: "workspace" },
2006
- { in: "query", key: "query" },
2007
- { in: "query", key: "dirs" },
2008
- { in: "query", key: "type" },
2009
- { in: "query", key: "limit" },
2010
1805
  ],
2011
1806
  },
2012
1807
  ]);
2013
- return (options?.client ?? this.client).get({
2014
- url: "/find/file",
1808
+ return (options?.client ?? this.client).delete({
1809
+ url: "/session/{sessionID}",
2015
1810
  ...options,
2016
1811
  ...params,
2017
1812
  });
2018
1813
  }
2019
1814
  /**
2020
- * Find symbols
1815
+ * Get session
2021
1816
  *
2022
- * Search for workspace symbols like functions, classes, and variables using LSP.
1817
+ * Retrieve detailed information about a specific OpenCode session.
2023
1818
  */
2024
- symbols(parameters, options) {
1819
+ get(parameters, options) {
2025
1820
  const params = buildClientParams([parameters], [
2026
1821
  {
2027
1822
  args: [
1823
+ { in: "path", key: "sessionID" },
2028
1824
  { in: "query", key: "directory" },
2029
1825
  { in: "query", key: "workspace" },
2030
- { in: "query", key: "query" },
2031
1826
  ],
2032
1827
  },
2033
1828
  ]);
2034
1829
  return (options?.client ?? this.client).get({
2035
- url: "/find/symbol",
1830
+ url: "/session/{sessionID}",
2036
1831
  ...options,
2037
1832
  ...params,
2038
1833
  });
2039
1834
  }
2040
- }
2041
- export class File extends HeyApiClient {
2042
1835
  /**
2043
- * List files
1836
+ * Update session
2044
1837
  *
2045
- * List files and directories in a specified path.
1838
+ * Update properties of an existing session, such as title or other metadata.
2046
1839
  */
2047
- list(parameters, options) {
1840
+ update(parameters, options) {
2048
1841
  const params = buildClientParams([parameters], [
2049
1842
  {
2050
1843
  args: [
1844
+ { in: "path", key: "sessionID" },
2051
1845
  { in: "query", key: "directory" },
2052
1846
  { in: "query", key: "workspace" },
2053
- { in: "query", key: "path" },
1847
+ { in: "body", key: "title" },
1848
+ { in: "body", key: "permission" },
1849
+ { in: "body", key: "time" },
2054
1850
  ],
2055
1851
  },
2056
1852
  ]);
2057
- return (options?.client ?? this.client).get({
2058
- url: "/file",
1853
+ return (options?.client ?? this.client).patch({
1854
+ url: "/session/{sessionID}",
2059
1855
  ...options,
2060
1856
  ...params,
1857
+ headers: {
1858
+ "Content-Type": "application/json",
1859
+ ...options?.headers,
1860
+ ...params.headers,
1861
+ },
2061
1862
  });
2062
1863
  }
2063
1864
  /**
2064
- * Read file
1865
+ * Get session children
2065
1866
  *
2066
- * Read the content of a specified file.
1867
+ * Retrieve all child sessions that were forked from the specified parent session.
2067
1868
  */
2068
- read(parameters, options) {
1869
+ children(parameters, options) {
2069
1870
  const params = buildClientParams([parameters], [
2070
1871
  {
2071
1872
  args: [
1873
+ { in: "path", key: "sessionID" },
2072
1874
  { in: "query", key: "directory" },
2073
1875
  { in: "query", key: "workspace" },
2074
- { in: "query", key: "path" },
2075
1876
  ],
2076
1877
  },
2077
1878
  ]);
2078
1879
  return (options?.client ?? this.client).get({
2079
- url: "/file/content",
1880
+ url: "/session/{sessionID}/children",
2080
1881
  ...options,
2081
1882
  ...params,
2082
1883
  });
2083
1884
  }
2084
1885
  /**
2085
- * Get file status
1886
+ * Get session todos
2086
1887
  *
2087
- * Get the git status of all files in the project.
1888
+ * Retrieve the todo list associated with a specific session, showing tasks and action items.
2088
1889
  */
2089
- status(parameters, options) {
1890
+ todo(parameters, options) {
2090
1891
  const params = buildClientParams([parameters], [
2091
1892
  {
2092
1893
  args: [
1894
+ { in: "path", key: "sessionID" },
2093
1895
  { in: "query", key: "directory" },
2094
1896
  { in: "query", key: "workspace" },
2095
1897
  ],
2096
1898
  },
2097
1899
  ]);
2098
1900
  return (options?.client ?? this.client).get({
2099
- url: "/file/status",
1901
+ url: "/session/{sessionID}/todo",
2100
1902
  ...options,
2101
1903
  ...params,
2102
1904
  });
2103
1905
  }
2104
- }
2105
- export class Event extends HeyApiClient {
2106
1906
  /**
2107
- * Subscribe to events
1907
+ * Get message diff
2108
1908
  *
2109
- * Get events
1909
+ * Get the file changes (diff) that resulted from a specific user message in the session.
2110
1910
  */
2111
- subscribe(parameters, options) {
1911
+ diff(parameters, options) {
2112
1912
  const params = buildClientParams([parameters], [
2113
1913
  {
2114
1914
  args: [
1915
+ { in: "path", key: "sessionID" },
2115
1916
  { in: "query", key: "directory" },
2116
1917
  { in: "query", key: "workspace" },
1918
+ { in: "query", key: "messageID" },
2117
1919
  ],
2118
1920
  },
2119
1921
  ]);
2120
- return (options?.client ?? this.client).sse.get({
2121
- url: "/event",
1922
+ return (options?.client ?? this.client).get({
1923
+ url: "/session/{sessionID}/diff",
2122
1924
  ...options,
2123
1925
  ...params,
2124
1926
  });
2125
1927
  }
2126
- }
2127
- export class Auth2 extends HeyApiClient {
2128
1928
  /**
2129
- * Remove MCP OAuth
1929
+ * Get session messages
2130
1930
  *
2131
- * Remove OAuth credentials for an MCP server
1931
+ * Retrieve all messages in a session, including user prompts and AI responses.
2132
1932
  */
2133
- remove(parameters, options) {
1933
+ messages(parameters, options) {
2134
1934
  const params = buildClientParams([parameters], [
2135
1935
  {
2136
1936
  args: [
2137
- { in: "path", key: "name" },
1937
+ { in: "path", key: "sessionID" },
2138
1938
  { in: "query", key: "directory" },
2139
1939
  { in: "query", key: "workspace" },
1940
+ { in: "query", key: "limit" },
1941
+ { in: "query", key: "before" },
2140
1942
  ],
2141
1943
  },
2142
1944
  ]);
2143
- return (options?.client ?? this.client).delete({
2144
- url: "/mcp/{name}/auth",
1945
+ return (options?.client ?? this.client).get({
1946
+ url: "/session/{sessionID}/message",
2145
1947
  ...options,
2146
1948
  ...params,
2147
1949
  });
2148
1950
  }
2149
1951
  /**
2150
- * Start MCP OAuth
1952
+ * Send message
2151
1953
  *
2152
- * Start OAuth authentication flow for a Model Context Protocol (MCP) server.
1954
+ * Create and send a new message to a session, streaming the AI response.
2153
1955
  */
2154
- start(parameters, options) {
1956
+ prompt(parameters, options) {
2155
1957
  const params = buildClientParams([parameters], [
2156
1958
  {
2157
1959
  args: [
2158
- { in: "path", key: "name" },
1960
+ { in: "path", key: "sessionID" },
2159
1961
  { in: "query", key: "directory" },
2160
1962
  { in: "query", key: "workspace" },
1963
+ { in: "body", key: "messageID" },
1964
+ { in: "body", key: "model" },
1965
+ { in: "body", key: "agent" },
1966
+ { in: "body", key: "noReply" },
1967
+ { in: "body", key: "tools" },
1968
+ { in: "body", key: "format" },
1969
+ { in: "body", key: "system" },
1970
+ { in: "body", key: "variant" },
1971
+ { in: "body", key: "parts" },
2161
1972
  ],
2162
1973
  },
2163
1974
  ]);
2164
1975
  return (options?.client ?? this.client).post({
2165
- url: "/mcp/{name}/auth",
1976
+ url: "/session/{sessionID}/message",
2166
1977
  ...options,
2167
1978
  ...params,
1979
+ headers: {
1980
+ "Content-Type": "application/json",
1981
+ ...options?.headers,
1982
+ ...params.headers,
1983
+ },
2168
1984
  });
2169
1985
  }
2170
1986
  /**
2171
- * Complete MCP OAuth
1987
+ * Delete message
2172
1988
  *
2173
- * Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code.
1989
+ * Permanently delete a specific message and all of its parts from a session without reverting file changes.
2174
1990
  */
2175
- callback(parameters, options) {
1991
+ deleteMessage(parameters, options) {
2176
1992
  const params = buildClientParams([parameters], [
2177
1993
  {
2178
1994
  args: [
2179
- { in: "path", key: "name" },
1995
+ { in: "path", key: "sessionID" },
1996
+ { in: "path", key: "messageID" },
2180
1997
  { in: "query", key: "directory" },
2181
1998
  { in: "query", key: "workspace" },
2182
- { in: "body", key: "code" },
2183
1999
  ],
2184
2000
  },
2185
2001
  ]);
2186
- return (options?.client ?? this.client).post({
2187
- url: "/mcp/{name}/auth/callback",
2002
+ return (options?.client ?? this.client).delete({
2003
+ url: "/session/{sessionID}/message/{messageID}",
2004
+ ...options,
2005
+ ...params,
2006
+ });
2007
+ }
2008
+ /**
2009
+ * Get message
2010
+ *
2011
+ * Retrieve a specific message from a session by its message ID.
2012
+ */
2013
+ message(parameters, options) {
2014
+ const params = buildClientParams([parameters], [
2015
+ {
2016
+ args: [
2017
+ { in: "path", key: "sessionID" },
2018
+ { in: "path", key: "messageID" },
2019
+ { in: "query", key: "directory" },
2020
+ { in: "query", key: "workspace" },
2021
+ ],
2022
+ },
2023
+ ]);
2024
+ return (options?.client ?? this.client).get({
2025
+ url: "/session/{sessionID}/message/{messageID}",
2026
+ ...options,
2027
+ ...params,
2028
+ });
2029
+ }
2030
+ /**
2031
+ * Fork session
2032
+ *
2033
+ * Create a new session by forking an existing session at a specific message point.
2034
+ */
2035
+ fork(parameters, options) {
2036
+ const params = buildClientParams([parameters], [
2037
+ {
2038
+ args: [
2039
+ { in: "path", key: "sessionID" },
2040
+ { in: "query", key: "directory" },
2041
+ { in: "query", key: "workspace" },
2042
+ { in: "body", key: "messageID" },
2043
+ ],
2044
+ },
2045
+ ]);
2046
+ return (options?.client ?? this.client).post({
2047
+ url: "/session/{sessionID}/fork",
2188
2048
  ...options,
2189
2049
  ...params,
2190
2050
  headers: {
@@ -2195,34 +2055,420 @@ export class Auth2 extends HeyApiClient {
2195
2055
  });
2196
2056
  }
2197
2057
  /**
2198
- * Authenticate MCP OAuth
2058
+ * Abort session
2199
2059
  *
2200
- * Start OAuth flow and wait for callback (opens browser)
2060
+ * Abort an active session and stop any ongoing AI processing or command execution.
2201
2061
  */
2202
- authenticate(parameters, options) {
2062
+ abort(parameters, options) {
2203
2063
  const params = buildClientParams([parameters], [
2204
2064
  {
2205
2065
  args: [
2206
- { in: "path", key: "name" },
2066
+ { in: "path", key: "sessionID" },
2207
2067
  { in: "query", key: "directory" },
2208
2068
  { in: "query", key: "workspace" },
2209
2069
  ],
2210
2070
  },
2211
2071
  ]);
2212
2072
  return (options?.client ?? this.client).post({
2213
- url: "/mcp/{name}/auth/authenticate",
2073
+ url: "/session/{sessionID}/abort",
2074
+ ...options,
2075
+ ...params,
2076
+ });
2077
+ }
2078
+ /**
2079
+ * Initialize session
2080
+ *
2081
+ * Analyze the current application and create an AGENTS.md file with project-specific agent configurations.
2082
+ */
2083
+ init(parameters, options) {
2084
+ const params = buildClientParams([parameters], [
2085
+ {
2086
+ args: [
2087
+ { in: "path", key: "sessionID" },
2088
+ { in: "query", key: "directory" },
2089
+ { in: "query", key: "workspace" },
2090
+ { in: "body", key: "modelID" },
2091
+ { in: "body", key: "providerID" },
2092
+ { in: "body", key: "messageID" },
2093
+ ],
2094
+ },
2095
+ ]);
2096
+ return (options?.client ?? this.client).post({
2097
+ url: "/session/{sessionID}/init",
2098
+ ...options,
2099
+ ...params,
2100
+ headers: {
2101
+ "Content-Type": "application/json",
2102
+ ...options?.headers,
2103
+ ...params.headers,
2104
+ },
2105
+ });
2106
+ }
2107
+ /**
2108
+ * Unshare session
2109
+ *
2110
+ * Remove the shareable link for a session, making it private again.
2111
+ */
2112
+ unshare(parameters, options) {
2113
+ const params = buildClientParams([parameters], [
2114
+ {
2115
+ args: [
2116
+ { in: "path", key: "sessionID" },
2117
+ { in: "query", key: "directory" },
2118
+ { in: "query", key: "workspace" },
2119
+ ],
2120
+ },
2121
+ ]);
2122
+ return (options?.client ?? this.client).delete({
2123
+ url: "/session/{sessionID}/share",
2124
+ ...options,
2125
+ ...params,
2126
+ });
2127
+ }
2128
+ /**
2129
+ * Share session
2130
+ *
2131
+ * Create a shareable link for a session, allowing others to view the conversation.
2132
+ */
2133
+ share(parameters, options) {
2134
+ const params = buildClientParams([parameters], [
2135
+ {
2136
+ args: [
2137
+ { in: "path", key: "sessionID" },
2138
+ { in: "query", key: "directory" },
2139
+ { in: "query", key: "workspace" },
2140
+ ],
2141
+ },
2142
+ ]);
2143
+ return (options?.client ?? this.client).post({
2144
+ url: "/session/{sessionID}/share",
2145
+ ...options,
2146
+ ...params,
2147
+ });
2148
+ }
2149
+ /**
2150
+ * Summarize session
2151
+ *
2152
+ * Generate a concise summary of the session using AI compaction to preserve key information.
2153
+ */
2154
+ summarize(parameters, options) {
2155
+ const params = buildClientParams([parameters], [
2156
+ {
2157
+ args: [
2158
+ { in: "path", key: "sessionID" },
2159
+ { in: "query", key: "directory" },
2160
+ { in: "query", key: "workspace" },
2161
+ { in: "body", key: "providerID" },
2162
+ { in: "body", key: "modelID" },
2163
+ { in: "body", key: "auto" },
2164
+ ],
2165
+ },
2166
+ ]);
2167
+ return (options?.client ?? this.client).post({
2168
+ url: "/session/{sessionID}/summarize",
2169
+ ...options,
2170
+ ...params,
2171
+ headers: {
2172
+ "Content-Type": "application/json",
2173
+ ...options?.headers,
2174
+ ...params.headers,
2175
+ },
2176
+ });
2177
+ }
2178
+ /**
2179
+ * Send async message
2180
+ *
2181
+ * Create and send a new message to a session asynchronously, starting the session if needed and returning immediately.
2182
+ */
2183
+ promptAsync(parameters, options) {
2184
+ const params = buildClientParams([parameters], [
2185
+ {
2186
+ args: [
2187
+ { in: "path", key: "sessionID" },
2188
+ { in: "query", key: "directory" },
2189
+ { in: "query", key: "workspace" },
2190
+ { in: "body", key: "messageID" },
2191
+ { in: "body", key: "model" },
2192
+ { in: "body", key: "agent" },
2193
+ { in: "body", key: "noReply" },
2194
+ { in: "body", key: "tools" },
2195
+ { in: "body", key: "format" },
2196
+ { in: "body", key: "system" },
2197
+ { in: "body", key: "variant" },
2198
+ { in: "body", key: "parts" },
2199
+ ],
2200
+ },
2201
+ ]);
2202
+ return (options?.client ?? this.client).post({
2203
+ url: "/session/{sessionID}/prompt_async",
2204
+ ...options,
2205
+ ...params,
2206
+ headers: {
2207
+ "Content-Type": "application/json",
2208
+ ...options?.headers,
2209
+ ...params.headers,
2210
+ },
2211
+ });
2212
+ }
2213
+ /**
2214
+ * Send command
2215
+ *
2216
+ * Send a new command to a session for execution by the AI assistant.
2217
+ */
2218
+ command(parameters, options) {
2219
+ const params = buildClientParams([parameters], [
2220
+ {
2221
+ args: [
2222
+ { in: "path", key: "sessionID" },
2223
+ { in: "query", key: "directory" },
2224
+ { in: "query", key: "workspace" },
2225
+ { in: "body", key: "messageID" },
2226
+ { in: "body", key: "agent" },
2227
+ { in: "body", key: "model" },
2228
+ { in: "body", key: "arguments" },
2229
+ { in: "body", key: "command" },
2230
+ { in: "body", key: "variant" },
2231
+ { in: "body", key: "parts" },
2232
+ ],
2233
+ },
2234
+ ]);
2235
+ return (options?.client ?? this.client).post({
2236
+ url: "/session/{sessionID}/command",
2237
+ ...options,
2238
+ ...params,
2239
+ headers: {
2240
+ "Content-Type": "application/json",
2241
+ ...options?.headers,
2242
+ ...params.headers,
2243
+ },
2244
+ });
2245
+ }
2246
+ /**
2247
+ * Run shell command
2248
+ *
2249
+ * Execute a shell command within the session context and return the AI's response.
2250
+ */
2251
+ shell(parameters, options) {
2252
+ const params = buildClientParams([parameters], [
2253
+ {
2254
+ args: [
2255
+ { in: "path", key: "sessionID" },
2256
+ { in: "query", key: "directory" },
2257
+ { in: "query", key: "workspace" },
2258
+ { in: "body", key: "messageID" },
2259
+ { in: "body", key: "agent" },
2260
+ { in: "body", key: "model" },
2261
+ { in: "body", key: "command" },
2262
+ ],
2263
+ },
2264
+ ]);
2265
+ return (options?.client ?? this.client).post({
2266
+ url: "/session/{sessionID}/shell",
2267
+ ...options,
2268
+ ...params,
2269
+ headers: {
2270
+ "Content-Type": "application/json",
2271
+ ...options?.headers,
2272
+ ...params.headers,
2273
+ },
2274
+ });
2275
+ }
2276
+ /**
2277
+ * Revert message
2278
+ *
2279
+ * Revert a specific message in a session, undoing its effects and restoring the previous state.
2280
+ */
2281
+ revert(parameters, options) {
2282
+ const params = buildClientParams([parameters], [
2283
+ {
2284
+ args: [
2285
+ { in: "path", key: "sessionID" },
2286
+ { in: "query", key: "directory" },
2287
+ { in: "query", key: "workspace" },
2288
+ { in: "body", key: "messageID" },
2289
+ { in: "body", key: "partID" },
2290
+ ],
2291
+ },
2292
+ ]);
2293
+ return (options?.client ?? this.client).post({
2294
+ url: "/session/{sessionID}/revert",
2295
+ ...options,
2296
+ ...params,
2297
+ headers: {
2298
+ "Content-Type": "application/json",
2299
+ ...options?.headers,
2300
+ ...params.headers,
2301
+ },
2302
+ });
2303
+ }
2304
+ /**
2305
+ * Restore reverted messages
2306
+ *
2307
+ * Restore all previously reverted messages in a session.
2308
+ */
2309
+ unrevert(parameters, options) {
2310
+ const params = buildClientParams([parameters], [
2311
+ {
2312
+ args: [
2313
+ { in: "path", key: "sessionID" },
2314
+ { in: "query", key: "directory" },
2315
+ { in: "query", key: "workspace" },
2316
+ ],
2317
+ },
2318
+ ]);
2319
+ return (options?.client ?? this.client).post({
2320
+ url: "/session/{sessionID}/unrevert",
2214
2321
  ...options,
2215
2322
  ...params,
2216
2323
  });
2217
2324
  }
2218
2325
  }
2219
- export class Mcp extends HeyApiClient {
2326
+ export class Part extends HeyApiClient {
2220
2327
  /**
2221
- * Get MCP status
2328
+ * Delete a part from a message.
2329
+ */
2330
+ delete(parameters, options) {
2331
+ const params = buildClientParams([parameters], [
2332
+ {
2333
+ args: [
2334
+ { in: "path", key: "sessionID" },
2335
+ { in: "path", key: "messageID" },
2336
+ { in: "path", key: "partID" },
2337
+ { in: "query", key: "directory" },
2338
+ { in: "query", key: "workspace" },
2339
+ ],
2340
+ },
2341
+ ]);
2342
+ return (options?.client ?? this.client).delete({
2343
+ url: "/session/{sessionID}/message/{messageID}/part/{partID}",
2344
+ ...options,
2345
+ ...params,
2346
+ });
2347
+ }
2348
+ /**
2349
+ * Update a part in a message.
2350
+ */
2351
+ update(parameters, options) {
2352
+ const params = buildClientParams([parameters], [
2353
+ {
2354
+ args: [
2355
+ { in: "path", key: "sessionID" },
2356
+ { in: "path", key: "messageID" },
2357
+ { in: "path", key: "partID" },
2358
+ { in: "query", key: "directory" },
2359
+ { in: "query", key: "workspace" },
2360
+ { key: "part", map: "body" },
2361
+ ],
2362
+ },
2363
+ ]);
2364
+ return (options?.client ?? this.client).patch({
2365
+ url: "/session/{sessionID}/message/{messageID}/part/{partID}",
2366
+ ...options,
2367
+ ...params,
2368
+ headers: {
2369
+ "Content-Type": "application/json",
2370
+ ...options?.headers,
2371
+ ...params.headers,
2372
+ },
2373
+ });
2374
+ }
2375
+ }
2376
+ export class History extends HeyApiClient {
2377
+ /**
2378
+ * List sync events
2222
2379
  *
2223
- * Get the status of all Model Context Protocol (MCP) servers.
2380
+ * List sync events for all aggregates. Keys are aggregate IDs the client already knows about, values are the last known sequence ID. Events with seq > value are returned for those aggregates. Aggregates not listed in the input get their full history.
2224
2381
  */
2225
- status(parameters, options) {
2382
+ list(parameters, options) {
2383
+ const params = buildClientParams([parameters], [
2384
+ {
2385
+ args: [
2386
+ { in: "query", key: "directory" },
2387
+ { in: "query", key: "workspace" },
2388
+ { key: "body", map: "body" },
2389
+ ],
2390
+ },
2391
+ ]);
2392
+ return (options?.client ?? this.client).post({
2393
+ url: "/sync/history",
2394
+ ...options,
2395
+ ...params,
2396
+ headers: {
2397
+ "Content-Type": "application/json",
2398
+ ...options?.headers,
2399
+ ...params.headers,
2400
+ },
2401
+ });
2402
+ }
2403
+ }
2404
+ export class Sync extends HeyApiClient {
2405
+ /**
2406
+ * Start workspace sync
2407
+ *
2408
+ * Start sync loops for workspaces in the current project that have active sessions.
2409
+ */
2410
+ start(parameters, options) {
2411
+ const params = buildClientParams([parameters], [
2412
+ {
2413
+ args: [
2414
+ { in: "query", key: "directory" },
2415
+ { in: "query", key: "workspace" },
2416
+ ],
2417
+ },
2418
+ ]);
2419
+ return (options?.client ?? this.client).post({
2420
+ url: "/sync/start",
2421
+ ...options,
2422
+ ...params,
2423
+ });
2424
+ }
2425
+ /**
2426
+ * Replay sync events
2427
+ *
2428
+ * Validate and replay a complete sync event history.
2429
+ */
2430
+ replay(parameters, options) {
2431
+ const params = buildClientParams([parameters], [
2432
+ {
2433
+ args: [
2434
+ {
2435
+ in: "query",
2436
+ key: "query_directory",
2437
+ map: "directory",
2438
+ },
2439
+ { in: "query", key: "workspace" },
2440
+ {
2441
+ in: "body",
2442
+ key: "body_directory",
2443
+ map: "directory",
2444
+ },
2445
+ { in: "body", key: "events" },
2446
+ ],
2447
+ },
2448
+ ]);
2449
+ return (options?.client ?? this.client).post({
2450
+ url: "/sync/replay",
2451
+ ...options,
2452
+ ...params,
2453
+ headers: {
2454
+ "Content-Type": "application/json",
2455
+ ...options?.headers,
2456
+ ...params.headers,
2457
+ },
2458
+ });
2459
+ }
2460
+ _history;
2461
+ get history() {
2462
+ return (this._history ??= new History({ client: this.client }));
2463
+ }
2464
+ }
2465
+ export class Session3 extends HeyApiClient {
2466
+ /**
2467
+ * List v2 sessions
2468
+ *
2469
+ * Retrieve sessions in the requested order. Items keep that order across pages; use cursor.next or cursor.previous to move through the ordered list.
2470
+ */
2471
+ list(parameters, options) {
2226
2472
  const params = buildClientParams([parameters], [
2227
2473
  {
2228
2474
  args: [
@@ -2232,29 +2478,30 @@ export class Mcp extends HeyApiClient {
2232
2478
  },
2233
2479
  ]);
2234
2480
  return (options?.client ?? this.client).get({
2235
- url: "/mcp",
2481
+ url: "/api/session",
2236
2482
  ...options,
2237
2483
  ...params,
2238
2484
  });
2239
2485
  }
2240
2486
  /**
2241
- * Add MCP server
2487
+ * Send v2 message
2242
2488
  *
2243
- * Dynamically add a new Model Context Protocol (MCP) server to the system.
2489
+ * Create a v2 session message and queue it for the agent loop.
2244
2490
  */
2245
- add(parameters, options) {
2491
+ prompt(parameters, options) {
2246
2492
  const params = buildClientParams([parameters], [
2247
2493
  {
2248
2494
  args: [
2495
+ { in: "path", key: "sessionID" },
2249
2496
  { in: "query", key: "directory" },
2250
2497
  { in: "query", key: "workspace" },
2251
- { in: "body", key: "name" },
2252
- { in: "body", key: "config" },
2498
+ { in: "body", key: "prompt" },
2499
+ { in: "body", key: "delivery" },
2253
2500
  ],
2254
2501
  },
2255
2502
  ]);
2256
2503
  return (options?.client ?? this.client).post({
2257
- url: "/mcp",
2504
+ url: "/api/session/{sessionID}/prompt",
2258
2505
  ...options,
2259
2506
  ...params,
2260
2507
  headers: {
@@ -2265,53 +2512,101 @@ export class Mcp extends HeyApiClient {
2265
2512
  });
2266
2513
  }
2267
2514
  /**
2268
- * Connect an MCP server
2515
+ * Compact v2 session
2516
+ *
2517
+ * Compact a v2 session conversation.
2269
2518
  */
2270
- connect(parameters, options) {
2519
+ compact(parameters, options) {
2271
2520
  const params = buildClientParams([parameters], [
2272
2521
  {
2273
2522
  args: [
2274
- { in: "path", key: "name" },
2523
+ { in: "path", key: "sessionID" },
2275
2524
  { in: "query", key: "directory" },
2276
2525
  { in: "query", key: "workspace" },
2277
2526
  ],
2278
2527
  },
2279
2528
  ]);
2280
2529
  return (options?.client ?? this.client).post({
2281
- url: "/mcp/{name}/connect",
2530
+ url: "/api/session/{sessionID}/compact",
2282
2531
  ...options,
2283
2532
  ...params,
2284
2533
  });
2285
2534
  }
2286
2535
  /**
2287
- * Disconnect an MCP server
2536
+ * Wait for v2 session
2537
+ *
2538
+ * Wait for a v2 session agent loop to become idle.
2288
2539
  */
2289
- disconnect(parameters, options) {
2540
+ wait(parameters, options) {
2290
2541
  const params = buildClientParams([parameters], [
2291
2542
  {
2292
2543
  args: [
2293
- { in: "path", key: "name" },
2544
+ { in: "path", key: "sessionID" },
2294
2545
  { in: "query", key: "directory" },
2295
2546
  { in: "query", key: "workspace" },
2296
2547
  ],
2297
2548
  },
2298
2549
  ]);
2299
2550
  return (options?.client ?? this.client).post({
2300
- url: "/mcp/{name}/disconnect",
2551
+ url: "/api/session/{sessionID}/wait",
2301
2552
  ...options,
2302
2553
  ...params,
2303
2554
  });
2304
2555
  }
2305
- _auth;
2306
- get auth() {
2307
- return (this._auth ??= new Auth2({ client: this.client }));
2556
+ /**
2557
+ * Get v2 session context
2558
+ *
2559
+ * Retrieve the active context messages for a v2 session (all messages after the last compaction).
2560
+ */
2561
+ context(parameters, options) {
2562
+ const params = buildClientParams([parameters], [
2563
+ {
2564
+ args: [
2565
+ { in: "path", key: "sessionID" },
2566
+ { in: "query", key: "directory" },
2567
+ { in: "query", key: "workspace" },
2568
+ ],
2569
+ },
2570
+ ]);
2571
+ return (options?.client ?? this.client).get({
2572
+ url: "/api/session/{sessionID}/context",
2573
+ ...options,
2574
+ ...params,
2575
+ });
2576
+ }
2577
+ /**
2578
+ * Get v2 session messages
2579
+ *
2580
+ * Retrieve projected v2 messages for a session. Items keep the requested order across pages; use cursor.next or cursor.previous to move through the ordered timeline.
2581
+ */
2582
+ messages(parameters, options) {
2583
+ const params = buildClientParams([parameters], [
2584
+ {
2585
+ args: [
2586
+ { in: "path", key: "sessionID" },
2587
+ { in: "query", key: "directory" },
2588
+ { in: "query", key: "workspace" },
2589
+ ],
2590
+ },
2591
+ ]);
2592
+ return (options?.client ?? this.client).get({
2593
+ url: "/api/session/{sessionID}/message",
2594
+ ...options,
2595
+ ...params,
2596
+ });
2597
+ }
2598
+ }
2599
+ export class V2 extends HeyApiClient {
2600
+ _session;
2601
+ get session() {
2602
+ return (this._session ??= new Session3({ client: this.client }));
2308
2603
  }
2309
2604
  }
2310
2605
  export class Control extends HeyApiClient {
2311
2606
  /**
2312
2607
  * Get next TUI request
2313
2608
  *
2314
- * Retrieve the next TUI (Terminal User Interface) request from the queue for processing.
2609
+ * Retrieve the next TUI request from the queue for processing.
2315
2610
  */
2316
2611
  next(parameters, options) {
2317
2612
  const params = buildClientParams([parameters], [
@@ -2359,7 +2654,7 @@ export class Tui extends HeyApiClient {
2359
2654
  /**
2360
2655
  * Append TUI prompt
2361
2656
  *
2362
- * Append prompt to the TUI
2657
+ * Append prompt to the TUI.
2363
2658
  */
2364
2659
  appendPrompt(parameters, options) {
2365
2660
  const params = buildClientParams([parameters], [
@@ -2405,7 +2700,7 @@ export class Tui extends HeyApiClient {
2405
2700
  /**
2406
2701
  * Open sessions dialog
2407
2702
  *
2408
- * Open the session dialog
2703
+ * Open the session dialog.
2409
2704
  */
2410
2705
  openSessions(parameters, options) {
2411
2706
  const params = buildClientParams([parameters], [
@@ -2425,7 +2720,7 @@ export class Tui extends HeyApiClient {
2425
2720
  /**
2426
2721
  * Open themes dialog
2427
2722
  *
2428
- * Open the theme dialog
2723
+ * Open the theme dialog.
2429
2724
  */
2430
2725
  openThemes(parameters, options) {
2431
2726
  const params = buildClientParams([parameters], [
@@ -2445,7 +2740,7 @@ export class Tui extends HeyApiClient {
2445
2740
  /**
2446
2741
  * Open models dialog
2447
2742
  *
2448
- * Open the model dialog
2743
+ * Open the model dialog.
2449
2744
  */
2450
2745
  openModels(parameters, options) {
2451
2746
  const params = buildClientParams([parameters], [
@@ -2465,7 +2760,7 @@ export class Tui extends HeyApiClient {
2465
2760
  /**
2466
2761
  * Submit TUI prompt
2467
2762
  *
2468
- * Submit the prompt
2763
+ * Submit the prompt.
2469
2764
  */
2470
2765
  submitPrompt(parameters, options) {
2471
2766
  const params = buildClientParams([parameters], [
@@ -2485,7 +2780,7 @@ export class Tui extends HeyApiClient {
2485
2780
  /**
2486
2781
  * Clear TUI prompt
2487
2782
  *
2488
- * Clear the prompt
2783
+ * Clear the prompt.
2489
2784
  */
2490
2785
  clearPrompt(parameters, options) {
2491
2786
  const params = buildClientParams([parameters], [
@@ -2505,7 +2800,7 @@ export class Tui extends HeyApiClient {
2505
2800
  /**
2506
2801
  * Execute TUI command
2507
2802
  *
2508
- * Execute a TUI command (e.g. agent_cycle)
2803
+ * Execute a TUI command.
2509
2804
  */
2510
2805
  executeCommand(parameters, options) {
2511
2806
  const params = buildClientParams([parameters], [
@@ -2531,7 +2826,7 @@ export class Tui extends HeyApiClient {
2531
2826
  /**
2532
2827
  * Show TUI toast
2533
2828
  *
2534
- * Show a toast notification in the TUI
2829
+ * Show a toast notification in the TUI.
2535
2830
  */
2536
2831
  showToast(parameters, options) {
2537
2832
  const params = buildClientParams([parameters], [
@@ -2560,7 +2855,7 @@ export class Tui extends HeyApiClient {
2560
2855
  /**
2561
2856
  * Publish TUI event
2562
2857
  *
2563
- * Publish a TUI event
2858
+ * Publish a TUI event.
2564
2859
  */
2565
2860
  publish(parameters, options) {
2566
2861
  const params = buildClientParams([parameters], [
@@ -2614,169 +2909,12 @@ export class Tui extends HeyApiClient {
2614
2909
  return (this._control ??= new Control({ client: this.client }));
2615
2910
  }
2616
2911
  }
2617
- export class Instance extends HeyApiClient {
2618
- /**
2619
- * Dispose instance
2620
- *
2621
- * Clean up and dispose the current OpenCode instance, releasing all resources.
2622
- */
2623
- dispose(parameters, options) {
2624
- const params = buildClientParams([parameters], [
2625
- {
2626
- args: [
2627
- { in: "query", key: "directory" },
2628
- { in: "query", key: "workspace" },
2629
- ],
2630
- },
2631
- ]);
2632
- return (options?.client ?? this.client).post({
2633
- url: "/instance/dispose",
2634
- ...options,
2635
- ...params,
2636
- });
2637
- }
2638
- }
2639
- export class Path extends HeyApiClient {
2640
- /**
2641
- * Get paths
2642
- *
2643
- * Retrieve the current working directory and related path information for the OpenCode instance.
2644
- */
2645
- get(parameters, options) {
2646
- const params = buildClientParams([parameters], [
2647
- {
2648
- args: [
2649
- { in: "query", key: "directory" },
2650
- { in: "query", key: "workspace" },
2651
- ],
2652
- },
2653
- ]);
2654
- return (options?.client ?? this.client).get({
2655
- url: "/path",
2656
- ...options,
2657
- ...params,
2658
- });
2659
- }
2660
- }
2661
- export class Vcs extends HeyApiClient {
2662
- /**
2663
- * Get VCS info
2664
- *
2665
- * Retrieve version control system (VCS) information for the current project, such as git branch.
2666
- */
2667
- get(parameters, options) {
2668
- const params = buildClientParams([parameters], [
2669
- {
2670
- args: [
2671
- { in: "query", key: "directory" },
2672
- { in: "query", key: "workspace" },
2673
- ],
2674
- },
2675
- ]);
2676
- return (options?.client ?? this.client).get({
2677
- url: "/vcs",
2678
- ...options,
2679
- ...params,
2680
- });
2681
- }
2682
- /**
2683
- * Get VCS diff
2684
- *
2685
- * Retrieve the current git diff for the working tree or against the default branch.
2686
- */
2687
- diff(parameters, options) {
2688
- const params = buildClientParams([parameters], [
2689
- {
2690
- args: [
2691
- { in: "query", key: "directory" },
2692
- { in: "query", key: "workspace" },
2693
- { in: "query", key: "mode" },
2694
- ],
2695
- },
2696
- ]);
2697
- return (options?.client ?? this.client).get({
2698
- url: "/vcs/diff",
2699
- ...options,
2700
- ...params,
2701
- });
2702
- }
2703
- }
2704
- export class Command extends HeyApiClient {
2705
- /**
2706
- * List commands
2707
- *
2708
- * Get a list of all available commands in the OpenCode system.
2709
- */
2710
- list(parameters, options) {
2711
- const params = buildClientParams([parameters], [
2712
- {
2713
- args: [
2714
- { in: "query", key: "directory" },
2715
- { in: "query", key: "workspace" },
2716
- ],
2717
- },
2718
- ]);
2719
- return (options?.client ?? this.client).get({
2720
- url: "/command",
2721
- ...options,
2722
- ...params,
2723
- });
2724
- }
2725
- }
2726
- export class Lsp extends HeyApiClient {
2727
- /**
2728
- * Get LSP status
2729
- *
2730
- * Get LSP server status
2731
- */
2732
- status(parameters, options) {
2733
- const params = buildClientParams([parameters], [
2734
- {
2735
- args: [
2736
- { in: "query", key: "directory" },
2737
- { in: "query", key: "workspace" },
2738
- ],
2739
- },
2740
- ]);
2741
- return (options?.client ?? this.client).get({
2742
- url: "/lsp",
2743
- ...options,
2744
- ...params,
2745
- });
2746
- }
2747
- }
2748
- export class Formatter extends HeyApiClient {
2749
- /**
2750
- * Get formatter status
2751
- *
2752
- * Get formatter status
2753
- */
2754
- status(parameters, options) {
2755
- const params = buildClientParams([parameters], [
2756
- {
2757
- args: [
2758
- { in: "query", key: "directory" },
2759
- { in: "query", key: "workspace" },
2760
- ],
2761
- },
2762
- ]);
2763
- return (options?.client ?? this.client).get({
2764
- url: "/formatter",
2765
- ...options,
2766
- ...params,
2767
- });
2768
- }
2769
- }
2770
2912
  export class OpencodeClient extends HeyApiClient {
2771
2913
  static __registry = new HeyApiRegistry();
2772
2914
  constructor(args) {
2773
2915
  super(args);
2774
2916
  OpencodeClient.__registry.set(this, args?.key);
2775
2917
  }
2776
- _global;
2777
- get global() {
2778
- return (this._global ??= new Global({ client: this.client }));
2779
- }
2780
2918
  _auth;
2781
2919
  get auth() {
2782
2920
  return (this._auth ??= new Auth({ client: this.client }));
@@ -2785,22 +2923,22 @@ export class OpencodeClient extends HeyApiClient {
2785
2923
  get app() {
2786
2924
  return (this._app ??= new App({ client: this.client }));
2787
2925
  }
2788
- _experimental;
2789
- get experimental() {
2790
- return (this._experimental ??= new Experimental({ client: this.client }));
2791
- }
2792
- _project;
2793
- get project() {
2794
- return (this._project ??= new Project({ client: this.client }));
2926
+ _global;
2927
+ get global() {
2928
+ return (this._global ??= new Global({ client: this.client }));
2795
2929
  }
2796
- _pty;
2797
- get pty() {
2798
- return (this._pty ??= new Pty({ client: this.client }));
2930
+ _event;
2931
+ get event() {
2932
+ return (this._event ??= new Event({ client: this.client }));
2799
2933
  }
2800
2934
  _config;
2801
2935
  get config() {
2802
2936
  return (this._config ??= new Config2({ client: this.client }));
2803
2937
  }
2938
+ _experimental;
2939
+ get experimental() {
2940
+ return (this._experimental ??= new Experimental({ client: this.client }));
2941
+ }
2804
2942
  _tool;
2805
2943
  get tool() {
2806
2944
  return (this._tool ??= new Tool({ client: this.client }));
@@ -2809,30 +2947,6 @@ export class OpencodeClient extends HeyApiClient {
2809
2947
  get worktree() {
2810
2948
  return (this._worktree ??= new Worktree({ client: this.client }));
2811
2949
  }
2812
- _session;
2813
- get session() {
2814
- return (this._session ??= new Session2({ client: this.client }));
2815
- }
2816
- _part;
2817
- get part() {
2818
- return (this._part ??= new Part({ client: this.client }));
2819
- }
2820
- _permission;
2821
- get permission() {
2822
- return (this._permission ??= new Permission({ client: this.client }));
2823
- }
2824
- _question;
2825
- get question() {
2826
- return (this._question ??= new Question({ client: this.client }));
2827
- }
2828
- _provider;
2829
- get provider() {
2830
- return (this._provider ??= new Provider({ client: this.client }));
2831
- }
2832
- _sync;
2833
- get sync() {
2834
- return (this._sync ??= new Sync({ client: this.client }));
2835
- }
2836
2950
  _find;
2837
2951
  get find() {
2838
2952
  return (this._find ??= new Find({ client: this.client }));
@@ -2841,18 +2955,6 @@ export class OpencodeClient extends HeyApiClient {
2841
2955
  get file() {
2842
2956
  return (this._file ??= new File({ client: this.client }));
2843
2957
  }
2844
- _event;
2845
- get event() {
2846
- return (this._event ??= new Event({ client: this.client }));
2847
- }
2848
- _mcp;
2849
- get mcp() {
2850
- return (this._mcp ??= new Mcp({ client: this.client }));
2851
- }
2852
- _tui;
2853
- get tui() {
2854
- return (this._tui ??= new Tui({ client: this.client }));
2855
- }
2856
2958
  _instance;
2857
2959
  get instance() {
2858
2960
  return (this._instance ??= new Instance({ client: this.client }));
@@ -2877,4 +2979,48 @@ export class OpencodeClient extends HeyApiClient {
2877
2979
  get formatter() {
2878
2980
  return (this._formatter ??= new Formatter({ client: this.client }));
2879
2981
  }
2982
+ _mcp;
2983
+ get mcp() {
2984
+ return (this._mcp ??= new Mcp({ client: this.client }));
2985
+ }
2986
+ _project;
2987
+ get project() {
2988
+ return (this._project ??= new Project({ client: this.client }));
2989
+ }
2990
+ _pty;
2991
+ get pty() {
2992
+ return (this._pty ??= new Pty({ client: this.client }));
2993
+ }
2994
+ _question;
2995
+ get question() {
2996
+ return (this._question ??= new Question({ client: this.client }));
2997
+ }
2998
+ _permission;
2999
+ get permission() {
3000
+ return (this._permission ??= new Permission({ client: this.client }));
3001
+ }
3002
+ _provider;
3003
+ get provider() {
3004
+ return (this._provider ??= new Provider({ client: this.client }));
3005
+ }
3006
+ _session;
3007
+ get session() {
3008
+ return (this._session ??= new Session2({ client: this.client }));
3009
+ }
3010
+ _part;
3011
+ get part() {
3012
+ return (this._part ??= new Part({ client: this.client }));
3013
+ }
3014
+ _sync;
3015
+ get sync() {
3016
+ return (this._sync ??= new Sync({ client: this.client }));
3017
+ }
3018
+ _v2;
3019
+ get v2() {
3020
+ return (this._v2 ??= new V2({ client: this.client }));
3021
+ }
3022
+ _tui;
3023
+ get tui() {
3024
+ return (this._tui ??= new Tui({ client: this.client }));
3025
+ }
2880
3026
  }