@opencode-ai/sdk 1.14.32 → 1.14.34

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,195 +1092,199 @@ 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",
1264
+ ...options,
1265
+ ...params,
1266
+ });
1267
+ }
1268
+ /**
1269
+ * Update project
1270
+ *
1271
+ * Update project properties such as name, icon, and commands.
1272
+ */
1273
+ update(parameters, options) {
1274
+ const params = buildClientParams([parameters], [
1275
+ {
1276
+ args: [
1277
+ { in: "path", key: "projectID" },
1278
+ { in: "query", key: "directory" },
1279
+ { in: "query", key: "workspace" },
1280
+ { in: "body", key: "name" },
1281
+ { in: "body", key: "icon" },
1282
+ { in: "body", key: "commands" },
1283
+ ],
1284
+ },
1285
+ ]);
1286
+ return (options?.client ?? this.client).patch({
1287
+ url: "/project/{projectID}",
1379
1288
  ...options,
1380
1289
  ...params,
1381
1290
  headers: {
@@ -1385,76 +1294,69 @@ export class Session2 extends HeyApiClient {
1385
1294
  },
1386
1295
  });
1387
1296
  }
1297
+ }
1298
+ export class Pty extends HeyApiClient {
1388
1299
  /**
1389
- * Delete message
1300
+ * List available shells
1390
1301
  *
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.
1302
+ * Get a list of available shells on the system.
1392
1303
  */
1393
- deleteMessage(parameters, options) {
1304
+ shells(parameters, options) {
1394
1305
  const params = buildClientParams([parameters], [
1395
1306
  {
1396
1307
  args: [
1397
- { in: "path", key: "sessionID" },
1398
- { in: "path", key: "messageID" },
1399
1308
  { in: "query", key: "directory" },
1400
1309
  { in: "query", key: "workspace" },
1401
1310
  ],
1402
1311
  },
1403
1312
  ]);
1404
- return (options?.client ?? this.client).delete({
1405
- url: "/session/{sessionID}/message/{messageID}",
1313
+ return (options?.client ?? this.client).get({
1314
+ url: "/pty/shells",
1406
1315
  ...options,
1407
1316
  ...params,
1408
1317
  });
1409
1318
  }
1410
1319
  /**
1411
- * Get message
1320
+ * List PTY sessions
1412
1321
  *
1413
- * Retrieve a specific message from a session by its message ID.
1322
+ * Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode.
1414
1323
  */
1415
- message(parameters, options) {
1324
+ list(parameters, options) {
1416
1325
  const params = buildClientParams([parameters], [
1417
1326
  {
1418
1327
  args: [
1419
- { in: "path", key: "sessionID" },
1420
- { in: "path", key: "messageID" },
1421
1328
  { in: "query", key: "directory" },
1422
1329
  { in: "query", key: "workspace" },
1423
1330
  ],
1424
1331
  },
1425
1332
  ]);
1426
1333
  return (options?.client ?? this.client).get({
1427
- url: "/session/{sessionID}/message/{messageID}",
1334
+ url: "/pty",
1428
1335
  ...options,
1429
1336
  ...params,
1430
1337
  });
1431
1338
  }
1432
1339
  /**
1433
- * Send async message
1340
+ * Create PTY session
1434
1341
  *
1435
- * Create and send a new message to a session asynchronously, starting the session if needed and returning immediately.
1342
+ * Create a new pseudo-terminal (PTY) session for running shell commands and processes.
1436
1343
  */
1437
- promptAsync(parameters, options) {
1344
+ create(parameters, options) {
1438
1345
  const params = buildClientParams([parameters], [
1439
1346
  {
1440
1347
  args: [
1441
- { in: "path", key: "sessionID" },
1442
1348
  { in: "query", key: "directory" },
1443
1349
  { 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" },
1350
+ { in: "body", key: "command" },
1351
+ { in: "body", key: "args" },
1352
+ { in: "body", key: "cwd" },
1353
+ { in: "body", key: "title" },
1354
+ { in: "body", key: "env" },
1453
1355
  ],
1454
1356
  },
1455
1357
  ]);
1456
1358
  return (options?.client ?? this.client).post({
1457
- url: "/session/{sessionID}/prompt_async",
1359
+ url: "/pty",
1458
1360
  ...options,
1459
1361
  ...params,
1460
1362
  headers: {
@@ -1465,87 +1367,66 @@ export class Session2 extends HeyApiClient {
1465
1367
  });
1466
1368
  }
1467
1369
  /**
1468
- * Send command
1370
+ * Remove PTY session
1469
1371
  *
1470
- * Send a new command to a session for execution by the AI assistant.
1372
+ * Remove and terminate a specific pseudo-terminal (PTY) session.
1471
1373
  */
1472
- command(parameters, options) {
1374
+ remove(parameters, options) {
1473
1375
  const params = buildClientParams([parameters], [
1474
1376
  {
1475
1377
  args: [
1476
- { in: "path", key: "sessionID" },
1378
+ { in: "path", key: "ptyID" },
1477
1379
  { in: "query", key: "directory" },
1478
1380
  { 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
- { in: "body", key: "command" },
1484
- { in: "body", key: "variant" },
1485
- { in: "body", key: "parts" },
1486
1381
  ],
1487
1382
  },
1488
1383
  ]);
1489
- return (options?.client ?? this.client).post({
1490
- url: "/session/{sessionID}/command",
1384
+ return (options?.client ?? this.client).delete({
1385
+ url: "/pty/{ptyID}",
1491
1386
  ...options,
1492
1387
  ...params,
1493
- headers: {
1494
- "Content-Type": "application/json",
1495
- ...options?.headers,
1496
- ...params.headers,
1497
- },
1498
1388
  });
1499
1389
  }
1500
1390
  /**
1501
- * Run shell command
1391
+ * Get PTY session
1502
1392
  *
1503
- * Execute a shell command within the session context and return the AI's response.
1393
+ * Retrieve detailed information about a specific pseudo-terminal (PTY) session.
1504
1394
  */
1505
- shell(parameters, options) {
1395
+ get(parameters, options) {
1506
1396
  const params = buildClientParams([parameters], [
1507
1397
  {
1508
1398
  args: [
1509
- { in: "path", key: "sessionID" },
1399
+ { in: "path", key: "ptyID" },
1510
1400
  { in: "query", key: "directory" },
1511
1401
  { 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
1402
  ],
1517
1403
  },
1518
1404
  ]);
1519
- return (options?.client ?? this.client).post({
1520
- url: "/session/{sessionID}/shell",
1405
+ return (options?.client ?? this.client).get({
1406
+ url: "/pty/{ptyID}",
1521
1407
  ...options,
1522
1408
  ...params,
1523
- headers: {
1524
- "Content-Type": "application/json",
1525
- ...options?.headers,
1526
- ...params.headers,
1527
- },
1528
1409
  });
1529
1410
  }
1530
1411
  /**
1531
- * Revert message
1412
+ * Update PTY session
1532
1413
  *
1533
- * Revert a specific message in a session, undoing its effects and restoring the previous state.
1414
+ * Update properties of an existing pseudo-terminal (PTY) session.
1534
1415
  */
1535
- revert(parameters, options) {
1416
+ update(parameters, options) {
1536
1417
  const params = buildClientParams([parameters], [
1537
1418
  {
1538
1419
  args: [
1539
- { in: "path", key: "sessionID" },
1420
+ { in: "path", key: "ptyID" },
1540
1421
  { in: "query", key: "directory" },
1541
1422
  { in: "query", key: "workspace" },
1542
- { in: "body", key: "messageID" },
1543
- { in: "body", key: "partID" },
1423
+ { in: "body", key: "title" },
1424
+ { in: "body", key: "size" },
1544
1425
  ],
1545
1426
  },
1546
1427
  ]);
1547
- return (options?.client ?? this.client).post({
1548
- url: "/session/{sessionID}/revert",
1428
+ return (options?.client ?? this.client).put({
1429
+ url: "/pty/{ptyID}",
1549
1430
  ...options,
1550
1431
  ...params,
1551
1432
  headers: {
@@ -1556,99 +1437,87 @@ export class Session2 extends HeyApiClient {
1556
1437
  });
1557
1438
  }
1558
1439
  /**
1559
- * Restore reverted messages
1440
+ * Create PTY WebSocket token
1560
1441
  *
1561
- * Restore all previously reverted messages in a session.
1442
+ * Create a short-lived ticket for opening a PTY WebSocket connection.
1562
1443
  */
1563
- unrevert(parameters, options) {
1444
+ connectToken(parameters, options) {
1564
1445
  const params = buildClientParams([parameters], [
1565
1446
  {
1566
1447
  args: [
1567
- { in: "path", key: "sessionID" },
1448
+ { in: "path", key: "ptyID" },
1568
1449
  { in: "query", key: "directory" },
1569
1450
  { in: "query", key: "workspace" },
1570
1451
  ],
1571
1452
  },
1572
1453
  ]);
1573
1454
  return (options?.client ?? this.client).post({
1574
- url: "/session/{sessionID}/unrevert",
1455
+ url: "/pty/{ptyID}/connect-token",
1575
1456
  ...options,
1576
1457
  ...params,
1577
1458
  });
1578
1459
  }
1579
- }
1580
- export class Part extends HeyApiClient {
1581
1460
  /**
1582
- * Delete a part from a message
1461
+ * Connect to PTY session
1462
+ *
1463
+ * Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.
1583
1464
  */
1584
- delete(parameters, options) {
1465
+ connect(parameters, options) {
1585
1466
  const params = buildClientParams([parameters], [
1586
1467
  {
1587
1468
  args: [
1588
- { in: "path", key: "sessionID" },
1589
- { in: "path", key: "messageID" },
1590
- { in: "path", key: "partID" },
1469
+ { in: "path", key: "ptyID" },
1591
1470
  { in: "query", key: "directory" },
1592
1471
  { in: "query", key: "workspace" },
1593
1472
  ],
1594
1473
  },
1595
1474
  ]);
1596
- return (options?.client ?? this.client).delete({
1597
- url: "/session/{sessionID}/message/{messageID}/part/{partID}",
1475
+ return (options?.client ?? this.client).get({
1476
+ url: "/pty/{ptyID}/connect",
1598
1477
  ...options,
1599
1478
  ...params,
1600
1479
  });
1601
1480
  }
1481
+ }
1482
+ export class Question extends HeyApiClient {
1602
1483
  /**
1603
- * Update a part in a message
1484
+ * List pending questions
1485
+ *
1486
+ * Get all pending question requests across all sessions.
1604
1487
  */
1605
- update(parameters, options) {
1488
+ list(parameters, options) {
1606
1489
  const params = buildClientParams([parameters], [
1607
1490
  {
1608
1491
  args: [
1609
- { in: "path", key: "sessionID" },
1610
- { in: "path", key: "messageID" },
1611
- { in: "path", key: "partID" },
1612
1492
  { in: "query", key: "directory" },
1613
1493
  { in: "query", key: "workspace" },
1614
- { key: "part", map: "body" },
1615
1494
  ],
1616
1495
  },
1617
1496
  ]);
1618
- return (options?.client ?? this.client).patch({
1619
- url: "/session/{sessionID}/message/{messageID}/part/{partID}",
1497
+ return (options?.client ?? this.client).get({
1498
+ url: "/question",
1620
1499
  ...options,
1621
1500
  ...params,
1622
- headers: {
1623
- "Content-Type": "application/json",
1624
- ...options?.headers,
1625
- ...params.headers,
1626
- },
1627
1501
  });
1628
1502
  }
1629
- }
1630
- export class Permission extends HeyApiClient {
1631
1503
  /**
1632
- * Respond to permission
1633
- *
1634
- * Approve or deny a permission request from the AI assistant.
1504
+ * Reply to question request
1635
1505
  *
1636
- * @deprecated
1506
+ * Provide answers to a question request from the AI assistant.
1637
1507
  */
1638
- respond(parameters, options) {
1508
+ reply(parameters, options) {
1639
1509
  const params = buildClientParams([parameters], [
1640
1510
  {
1641
1511
  args: [
1642
- { in: "path", key: "sessionID" },
1643
- { in: "path", key: "permissionID" },
1512
+ { in: "path", key: "requestID" },
1644
1513
  { in: "query", key: "directory" },
1645
1514
  { in: "query", key: "workspace" },
1646
- { in: "body", key: "response" },
1515
+ { in: "body", key: "answers" },
1647
1516
  ],
1648
1517
  },
1649
1518
  ]);
1650
1519
  return (options?.client ?? this.client).post({
1651
- url: "/session/{sessionID}/permissions/{permissionID}",
1520
+ url: "/question/{requestID}/reply",
1652
1521
  ...options,
1653
1522
  ...params,
1654
1523
  headers: {
@@ -1659,33 +1528,28 @@ export class Permission extends HeyApiClient {
1659
1528
  });
1660
1529
  }
1661
1530
  /**
1662
- * Respond to permission request
1531
+ * Reject question request
1663
1532
  *
1664
- * Approve or deny a permission request from the AI assistant.
1533
+ * Reject a question request from the AI assistant.
1665
1534
  */
1666
- reply(parameters, options) {
1535
+ reject(parameters, options) {
1667
1536
  const params = buildClientParams([parameters], [
1668
1537
  {
1669
1538
  args: [
1670
1539
  { in: "path", key: "requestID" },
1671
1540
  { in: "query", key: "directory" },
1672
1541
  { in: "query", key: "workspace" },
1673
- { in: "body", key: "reply" },
1674
- { in: "body", key: "message" },
1675
1542
  ],
1676
1543
  },
1677
1544
  ]);
1678
1545
  return (options?.client ?? this.client).post({
1679
- url: "/permission/{requestID}/reply",
1546
+ url: "/question/{requestID}/reject",
1680
1547
  ...options,
1681
1548
  ...params,
1682
- headers: {
1683
- "Content-Type": "application/json",
1684
- ...options?.headers,
1685
- ...params.headers,
1686
- },
1687
1549
  });
1688
1550
  }
1551
+ }
1552
+ export class Permission extends HeyApiClient {
1689
1553
  /**
1690
1554
  * List pending permissions
1691
1555
  *
@@ -1706,46 +1570,25 @@ export class Permission extends HeyApiClient {
1706
1570
  ...params,
1707
1571
  });
1708
1572
  }
1709
- }
1710
- export class Question extends HeyApiClient {
1711
1573
  /**
1712
- * List pending questions
1574
+ * Respond to permission request
1713
1575
  *
1714
- * Get all pending question requests across all sessions.
1576
+ * Approve or deny a permission request from the AI assistant.
1715
1577
  */
1716
- list(parameters, options) {
1578
+ reply(parameters, options) {
1717
1579
  const params = buildClientParams([parameters], [
1718
1580
  {
1719
1581
  args: [
1582
+ { in: "path", key: "requestID" },
1720
1583
  { in: "query", key: "directory" },
1721
1584
  { 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" },
1585
+ { in: "body", key: "reply" },
1586
+ { in: "body", key: "message" },
1744
1587
  ],
1745
1588
  },
1746
1589
  ]);
1747
1590
  return (options?.client ?? this.client).post({
1748
- url: "/question/{requestID}/reply",
1591
+ url: "/permission/{requestID}/reply",
1749
1592
  ...options,
1750
1593
  ...params,
1751
1594
  headers: {
@@ -1756,32 +1599,41 @@ export class Question extends HeyApiClient {
1756
1599
  });
1757
1600
  }
1758
1601
  /**
1759
- * Reject question request
1602
+ * Respond to permission
1760
1603
  *
1761
- * Reject a question request from the AI assistant.
1604
+ * Approve or deny a permission request from the AI assistant.
1605
+ *
1606
+ * @deprecated
1762
1607
  */
1763
- reject(parameters, options) {
1608
+ respond(parameters, options) {
1764
1609
  const params = buildClientParams([parameters], [
1765
1610
  {
1766
1611
  args: [
1767
- { in: "path", key: "requestID" },
1612
+ { in: "path", key: "sessionID" },
1613
+ { in: "path", key: "permissionID" },
1768
1614
  { in: "query", key: "directory" },
1769
1615
  { in: "query", key: "workspace" },
1616
+ { in: "body", key: "response" },
1770
1617
  ],
1771
1618
  },
1772
1619
  ]);
1773
1620
  return (options?.client ?? this.client).post({
1774
- url: "/question/{requestID}/reject",
1621
+ url: "/session/{sessionID}/permissions/{permissionID}",
1775
1622
  ...options,
1776
1623
  ...params,
1624
+ headers: {
1625
+ "Content-Type": "application/json",
1626
+ ...options?.headers,
1627
+ ...params.headers,
1628
+ },
1777
1629
  });
1778
1630
  }
1779
1631
  }
1780
1632
  export class Oauth extends HeyApiClient {
1781
1633
  /**
1782
- * OAuth authorize
1634
+ * Start OAuth authorization
1783
1635
  *
1784
- * Initiate OAuth authorization for a specific AI provider to get an authorization URL.
1636
+ * Start the OAuth authorization flow for a provider.
1785
1637
  */
1786
1638
  authorize(parameters, options) {
1787
1639
  const params = buildClientParams([parameters], [
@@ -1807,7 +1659,7 @@ export class Oauth extends HeyApiClient {
1807
1659
  });
1808
1660
  }
1809
1661
  /**
1810
- * OAuth callback
1662
+ * Handle OAuth callback
1811
1663
  *
1812
1664
  * Handle the OAuth callback from a provider after user authorization.
1813
1665
  */
@@ -1881,11 +1733,11 @@ export class Provider extends HeyApiClient {
1881
1733
  return (this._oauth ??= new Oauth({ client: this.client }));
1882
1734
  }
1883
1735
  }
1884
- export class History extends HeyApiClient {
1736
+ export class Session2 extends HeyApiClient {
1885
1737
  /**
1886
- * List sync events
1738
+ * List sessions
1887
1739
  *
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.
1740
+ * Get a list of all OpenCode sessions, sorted by most recently updated.
1889
1741
  */
1890
1742
  list(parameters, options) {
1891
1743
  const params = buildClientParams([parameters], [
@@ -1893,12 +1745,43 @@ export class History extends HeyApiClient {
1893
1745
  args: [
1894
1746
  { in: "query", key: "directory" },
1895
1747
  { in: "query", key: "workspace" },
1896
- { key: "body", map: "body" },
1748
+ { in: "query", key: "scope" },
1749
+ { in: "query", key: "path" },
1750
+ { in: "query", key: "roots" },
1751
+ { in: "query", key: "start" },
1752
+ { in: "query", key: "search" },
1753
+ { in: "query", key: "limit" },
1754
+ ],
1755
+ },
1756
+ ]);
1757
+ return (options?.client ?? this.client).get({
1758
+ url: "/session",
1759
+ ...options,
1760
+ ...params,
1761
+ });
1762
+ }
1763
+ /**
1764
+ * Create session
1765
+ *
1766
+ * Create a new OpenCode session for interacting with AI assistants and managing conversations.
1767
+ */
1768
+ create(parameters, options) {
1769
+ const params = buildClientParams([parameters], [
1770
+ {
1771
+ args: [
1772
+ { in: "query", key: "directory" },
1773
+ { in: "query", key: "workspace" },
1774
+ { in: "body", key: "parentID" },
1775
+ { in: "body", key: "title" },
1776
+ { in: "body", key: "agent" },
1777
+ { in: "body", key: "model" },
1778
+ { in: "body", key: "permission" },
1779
+ { in: "body", key: "workspaceID" },
1897
1780
  ],
1898
1781
  },
1899
1782
  ]);
1900
1783
  return (options?.client ?? this.client).post({
1901
- url: "/sync/history",
1784
+ url: "/session",
1902
1785
  ...options,
1903
1786
  ...params,
1904
1787
  headers: {
@@ -1908,14 +1791,12 @@ export class History extends HeyApiClient {
1908
1791
  },
1909
1792
  });
1910
1793
  }
1911
- }
1912
- export class Sync extends HeyApiClient {
1913
1794
  /**
1914
- * Start workspace sync
1795
+ * Get session status
1915
1796
  *
1916
- * Start sync loops for workspaces in the current project that have active sessions.
1797
+ * Retrieve the current status of all sessions, including active, idle, and completed states.
1917
1798
  */
1918
- start(parameters, options) {
1799
+ status(parameters, options) {
1919
1800
  const params = buildClientParams([parameters], [
1920
1801
  {
1921
1802
  args: [
@@ -1924,267 +1805,267 @@ export class Sync extends HeyApiClient {
1924
1805
  ],
1925
1806
  },
1926
1807
  ]);
1927
- return (options?.client ?? this.client).post({
1928
- url: "/sync/start",
1808
+ return (options?.client ?? this.client).get({
1809
+ url: "/session/status",
1929
1810
  ...options,
1930
1811
  ...params,
1931
1812
  });
1932
1813
  }
1933
1814
  /**
1934
- * Replay sync events
1815
+ * Delete session
1935
1816
  *
1936
- * Validate and replay a complete sync event history.
1817
+ * Delete a session and permanently remove all associated data, including messages and history.
1937
1818
  */
1938
- replay(parameters, options) {
1819
+ delete(parameters, options) {
1939
1820
  const params = buildClientParams([parameters], [
1940
1821
  {
1941
1822
  args: [
1942
- {
1943
- in: "query",
1944
- key: "query_directory",
1945
- map: "directory",
1946
- },
1823
+ { in: "path", key: "sessionID" },
1824
+ { in: "query", key: "directory" },
1947
1825
  { in: "query", key: "workspace" },
1948
- {
1949
- in: "body",
1950
- key: "body_directory",
1951
- map: "directory",
1952
- },
1953
- { in: "body", key: "events" },
1954
1826
  ],
1955
1827
  },
1956
1828
  ]);
1957
- return (options?.client ?? this.client).post({
1958
- url: "/sync/replay",
1829
+ return (options?.client ?? this.client).delete({
1830
+ url: "/session/{sessionID}",
1959
1831
  ...options,
1960
1832
  ...params,
1961
- headers: {
1962
- "Content-Type": "application/json",
1963
- ...options?.headers,
1964
- ...params.headers,
1965
- },
1966
1833
  });
1967
1834
  }
1968
- _history;
1969
- get history() {
1970
- return (this._history ??= new History({ client: this.client }));
1971
- }
1972
- }
1973
- export class Find extends HeyApiClient {
1974
1835
  /**
1975
- * Find text
1836
+ * Get session
1976
1837
  *
1977
- * Search for text patterns across files in the project using ripgrep.
1838
+ * Retrieve detailed information about a specific OpenCode session.
1978
1839
  */
1979
- text(parameters, options) {
1840
+ get(parameters, options) {
1980
1841
  const params = buildClientParams([parameters], [
1981
1842
  {
1982
1843
  args: [
1844
+ { in: "path", key: "sessionID" },
1983
1845
  { in: "query", key: "directory" },
1984
1846
  { in: "query", key: "workspace" },
1985
- { in: "query", key: "pattern" },
1986
1847
  ],
1987
1848
  },
1988
1849
  ]);
1989
1850
  return (options?.client ?? this.client).get({
1990
- url: "/find",
1851
+ url: "/session/{sessionID}",
1991
1852
  ...options,
1992
1853
  ...params,
1993
1854
  });
1994
1855
  }
1995
1856
  /**
1996
- * Find files
1857
+ * Update session
1997
1858
  *
1998
- * Search for files or directories by name or pattern in the project directory.
1859
+ * Update properties of an existing session, such as title or other metadata.
1999
1860
  */
2000
- files(parameters, options) {
1861
+ update(parameters, options) {
2001
1862
  const params = buildClientParams([parameters], [
2002
1863
  {
2003
1864
  args: [
1865
+ { in: "path", key: "sessionID" },
2004
1866
  { in: "query", key: "directory" },
2005
1867
  { in: "query", key: "workspace" },
2006
- { in: "query", key: "query" },
2007
- { in: "query", key: "dirs" },
2008
- { in: "query", key: "type" },
2009
- { in: "query", key: "limit" },
1868
+ { in: "body", key: "title" },
1869
+ { in: "body", key: "permission" },
1870
+ { in: "body", key: "time" },
2010
1871
  ],
2011
1872
  },
2012
1873
  ]);
2013
- return (options?.client ?? this.client).get({
2014
- url: "/find/file",
1874
+ return (options?.client ?? this.client).patch({
1875
+ url: "/session/{sessionID}",
2015
1876
  ...options,
2016
1877
  ...params,
1878
+ headers: {
1879
+ "Content-Type": "application/json",
1880
+ ...options?.headers,
1881
+ ...params.headers,
1882
+ },
2017
1883
  });
2018
1884
  }
2019
1885
  /**
2020
- * Find symbols
1886
+ * Get session children
2021
1887
  *
2022
- * Search for workspace symbols like functions, classes, and variables using LSP.
1888
+ * Retrieve all child sessions that were forked from the specified parent session.
2023
1889
  */
2024
- symbols(parameters, options) {
1890
+ children(parameters, options) {
2025
1891
  const params = buildClientParams([parameters], [
2026
1892
  {
2027
1893
  args: [
1894
+ { in: "path", key: "sessionID" },
2028
1895
  { in: "query", key: "directory" },
2029
1896
  { in: "query", key: "workspace" },
2030
- { in: "query", key: "query" },
2031
1897
  ],
2032
1898
  },
2033
1899
  ]);
2034
1900
  return (options?.client ?? this.client).get({
2035
- url: "/find/symbol",
1901
+ url: "/session/{sessionID}/children",
2036
1902
  ...options,
2037
1903
  ...params,
2038
1904
  });
2039
1905
  }
2040
- }
2041
- export class File extends HeyApiClient {
2042
1906
  /**
2043
- * List files
1907
+ * Get session todos
2044
1908
  *
2045
- * List files and directories in a specified path.
1909
+ * Retrieve the todo list associated with a specific session, showing tasks and action items.
2046
1910
  */
2047
- list(parameters, options) {
1911
+ todo(parameters, options) {
2048
1912
  const params = buildClientParams([parameters], [
2049
1913
  {
2050
1914
  args: [
1915
+ { in: "path", key: "sessionID" },
2051
1916
  { in: "query", key: "directory" },
2052
1917
  { in: "query", key: "workspace" },
2053
- { in: "query", key: "path" },
2054
1918
  ],
2055
1919
  },
2056
1920
  ]);
2057
1921
  return (options?.client ?? this.client).get({
2058
- url: "/file",
1922
+ url: "/session/{sessionID}/todo",
2059
1923
  ...options,
2060
1924
  ...params,
2061
1925
  });
2062
1926
  }
2063
1927
  /**
2064
- * Read file
1928
+ * Get message diff
2065
1929
  *
2066
- * Read the content of a specified file.
1930
+ * Get the file changes (diff) that resulted from a specific user message in the session.
2067
1931
  */
2068
- read(parameters, options) {
1932
+ diff(parameters, options) {
2069
1933
  const params = buildClientParams([parameters], [
2070
1934
  {
2071
1935
  args: [
1936
+ { in: "path", key: "sessionID" },
2072
1937
  { in: "query", key: "directory" },
2073
1938
  { in: "query", key: "workspace" },
2074
- { in: "query", key: "path" },
1939
+ { in: "query", key: "messageID" },
2075
1940
  ],
2076
1941
  },
2077
1942
  ]);
2078
1943
  return (options?.client ?? this.client).get({
2079
- url: "/file/content",
1944
+ url: "/session/{sessionID}/diff",
2080
1945
  ...options,
2081
1946
  ...params,
2082
1947
  });
2083
1948
  }
2084
1949
  /**
2085
- * Get file status
1950
+ * Get session messages
2086
1951
  *
2087
- * Get the git status of all files in the project.
1952
+ * Retrieve all messages in a session, including user prompts and AI responses.
2088
1953
  */
2089
- status(parameters, options) {
1954
+ messages(parameters, options) {
2090
1955
  const params = buildClientParams([parameters], [
2091
1956
  {
2092
1957
  args: [
1958
+ { in: "path", key: "sessionID" },
2093
1959
  { in: "query", key: "directory" },
2094
1960
  { in: "query", key: "workspace" },
1961
+ { in: "query", key: "limit" },
1962
+ { in: "query", key: "before" },
2095
1963
  ],
2096
1964
  },
2097
1965
  ]);
2098
1966
  return (options?.client ?? this.client).get({
2099
- url: "/file/status",
1967
+ url: "/session/{sessionID}/message",
2100
1968
  ...options,
2101
1969
  ...params,
2102
1970
  });
2103
1971
  }
2104
- }
2105
- export class Event extends HeyApiClient {
2106
1972
  /**
2107
- * Subscribe to events
1973
+ * Send message
2108
1974
  *
2109
- * Get events
1975
+ * Create and send a new message to a session, streaming the AI response.
2110
1976
  */
2111
- subscribe(parameters, options) {
1977
+ prompt(parameters, options) {
2112
1978
  const params = buildClientParams([parameters], [
2113
1979
  {
2114
1980
  args: [
1981
+ { in: "path", key: "sessionID" },
2115
1982
  { in: "query", key: "directory" },
2116
1983
  { in: "query", key: "workspace" },
1984
+ { in: "body", key: "messageID" },
1985
+ { in: "body", key: "model" },
1986
+ { in: "body", key: "agent" },
1987
+ { in: "body", key: "noReply" },
1988
+ { in: "body", key: "tools" },
1989
+ { in: "body", key: "format" },
1990
+ { in: "body", key: "system" },
1991
+ { in: "body", key: "variant" },
1992
+ { in: "body", key: "parts" },
2117
1993
  ],
2118
1994
  },
2119
1995
  ]);
2120
- return (options?.client ?? this.client).sse.get({
2121
- url: "/event",
1996
+ return (options?.client ?? this.client).post({
1997
+ url: "/session/{sessionID}/message",
2122
1998
  ...options,
2123
1999
  ...params,
2000
+ headers: {
2001
+ "Content-Type": "application/json",
2002
+ ...options?.headers,
2003
+ ...params.headers,
2004
+ },
2124
2005
  });
2125
2006
  }
2126
- }
2127
- export class Auth2 extends HeyApiClient {
2128
2007
  /**
2129
- * Remove MCP OAuth
2008
+ * Delete message
2130
2009
  *
2131
- * Remove OAuth credentials for an MCP server
2010
+ * Permanently delete a specific message and all of its parts from a session without reverting file changes.
2132
2011
  */
2133
- remove(parameters, options) {
2012
+ deleteMessage(parameters, options) {
2134
2013
  const params = buildClientParams([parameters], [
2135
2014
  {
2136
2015
  args: [
2137
- { in: "path", key: "name" },
2016
+ { in: "path", key: "sessionID" },
2017
+ { in: "path", key: "messageID" },
2138
2018
  { in: "query", key: "directory" },
2139
2019
  { in: "query", key: "workspace" },
2140
2020
  ],
2141
2021
  },
2142
2022
  ]);
2143
2023
  return (options?.client ?? this.client).delete({
2144
- url: "/mcp/{name}/auth",
2024
+ url: "/session/{sessionID}/message/{messageID}",
2145
2025
  ...options,
2146
2026
  ...params,
2147
2027
  });
2148
2028
  }
2149
2029
  /**
2150
- * Start MCP OAuth
2030
+ * Get message
2151
2031
  *
2152
- * Start OAuth authentication flow for a Model Context Protocol (MCP) server.
2032
+ * Retrieve a specific message from a session by its message ID.
2153
2033
  */
2154
- start(parameters, options) {
2034
+ message(parameters, options) {
2155
2035
  const params = buildClientParams([parameters], [
2156
2036
  {
2157
2037
  args: [
2158
- { in: "path", key: "name" },
2038
+ { in: "path", key: "sessionID" },
2039
+ { in: "path", key: "messageID" },
2159
2040
  { in: "query", key: "directory" },
2160
2041
  { in: "query", key: "workspace" },
2161
2042
  ],
2162
2043
  },
2163
2044
  ]);
2164
- return (options?.client ?? this.client).post({
2165
- url: "/mcp/{name}/auth",
2045
+ return (options?.client ?? this.client).get({
2046
+ url: "/session/{sessionID}/message/{messageID}",
2166
2047
  ...options,
2167
2048
  ...params,
2168
2049
  });
2169
2050
  }
2170
2051
  /**
2171
- * Complete MCP OAuth
2052
+ * Fork session
2172
2053
  *
2173
- * Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code.
2054
+ * Create a new session by forking an existing session at a specific message point.
2174
2055
  */
2175
- callback(parameters, options) {
2056
+ fork(parameters, options) {
2176
2057
  const params = buildClientParams([parameters], [
2177
2058
  {
2178
2059
  args: [
2179
- { in: "path", key: "name" },
2060
+ { in: "path", key: "sessionID" },
2180
2061
  { in: "query", key: "directory" },
2181
2062
  { in: "query", key: "workspace" },
2182
- { in: "body", key: "code" },
2063
+ { in: "body", key: "messageID" },
2183
2064
  ],
2184
2065
  },
2185
2066
  ]);
2186
2067
  return (options?.client ?? this.client).post({
2187
- url: "/mcp/{name}/auth/callback",
2068
+ url: "/session/{sessionID}/fork",
2188
2069
  ...options,
2189
2070
  ...params,
2190
2071
  headers: {
@@ -2195,34 +2076,420 @@ export class Auth2 extends HeyApiClient {
2195
2076
  });
2196
2077
  }
2197
2078
  /**
2198
- * Authenticate MCP OAuth
2079
+ * Abort session
2199
2080
  *
2200
- * Start OAuth flow and wait for callback (opens browser)
2081
+ * Abort an active session and stop any ongoing AI processing or command execution.
2201
2082
  */
2202
- authenticate(parameters, options) {
2083
+ abort(parameters, options) {
2203
2084
  const params = buildClientParams([parameters], [
2204
2085
  {
2205
2086
  args: [
2206
- { in: "path", key: "name" },
2087
+ { in: "path", key: "sessionID" },
2207
2088
  { in: "query", key: "directory" },
2208
2089
  { in: "query", key: "workspace" },
2209
2090
  ],
2210
2091
  },
2211
2092
  ]);
2212
2093
  return (options?.client ?? this.client).post({
2213
- url: "/mcp/{name}/auth/authenticate",
2094
+ url: "/session/{sessionID}/abort",
2095
+ ...options,
2096
+ ...params,
2097
+ });
2098
+ }
2099
+ /**
2100
+ * Initialize session
2101
+ *
2102
+ * Analyze the current application and create an AGENTS.md file with project-specific agent configurations.
2103
+ */
2104
+ init(parameters, options) {
2105
+ const params = buildClientParams([parameters], [
2106
+ {
2107
+ args: [
2108
+ { in: "path", key: "sessionID" },
2109
+ { in: "query", key: "directory" },
2110
+ { in: "query", key: "workspace" },
2111
+ { in: "body", key: "modelID" },
2112
+ { in: "body", key: "providerID" },
2113
+ { in: "body", key: "messageID" },
2114
+ ],
2115
+ },
2116
+ ]);
2117
+ return (options?.client ?? this.client).post({
2118
+ url: "/session/{sessionID}/init",
2119
+ ...options,
2120
+ ...params,
2121
+ headers: {
2122
+ "Content-Type": "application/json",
2123
+ ...options?.headers,
2124
+ ...params.headers,
2125
+ },
2126
+ });
2127
+ }
2128
+ /**
2129
+ * Unshare session
2130
+ *
2131
+ * Remove the shareable link for a session, making it private again.
2132
+ */
2133
+ unshare(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).delete({
2144
+ url: "/session/{sessionID}/share",
2145
+ ...options,
2146
+ ...params,
2147
+ });
2148
+ }
2149
+ /**
2150
+ * Share session
2151
+ *
2152
+ * Create a shareable link for a session, allowing others to view the conversation.
2153
+ */
2154
+ share(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
+ ],
2162
+ },
2163
+ ]);
2164
+ return (options?.client ?? this.client).post({
2165
+ url: "/session/{sessionID}/share",
2166
+ ...options,
2167
+ ...params,
2168
+ });
2169
+ }
2170
+ /**
2171
+ * Summarize session
2172
+ *
2173
+ * Generate a concise summary of the session using AI compaction to preserve key information.
2174
+ */
2175
+ summarize(parameters, options) {
2176
+ const params = buildClientParams([parameters], [
2177
+ {
2178
+ args: [
2179
+ { in: "path", key: "sessionID" },
2180
+ { in: "query", key: "directory" },
2181
+ { in: "query", key: "workspace" },
2182
+ { in: "body", key: "providerID" },
2183
+ { in: "body", key: "modelID" },
2184
+ { in: "body", key: "auto" },
2185
+ ],
2186
+ },
2187
+ ]);
2188
+ return (options?.client ?? this.client).post({
2189
+ url: "/session/{sessionID}/summarize",
2190
+ ...options,
2191
+ ...params,
2192
+ headers: {
2193
+ "Content-Type": "application/json",
2194
+ ...options?.headers,
2195
+ ...params.headers,
2196
+ },
2197
+ });
2198
+ }
2199
+ /**
2200
+ * Send async message
2201
+ *
2202
+ * Create and send a new message to a session asynchronously, starting the session if needed and returning immediately.
2203
+ */
2204
+ promptAsync(parameters, options) {
2205
+ const params = buildClientParams([parameters], [
2206
+ {
2207
+ args: [
2208
+ { in: "path", key: "sessionID" },
2209
+ { in: "query", key: "directory" },
2210
+ { in: "query", key: "workspace" },
2211
+ { in: "body", key: "messageID" },
2212
+ { in: "body", key: "model" },
2213
+ { in: "body", key: "agent" },
2214
+ { in: "body", key: "noReply" },
2215
+ { in: "body", key: "tools" },
2216
+ { in: "body", key: "format" },
2217
+ { in: "body", key: "system" },
2218
+ { in: "body", key: "variant" },
2219
+ { in: "body", key: "parts" },
2220
+ ],
2221
+ },
2222
+ ]);
2223
+ return (options?.client ?? this.client).post({
2224
+ url: "/session/{sessionID}/prompt_async",
2225
+ ...options,
2226
+ ...params,
2227
+ headers: {
2228
+ "Content-Type": "application/json",
2229
+ ...options?.headers,
2230
+ ...params.headers,
2231
+ },
2232
+ });
2233
+ }
2234
+ /**
2235
+ * Send command
2236
+ *
2237
+ * Send a new command to a session for execution by the AI assistant.
2238
+ */
2239
+ command(parameters, options) {
2240
+ const params = buildClientParams([parameters], [
2241
+ {
2242
+ args: [
2243
+ { in: "path", key: "sessionID" },
2244
+ { in: "query", key: "directory" },
2245
+ { in: "query", key: "workspace" },
2246
+ { in: "body", key: "messageID" },
2247
+ { in: "body", key: "agent" },
2248
+ { in: "body", key: "model" },
2249
+ { in: "body", key: "arguments" },
2250
+ { in: "body", key: "command" },
2251
+ { in: "body", key: "variant" },
2252
+ { in: "body", key: "parts" },
2253
+ ],
2254
+ },
2255
+ ]);
2256
+ return (options?.client ?? this.client).post({
2257
+ url: "/session/{sessionID}/command",
2258
+ ...options,
2259
+ ...params,
2260
+ headers: {
2261
+ "Content-Type": "application/json",
2262
+ ...options?.headers,
2263
+ ...params.headers,
2264
+ },
2265
+ });
2266
+ }
2267
+ /**
2268
+ * Run shell command
2269
+ *
2270
+ * Execute a shell command within the session context and return the AI's response.
2271
+ */
2272
+ shell(parameters, options) {
2273
+ const params = buildClientParams([parameters], [
2274
+ {
2275
+ args: [
2276
+ { in: "path", key: "sessionID" },
2277
+ { in: "query", key: "directory" },
2278
+ { in: "query", key: "workspace" },
2279
+ { in: "body", key: "messageID" },
2280
+ { in: "body", key: "agent" },
2281
+ { in: "body", key: "model" },
2282
+ { in: "body", key: "command" },
2283
+ ],
2284
+ },
2285
+ ]);
2286
+ return (options?.client ?? this.client).post({
2287
+ url: "/session/{sessionID}/shell",
2288
+ ...options,
2289
+ ...params,
2290
+ headers: {
2291
+ "Content-Type": "application/json",
2292
+ ...options?.headers,
2293
+ ...params.headers,
2294
+ },
2295
+ });
2296
+ }
2297
+ /**
2298
+ * Revert message
2299
+ *
2300
+ * Revert a specific message in a session, undoing its effects and restoring the previous state.
2301
+ */
2302
+ revert(parameters, options) {
2303
+ const params = buildClientParams([parameters], [
2304
+ {
2305
+ args: [
2306
+ { in: "path", key: "sessionID" },
2307
+ { in: "query", key: "directory" },
2308
+ { in: "query", key: "workspace" },
2309
+ { in: "body", key: "messageID" },
2310
+ { in: "body", key: "partID" },
2311
+ ],
2312
+ },
2313
+ ]);
2314
+ return (options?.client ?? this.client).post({
2315
+ url: "/session/{sessionID}/revert",
2316
+ ...options,
2317
+ ...params,
2318
+ headers: {
2319
+ "Content-Type": "application/json",
2320
+ ...options?.headers,
2321
+ ...params.headers,
2322
+ },
2323
+ });
2324
+ }
2325
+ /**
2326
+ * Restore reverted messages
2327
+ *
2328
+ * Restore all previously reverted messages in a session.
2329
+ */
2330
+ unrevert(parameters, options) {
2331
+ const params = buildClientParams([parameters], [
2332
+ {
2333
+ args: [
2334
+ { in: "path", key: "sessionID" },
2335
+ { in: "query", key: "directory" },
2336
+ { in: "query", key: "workspace" },
2337
+ ],
2338
+ },
2339
+ ]);
2340
+ return (options?.client ?? this.client).post({
2341
+ url: "/session/{sessionID}/unrevert",
2214
2342
  ...options,
2215
2343
  ...params,
2216
2344
  });
2217
2345
  }
2218
2346
  }
2219
- export class Mcp extends HeyApiClient {
2347
+ export class Part extends HeyApiClient {
2220
2348
  /**
2221
- * Get MCP status
2349
+ * Delete a part from a message.
2350
+ */
2351
+ delete(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
+ ],
2361
+ },
2362
+ ]);
2363
+ return (options?.client ?? this.client).delete({
2364
+ url: "/session/{sessionID}/message/{messageID}/part/{partID}",
2365
+ ...options,
2366
+ ...params,
2367
+ });
2368
+ }
2369
+ /**
2370
+ * Update a part in a message.
2371
+ */
2372
+ update(parameters, options) {
2373
+ const params = buildClientParams([parameters], [
2374
+ {
2375
+ args: [
2376
+ { in: "path", key: "sessionID" },
2377
+ { in: "path", key: "messageID" },
2378
+ { in: "path", key: "partID" },
2379
+ { in: "query", key: "directory" },
2380
+ { in: "query", key: "workspace" },
2381
+ { key: "part", map: "body" },
2382
+ ],
2383
+ },
2384
+ ]);
2385
+ return (options?.client ?? this.client).patch({
2386
+ url: "/session/{sessionID}/message/{messageID}/part/{partID}",
2387
+ ...options,
2388
+ ...params,
2389
+ headers: {
2390
+ "Content-Type": "application/json",
2391
+ ...options?.headers,
2392
+ ...params.headers,
2393
+ },
2394
+ });
2395
+ }
2396
+ }
2397
+ export class History extends HeyApiClient {
2398
+ /**
2399
+ * List sync events
2222
2400
  *
2223
- * Get the status of all Model Context Protocol (MCP) servers.
2401
+ * 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
2402
  */
2225
- status(parameters, options) {
2403
+ list(parameters, options) {
2404
+ const params = buildClientParams([parameters], [
2405
+ {
2406
+ args: [
2407
+ { in: "query", key: "directory" },
2408
+ { in: "query", key: "workspace" },
2409
+ { key: "body", map: "body" },
2410
+ ],
2411
+ },
2412
+ ]);
2413
+ return (options?.client ?? this.client).post({
2414
+ url: "/sync/history",
2415
+ ...options,
2416
+ ...params,
2417
+ headers: {
2418
+ "Content-Type": "application/json",
2419
+ ...options?.headers,
2420
+ ...params.headers,
2421
+ },
2422
+ });
2423
+ }
2424
+ }
2425
+ export class Sync extends HeyApiClient {
2426
+ /**
2427
+ * Start workspace sync
2428
+ *
2429
+ * Start sync loops for workspaces in the current project that have active sessions.
2430
+ */
2431
+ start(parameters, options) {
2432
+ const params = buildClientParams([parameters], [
2433
+ {
2434
+ args: [
2435
+ { in: "query", key: "directory" },
2436
+ { in: "query", key: "workspace" },
2437
+ ],
2438
+ },
2439
+ ]);
2440
+ return (options?.client ?? this.client).post({
2441
+ url: "/sync/start",
2442
+ ...options,
2443
+ ...params,
2444
+ });
2445
+ }
2446
+ /**
2447
+ * Replay sync events
2448
+ *
2449
+ * Validate and replay a complete sync event history.
2450
+ */
2451
+ replay(parameters, options) {
2452
+ const params = buildClientParams([parameters], [
2453
+ {
2454
+ args: [
2455
+ {
2456
+ in: "query",
2457
+ key: "query_directory",
2458
+ map: "directory",
2459
+ },
2460
+ { in: "query", key: "workspace" },
2461
+ {
2462
+ in: "body",
2463
+ key: "body_directory",
2464
+ map: "directory",
2465
+ },
2466
+ { in: "body", key: "events" },
2467
+ ],
2468
+ },
2469
+ ]);
2470
+ return (options?.client ?? this.client).post({
2471
+ url: "/sync/replay",
2472
+ ...options,
2473
+ ...params,
2474
+ headers: {
2475
+ "Content-Type": "application/json",
2476
+ ...options?.headers,
2477
+ ...params.headers,
2478
+ },
2479
+ });
2480
+ }
2481
+ _history;
2482
+ get history() {
2483
+ return (this._history ??= new History({ client: this.client }));
2484
+ }
2485
+ }
2486
+ export class Session3 extends HeyApiClient {
2487
+ /**
2488
+ * List v2 sessions
2489
+ *
2490
+ * Retrieve sessions in the requested order. Items keep that order across pages; use cursor.next or cursor.previous to move through the ordered list.
2491
+ */
2492
+ list(parameters, options) {
2226
2493
  const params = buildClientParams([parameters], [
2227
2494
  {
2228
2495
  args: [
@@ -2232,29 +2499,30 @@ export class Mcp extends HeyApiClient {
2232
2499
  },
2233
2500
  ]);
2234
2501
  return (options?.client ?? this.client).get({
2235
- url: "/mcp",
2502
+ url: "/api/session",
2236
2503
  ...options,
2237
2504
  ...params,
2238
2505
  });
2239
2506
  }
2240
2507
  /**
2241
- * Add MCP server
2508
+ * Send v2 message
2242
2509
  *
2243
- * Dynamically add a new Model Context Protocol (MCP) server to the system.
2510
+ * Create a v2 session message and queue it for the agent loop.
2244
2511
  */
2245
- add(parameters, options) {
2512
+ prompt(parameters, options) {
2246
2513
  const params = buildClientParams([parameters], [
2247
2514
  {
2248
2515
  args: [
2516
+ { in: "path", key: "sessionID" },
2249
2517
  { in: "query", key: "directory" },
2250
2518
  { in: "query", key: "workspace" },
2251
- { in: "body", key: "name" },
2252
- { in: "body", key: "config" },
2519
+ { in: "body", key: "prompt" },
2520
+ { in: "body", key: "delivery" },
2253
2521
  ],
2254
2522
  },
2255
2523
  ]);
2256
2524
  return (options?.client ?? this.client).post({
2257
- url: "/mcp",
2525
+ url: "/api/session/{sessionID}/prompt",
2258
2526
  ...options,
2259
2527
  ...params,
2260
2528
  headers: {
@@ -2265,53 +2533,101 @@ export class Mcp extends HeyApiClient {
2265
2533
  });
2266
2534
  }
2267
2535
  /**
2268
- * Connect an MCP server
2536
+ * Compact v2 session
2537
+ *
2538
+ * Compact a v2 session conversation.
2269
2539
  */
2270
- connect(parameters, options) {
2540
+ compact(parameters, options) {
2271
2541
  const params = buildClientParams([parameters], [
2272
2542
  {
2273
2543
  args: [
2274
- { in: "path", key: "name" },
2544
+ { in: "path", key: "sessionID" },
2275
2545
  { in: "query", key: "directory" },
2276
2546
  { in: "query", key: "workspace" },
2277
2547
  ],
2278
2548
  },
2279
2549
  ]);
2280
2550
  return (options?.client ?? this.client).post({
2281
- url: "/mcp/{name}/connect",
2551
+ url: "/api/session/{sessionID}/compact",
2282
2552
  ...options,
2283
2553
  ...params,
2284
2554
  });
2285
2555
  }
2286
2556
  /**
2287
- * Disconnect an MCP server
2557
+ * Wait for v2 session
2558
+ *
2559
+ * Wait for a v2 session agent loop to become idle.
2288
2560
  */
2289
- disconnect(parameters, options) {
2561
+ wait(parameters, options) {
2290
2562
  const params = buildClientParams([parameters], [
2291
2563
  {
2292
2564
  args: [
2293
- { in: "path", key: "name" },
2565
+ { in: "path", key: "sessionID" },
2294
2566
  { in: "query", key: "directory" },
2295
2567
  { in: "query", key: "workspace" },
2296
2568
  ],
2297
2569
  },
2298
2570
  ]);
2299
2571
  return (options?.client ?? this.client).post({
2300
- url: "/mcp/{name}/disconnect",
2572
+ url: "/api/session/{sessionID}/wait",
2301
2573
  ...options,
2302
2574
  ...params,
2303
2575
  });
2304
2576
  }
2305
- _auth;
2306
- get auth() {
2307
- return (this._auth ??= new Auth2({ client: this.client }));
2577
+ /**
2578
+ * Get v2 session context
2579
+ *
2580
+ * Retrieve the active context messages for a v2 session (all messages after the last compaction).
2581
+ */
2582
+ context(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}/context",
2594
+ ...options,
2595
+ ...params,
2596
+ });
2597
+ }
2598
+ /**
2599
+ * Get v2 session messages
2600
+ *
2601
+ * 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.
2602
+ */
2603
+ messages(parameters, options) {
2604
+ const params = buildClientParams([parameters], [
2605
+ {
2606
+ args: [
2607
+ { in: "path", key: "sessionID" },
2608
+ { in: "query", key: "directory" },
2609
+ { in: "query", key: "workspace" },
2610
+ ],
2611
+ },
2612
+ ]);
2613
+ return (options?.client ?? this.client).get({
2614
+ url: "/api/session/{sessionID}/message",
2615
+ ...options,
2616
+ ...params,
2617
+ });
2618
+ }
2619
+ }
2620
+ export class V2 extends HeyApiClient {
2621
+ _session;
2622
+ get session() {
2623
+ return (this._session ??= new Session3({ client: this.client }));
2308
2624
  }
2309
2625
  }
2310
2626
  export class Control extends HeyApiClient {
2311
2627
  /**
2312
2628
  * Get next TUI request
2313
2629
  *
2314
- * Retrieve the next TUI (Terminal User Interface) request from the queue for processing.
2630
+ * Retrieve the next TUI request from the queue for processing.
2315
2631
  */
2316
2632
  next(parameters, options) {
2317
2633
  const params = buildClientParams([parameters], [
@@ -2359,7 +2675,7 @@ export class Tui extends HeyApiClient {
2359
2675
  /**
2360
2676
  * Append TUI prompt
2361
2677
  *
2362
- * Append prompt to the TUI
2678
+ * Append prompt to the TUI.
2363
2679
  */
2364
2680
  appendPrompt(parameters, options) {
2365
2681
  const params = buildClientParams([parameters], [
@@ -2405,7 +2721,7 @@ export class Tui extends HeyApiClient {
2405
2721
  /**
2406
2722
  * Open sessions dialog
2407
2723
  *
2408
- * Open the session dialog
2724
+ * Open the session dialog.
2409
2725
  */
2410
2726
  openSessions(parameters, options) {
2411
2727
  const params = buildClientParams([parameters], [
@@ -2425,7 +2741,7 @@ export class Tui extends HeyApiClient {
2425
2741
  /**
2426
2742
  * Open themes dialog
2427
2743
  *
2428
- * Open the theme dialog
2744
+ * Open the theme dialog.
2429
2745
  */
2430
2746
  openThemes(parameters, options) {
2431
2747
  const params = buildClientParams([parameters], [
@@ -2445,7 +2761,7 @@ export class Tui extends HeyApiClient {
2445
2761
  /**
2446
2762
  * Open models dialog
2447
2763
  *
2448
- * Open the model dialog
2764
+ * Open the model dialog.
2449
2765
  */
2450
2766
  openModels(parameters, options) {
2451
2767
  const params = buildClientParams([parameters], [
@@ -2465,7 +2781,7 @@ export class Tui extends HeyApiClient {
2465
2781
  /**
2466
2782
  * Submit TUI prompt
2467
2783
  *
2468
- * Submit the prompt
2784
+ * Submit the prompt.
2469
2785
  */
2470
2786
  submitPrompt(parameters, options) {
2471
2787
  const params = buildClientParams([parameters], [
@@ -2485,7 +2801,7 @@ export class Tui extends HeyApiClient {
2485
2801
  /**
2486
2802
  * Clear TUI prompt
2487
2803
  *
2488
- * Clear the prompt
2804
+ * Clear the prompt.
2489
2805
  */
2490
2806
  clearPrompt(parameters, options) {
2491
2807
  const params = buildClientParams([parameters], [
@@ -2505,7 +2821,7 @@ export class Tui extends HeyApiClient {
2505
2821
  /**
2506
2822
  * Execute TUI command
2507
2823
  *
2508
- * Execute a TUI command (e.g. agent_cycle)
2824
+ * Execute a TUI command.
2509
2825
  */
2510
2826
  executeCommand(parameters, options) {
2511
2827
  const params = buildClientParams([parameters], [
@@ -2531,7 +2847,7 @@ export class Tui extends HeyApiClient {
2531
2847
  /**
2532
2848
  * Show TUI toast
2533
2849
  *
2534
- * Show a toast notification in the TUI
2850
+ * Show a toast notification in the TUI.
2535
2851
  */
2536
2852
  showToast(parameters, options) {
2537
2853
  const params = buildClientParams([parameters], [
@@ -2560,7 +2876,7 @@ export class Tui extends HeyApiClient {
2560
2876
  /**
2561
2877
  * Publish TUI event
2562
2878
  *
2563
- * Publish a TUI event
2879
+ * Publish a TUI event.
2564
2880
  */
2565
2881
  publish(parameters, options) {
2566
2882
  const params = buildClientParams([parameters], [
@@ -2614,169 +2930,12 @@ export class Tui extends HeyApiClient {
2614
2930
  return (this._control ??= new Control({ client: this.client }));
2615
2931
  }
2616
2932
  }
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
2933
  export class OpencodeClient extends HeyApiClient {
2771
2934
  static __registry = new HeyApiRegistry();
2772
2935
  constructor(args) {
2773
2936
  super(args);
2774
2937
  OpencodeClient.__registry.set(this, args?.key);
2775
2938
  }
2776
- _global;
2777
- get global() {
2778
- return (this._global ??= new Global({ client: this.client }));
2779
- }
2780
2939
  _auth;
2781
2940
  get auth() {
2782
2941
  return (this._auth ??= new Auth({ client: this.client }));
@@ -2785,22 +2944,22 @@ export class OpencodeClient extends HeyApiClient {
2785
2944
  get app() {
2786
2945
  return (this._app ??= new App({ client: this.client }));
2787
2946
  }
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 }));
2947
+ _global;
2948
+ get global() {
2949
+ return (this._global ??= new Global({ client: this.client }));
2795
2950
  }
2796
- _pty;
2797
- get pty() {
2798
- return (this._pty ??= new Pty({ client: this.client }));
2951
+ _event;
2952
+ get event() {
2953
+ return (this._event ??= new Event({ client: this.client }));
2799
2954
  }
2800
2955
  _config;
2801
2956
  get config() {
2802
2957
  return (this._config ??= new Config2({ client: this.client }));
2803
2958
  }
2959
+ _experimental;
2960
+ get experimental() {
2961
+ return (this._experimental ??= new Experimental({ client: this.client }));
2962
+ }
2804
2963
  _tool;
2805
2964
  get tool() {
2806
2965
  return (this._tool ??= new Tool({ client: this.client }));
@@ -2809,30 +2968,6 @@ export class OpencodeClient extends HeyApiClient {
2809
2968
  get worktree() {
2810
2969
  return (this._worktree ??= new Worktree({ client: this.client }));
2811
2970
  }
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
2971
  _find;
2837
2972
  get find() {
2838
2973
  return (this._find ??= new Find({ client: this.client }));
@@ -2841,18 +2976,6 @@ export class OpencodeClient extends HeyApiClient {
2841
2976
  get file() {
2842
2977
  return (this._file ??= new File({ client: this.client }));
2843
2978
  }
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
2979
  _instance;
2857
2980
  get instance() {
2858
2981
  return (this._instance ??= new Instance({ client: this.client }));
@@ -2877,4 +3000,48 @@ export class OpencodeClient extends HeyApiClient {
2877
3000
  get formatter() {
2878
3001
  return (this._formatter ??= new Formatter({ client: this.client }));
2879
3002
  }
3003
+ _mcp;
3004
+ get mcp() {
3005
+ return (this._mcp ??= new Mcp({ client: this.client }));
3006
+ }
3007
+ _project;
3008
+ get project() {
3009
+ return (this._project ??= new Project({ client: this.client }));
3010
+ }
3011
+ _pty;
3012
+ get pty() {
3013
+ return (this._pty ??= new Pty({ client: this.client }));
3014
+ }
3015
+ _question;
3016
+ get question() {
3017
+ return (this._question ??= new Question({ client: this.client }));
3018
+ }
3019
+ _permission;
3020
+ get permission() {
3021
+ return (this._permission ??= new Permission({ client: this.client }));
3022
+ }
3023
+ _provider;
3024
+ get provider() {
3025
+ return (this._provider ??= new Provider({ client: this.client }));
3026
+ }
3027
+ _session;
3028
+ get session() {
3029
+ return (this._session ??= new Session2({ client: this.client }));
3030
+ }
3031
+ _part;
3032
+ get part() {
3033
+ return (this._part ??= new Part({ client: this.client }));
3034
+ }
3035
+ _sync;
3036
+ get sync() {
3037
+ return (this._sync ??= new Sync({ client: this.client }));
3038
+ }
3039
+ _v2;
3040
+ get v2() {
3041
+ return (this._v2 ??= new V2({ client: this.client }));
3042
+ }
3043
+ _tui;
3044
+ get tui() {
3045
+ return (this._tui ??= new Tui({ client: this.client }));
3046
+ }
2880
3047
  }