opencode-immune 1.0.81 → 1.0.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/plugin/server.js +1507 -1072
  2. package/package.json +3 -3
@@ -861,94 +861,6 @@ var HeyApiRegistry = class {
861
861
  this.instances.set(key ?? this.defaultKey, value);
862
862
  }
863
863
  };
864
- var Config = class extends HeyApiClient {
865
- /**
866
- * Get global configuration
867
- *
868
- * Retrieve the current global OpenCode configuration settings and preferences.
869
- */
870
- get(options) {
871
- return (options?.client ?? this.client).get({
872
- url: "/global/config",
873
- ...options
874
- });
875
- }
876
- /**
877
- * Update global configuration
878
- *
879
- * Update global OpenCode configuration settings and preferences.
880
- */
881
- update(parameters, options) {
882
- const params = buildClientParams([parameters], [{ args: [{ key: "config", map: "body" }] }]);
883
- return (options?.client ?? this.client).patch({
884
- url: "/global/config",
885
- ...options,
886
- ...params,
887
- headers: {
888
- "Content-Type": "application/json",
889
- ...options?.headers,
890
- ...params.headers
891
- }
892
- });
893
- }
894
- };
895
- var Global = class extends HeyApiClient {
896
- /**
897
- * Get health
898
- *
899
- * Get health information about the OpenCode server.
900
- */
901
- health(options) {
902
- return (options?.client ?? this.client).get({
903
- url: "/global/health",
904
- ...options
905
- });
906
- }
907
- /**
908
- * Get global events
909
- *
910
- * Subscribe to global events from the OpenCode system using server-sent events.
911
- */
912
- event(options) {
913
- return (options?.client ?? this.client).sse.get({
914
- url: "/global/event",
915
- ...options
916
- });
917
- }
918
- /**
919
- * Dispose instance
920
- *
921
- * Clean up and dispose all OpenCode instances, releasing all resources.
922
- */
923
- dispose(options) {
924
- return (options?.client ?? this.client).post({
925
- url: "/global/dispose",
926
- ...options
927
- });
928
- }
929
- /**
930
- * Upgrade opencode
931
- *
932
- * Upgrade opencode to the specified version or latest if not specified.
933
- */
934
- upgrade(parameters, options) {
935
- const params = buildClientParams([parameters], [{ args: [{ in: "body", key: "target" }] }]);
936
- return (options?.client ?? this.client).post({
937
- url: "/global/upgrade",
938
- ...options,
939
- ...params,
940
- headers: {
941
- "Content-Type": "application/json",
942
- ...options?.headers,
943
- ...params.headers
944
- }
945
- });
946
- }
947
- _config;
948
- get config() {
949
- return this._config ??= new Config({ client: this.client });
950
- }
951
- };
952
864
  var Auth = class extends HeyApiClient {
953
865
  /**
954
866
  * Remove auth credentials
@@ -1060,69 +972,80 @@ var App = class extends HeyApiClient {
1060
972
  });
1061
973
  }
1062
974
  };
1063
- var Adaptor = class extends HeyApiClient {
975
+ var Config = class extends HeyApiClient {
1064
976
  /**
1065
- * List workspace adaptors
977
+ * Get global configuration
1066
978
  *
1067
- * List all available workspace adaptors for the current project.
979
+ * Retrieve the current global OpenCode configuration settings and preferences.
1068
980
  */
1069
- list(parameters, options) {
1070
- const params = buildClientParams([parameters], [
1071
- {
1072
- args: [
1073
- { in: "query", key: "directory" },
1074
- { in: "query", key: "workspace" }
1075
- ]
1076
- }
1077
- ]);
981
+ get(options) {
1078
982
  return (options?.client ?? this.client).get({
1079
- url: "/experimental/workspace/adaptor",
983
+ url: "/global/config",
984
+ ...options
985
+ });
986
+ }
987
+ /**
988
+ * Update global configuration
989
+ *
990
+ * Update global OpenCode configuration settings and preferences.
991
+ */
992
+ update(parameters, options) {
993
+ const params = buildClientParams([parameters], [{ args: [{ key: "config", map: "body" }] }]);
994
+ return (options?.client ?? this.client).patch({
995
+ url: "/global/config",
1080
996
  ...options,
1081
- ...params
997
+ ...params,
998
+ headers: {
999
+ "Content-Type": "application/json",
1000
+ ...options?.headers,
1001
+ ...params.headers
1002
+ }
1082
1003
  });
1083
1004
  }
1084
1005
  };
1085
- var Workspace = class extends HeyApiClient {
1006
+ var Global = class extends HeyApiClient {
1086
1007
  /**
1087
- * List workspaces
1008
+ * Get health
1088
1009
  *
1089
- * List all workspaces.
1010
+ * Get health information about the OpenCode server.
1090
1011
  */
1091
- list(parameters, options) {
1092
- const params = buildClientParams([parameters], [
1093
- {
1094
- args: [
1095
- { in: "query", key: "directory" },
1096
- { in: "query", key: "workspace" }
1097
- ]
1098
- }
1099
- ]);
1012
+ health(options) {
1100
1013
  return (options?.client ?? this.client).get({
1101
- url: "/experimental/workspace",
1102
- ...options,
1103
- ...params
1014
+ url: "/global/health",
1015
+ ...options
1104
1016
  });
1105
1017
  }
1106
1018
  /**
1107
- * Create workspace
1019
+ * Get global events
1108
1020
  *
1109
- * Create a workspace for the current project.
1021
+ * Subscribe to global events from the OpenCode system using server-sent events.
1110
1022
  */
1111
- create(parameters, options) {
1112
- const params = buildClientParams([parameters], [
1113
- {
1114
- args: [
1115
- { in: "query", key: "directory" },
1116
- { in: "query", key: "workspace" },
1117
- { in: "body", key: "id" },
1118
- { in: "body", key: "type" },
1119
- { in: "body", key: "branch" },
1120
- { in: "body", key: "extra" }
1121
- ]
1122
- }
1123
- ]);
1023
+ event(options) {
1024
+ return (options?.client ?? this.client).sse.get({
1025
+ url: "/global/event",
1026
+ ...options
1027
+ });
1028
+ }
1029
+ /**
1030
+ * Dispose instance
1031
+ *
1032
+ * Clean up and dispose all OpenCode instances, releasing all resources.
1033
+ */
1034
+ dispose(options) {
1124
1035
  return (options?.client ?? this.client).post({
1125
- url: "/experimental/workspace",
1036
+ url: "/global/dispose",
1037
+ ...options
1038
+ });
1039
+ }
1040
+ /**
1041
+ * Upgrade opencode
1042
+ *
1043
+ * Upgrade opencode to the specified version or latest if not specified.
1044
+ */
1045
+ upgrade(parameters, options) {
1046
+ const params = buildClientParams([parameters], [{ args: [{ in: "body", key: "target" }] }]);
1047
+ return (options?.client ?? this.client).post({
1048
+ url: "/global/upgrade",
1126
1049
  ...options,
1127
1050
  ...params,
1128
1051
  headers: {
@@ -1132,12 +1055,18 @@ var Workspace = class extends HeyApiClient {
1132
1055
  }
1133
1056
  });
1134
1057
  }
1058
+ _config;
1059
+ get config() {
1060
+ return this._config ??= new Config({ client: this.client });
1061
+ }
1062
+ };
1063
+ var Event = class extends HeyApiClient {
1135
1064
  /**
1136
- * Workspace status
1065
+ * Subscribe to events
1137
1066
  *
1138
- * Get connection status for workspaces in the current project.
1067
+ * Get events
1139
1068
  */
1140
- status(parameters, options) {
1069
+ subscribe(parameters, options) {
1141
1070
  const params = buildClientParams([parameters], [
1142
1071
  {
1143
1072
  args: [
@@ -1146,51 +1075,51 @@ var Workspace = class extends HeyApiClient {
1146
1075
  ]
1147
1076
  }
1148
1077
  ]);
1149
- return (options?.client ?? this.client).get({
1150
- url: "/experimental/workspace/status",
1078
+ return (options?.client ?? this.client).sse.get({
1079
+ url: "/event",
1151
1080
  ...options,
1152
1081
  ...params
1153
1082
  });
1154
1083
  }
1084
+ };
1085
+ var Config2 = class extends HeyApiClient {
1155
1086
  /**
1156
- * Remove workspace
1087
+ * Get configuration
1157
1088
  *
1158
- * Remove an existing workspace.
1089
+ * Retrieve the current OpenCode configuration settings and preferences.
1159
1090
  */
1160
- remove(parameters, options) {
1091
+ get(parameters, options) {
1161
1092
  const params = buildClientParams([parameters], [
1162
1093
  {
1163
1094
  args: [
1164
- { in: "path", key: "id" },
1165
1095
  { in: "query", key: "directory" },
1166
1096
  { in: "query", key: "workspace" }
1167
1097
  ]
1168
1098
  }
1169
1099
  ]);
1170
- return (options?.client ?? this.client).delete({
1171
- url: "/experimental/workspace/{id}",
1100
+ return (options?.client ?? this.client).get({
1101
+ url: "/config",
1172
1102
  ...options,
1173
1103
  ...params
1174
1104
  });
1175
1105
  }
1176
1106
  /**
1177
- * Restore session into workspace
1107
+ * Update configuration
1178
1108
  *
1179
- * Replay a session's sync events into the target workspace in batches.
1109
+ * Update OpenCode configuration settings and preferences.
1180
1110
  */
1181
- sessionRestore(parameters, options) {
1111
+ update(parameters, options) {
1182
1112
  const params = buildClientParams([parameters], [
1183
1113
  {
1184
1114
  args: [
1185
- { in: "path", key: "id" },
1186
1115
  { in: "query", key: "directory" },
1187
1116
  { in: "query", key: "workspace" },
1188
- { in: "body", key: "sessionID" }
1117
+ { key: "config", map: "body" }
1189
1118
  ]
1190
1119
  }
1191
1120
  ]);
1192
- return (options?.client ?? this.client).post({
1193
- url: "/experimental/workspace/{id}/session-restore",
1121
+ return (options?.client ?? this.client).patch({
1122
+ url: "/config",
1194
1123
  ...options,
1195
1124
  ...params,
1196
1125
  headers: {
@@ -1200,9 +1129,25 @@ var Workspace = class extends HeyApiClient {
1200
1129
  }
1201
1130
  });
1202
1131
  }
1203
- _adaptor;
1204
- get adaptor() {
1205
- return this._adaptor ??= new Adaptor({ client: this.client });
1132
+ /**
1133
+ * List config providers
1134
+ *
1135
+ * Get a list of all configured AI providers and their default models.
1136
+ */
1137
+ providers(parameters, options) {
1138
+ const params = buildClientParams([parameters], [
1139
+ {
1140
+ args: [
1141
+ { in: "query", key: "directory" },
1142
+ { in: "query", key: "workspace" }
1143
+ ]
1144
+ }
1145
+ ]);
1146
+ return (options?.client ?? this.client).get({
1147
+ url: "/config/providers",
1148
+ ...options,
1149
+ ...params
1150
+ });
1206
1151
  }
1207
1152
  };
1208
1153
  var Console = class extends HeyApiClient {
@@ -1324,29 +1269,11 @@ var Resource = class extends HeyApiClient {
1324
1269
  });
1325
1270
  }
1326
1271
  };
1327
- var Experimental = class extends HeyApiClient {
1328
- _workspace;
1329
- get workspace() {
1330
- return this._workspace ??= new Workspace({ client: this.client });
1331
- }
1332
- _console;
1333
- get console() {
1334
- return this._console ??= new Console({ client: this.client });
1335
- }
1336
- _session;
1337
- get session() {
1338
- return this._session ??= new Session({ client: this.client });
1339
- }
1340
- _resource;
1341
- get resource() {
1342
- return this._resource ??= new Resource({ client: this.client });
1343
- }
1344
- };
1345
- var Project = class extends HeyApiClient {
1272
+ var Adapter = class extends HeyApiClient {
1346
1273
  /**
1347
- * List all projects
1274
+ * List workspace adapters
1348
1275
  *
1349
- * Get a list of projects that have been opened with OpenCode.
1276
+ * List all available workspace adapters for the current project.
1350
1277
  */
1351
1278
  list(parameters, options) {
1352
1279
  const params = buildClientParams([parameters], [
@@ -1358,86 +1285,17 @@ var Project = class extends HeyApiClient {
1358
1285
  }
1359
1286
  ]);
1360
1287
  return (options?.client ?? this.client).get({
1361
- url: "/project",
1362
- ...options,
1363
- ...params
1364
- });
1365
- }
1366
- /**
1367
- * Get current project
1368
- *
1369
- * Retrieve the currently active project that OpenCode is working with.
1370
- */
1371
- current(parameters, options) {
1372
- const params = buildClientParams([parameters], [
1373
- {
1374
- args: [
1375
- { in: "query", key: "directory" },
1376
- { in: "query", key: "workspace" }
1377
- ]
1378
- }
1379
- ]);
1380
- return (options?.client ?? this.client).get({
1381
- url: "/project/current",
1382
- ...options,
1383
- ...params
1384
- });
1385
- }
1386
- /**
1387
- * Initialize git repository
1388
- *
1389
- * Create a git repository for the current project and return the refreshed project info.
1390
- */
1391
- initGit(parameters, options) {
1392
- const params = buildClientParams([parameters], [
1393
- {
1394
- args: [
1395
- { in: "query", key: "directory" },
1396
- { in: "query", key: "workspace" }
1397
- ]
1398
- }
1399
- ]);
1400
- return (options?.client ?? this.client).post({
1401
- url: "/project/git/init",
1288
+ url: "/experimental/workspace/adapter",
1402
1289
  ...options,
1403
1290
  ...params
1404
1291
  });
1405
1292
  }
1406
- /**
1407
- * Update project
1408
- *
1409
- * Update project properties such as name, icon, and commands.
1410
- */
1411
- update(parameters, options) {
1412
- const params = buildClientParams([parameters], [
1413
- {
1414
- args: [
1415
- { in: "path", key: "projectID" },
1416
- { in: "query", key: "directory" },
1417
- { in: "query", key: "workspace" },
1418
- { in: "body", key: "name" },
1419
- { in: "body", key: "icon" },
1420
- { in: "body", key: "commands" }
1421
- ]
1422
- }
1423
- ]);
1424
- return (options?.client ?? this.client).patch({
1425
- url: "/project/{projectID}",
1426
- ...options,
1427
- ...params,
1428
- headers: {
1429
- "Content-Type": "application/json",
1430
- ...options?.headers,
1431
- ...params.headers
1432
- }
1433
- });
1434
- }
1435
1293
  };
1436
- var Pty = class extends HeyApiClient {
1294
+ var Workspace = class extends HeyApiClient {
1437
1295
  /**
1438
- * List PTY sessions
1296
+ * List workspaces
1439
1297
  *
1440
- * Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode.
1298
+ * List all workspaces.
1441
1299
  */
1442
1300
  list(parameters, options) {
1443
1301
  const params = buildClientParams([parameters], [
@@ -1449,15 +1307,15 @@ var Pty = class extends HeyApiClient {
1449
1307
  }
1450
1308
  ]);
1451
1309
  return (options?.client ?? this.client).get({
1452
- url: "/pty",
1310
+ url: "/experimental/workspace",
1453
1311
  ...options,
1454
1312
  ...params
1455
1313
  });
1456
1314
  }
1457
1315
  /**
1458
- * Create PTY session
1316
+ * Create workspace
1459
1317
  *
1460
- * Create a new pseudo-terminal (PTY) session for running shell commands and processes.
1318
+ * Create a workspace for the current project.
1461
1319
  */
1462
1320
  create(parameters, options) {
1463
1321
  const params = buildClientParams([parameters], [
@@ -1465,16 +1323,15 @@ var Pty = class extends HeyApiClient {
1465
1323
  args: [
1466
1324
  { in: "query", key: "directory" },
1467
1325
  { in: "query", key: "workspace" },
1468
- { in: "body", key: "command" },
1469
- { in: "body", key: "args" },
1470
- { in: "body", key: "cwd" },
1471
- { in: "body", key: "title" },
1472
- { in: "body", key: "env" }
1326
+ { in: "body", key: "id" },
1327
+ { in: "body", key: "type" },
1328
+ { in: "body", key: "branch" },
1329
+ { in: "body", key: "extra" }
1473
1330
  ]
1474
1331
  }
1475
1332
  ]);
1476
1333
  return (options?.client ?? this.client).post({
1477
- url: "/pty",
1334
+ url: "/experimental/workspace",
1478
1335
  ...options,
1479
1336
  ...params,
1480
1337
  headers: {
@@ -1485,135 +1342,85 @@ var Pty = class extends HeyApiClient {
1485
1342
  });
1486
1343
  }
1487
1344
  /**
1488
- * Remove PTY session
1489
- *
1490
- * Remove and terminate a specific pseudo-terminal (PTY) session.
1491
- */
1492
- remove(parameters, options) {
1493
- const params = buildClientParams([parameters], [
1494
- {
1495
- args: [
1496
- { in: "path", key: "ptyID" },
1497
- { in: "query", key: "directory" },
1498
- { in: "query", key: "workspace" }
1499
- ]
1500
- }
1501
- ]);
1502
- return (options?.client ?? this.client).delete({
1503
- url: "/pty/{ptyID}",
1504
- ...options,
1505
- ...params
1506
- });
1507
- }
1508
- /**
1509
- * Get PTY session
1345
+ * Sync workspace list
1510
1346
  *
1511
- * Retrieve detailed information about a specific pseudo-terminal (PTY) session.
1347
+ * Register missing workspaces returned by workspace adapters.
1512
1348
  */
1513
- get(parameters, options) {
1349
+ syncList(parameters, options) {
1514
1350
  const params = buildClientParams([parameters], [
1515
1351
  {
1516
1352
  args: [
1517
- { in: "path", key: "ptyID" },
1518
1353
  { in: "query", key: "directory" },
1519
1354
  { in: "query", key: "workspace" }
1520
1355
  ]
1521
1356
  }
1522
1357
  ]);
1523
- return (options?.client ?? this.client).get({
1524
- url: "/pty/{ptyID}",
1358
+ return (options?.client ?? this.client).post({
1359
+ url: "/experimental/workspace/sync-list",
1525
1360
  ...options,
1526
1361
  ...params
1527
1362
  });
1528
1363
  }
1529
1364
  /**
1530
- * Update PTY session
1531
- *
1532
- * Update properties of an existing pseudo-terminal (PTY) session.
1533
- */
1534
- update(parameters, options) {
1535
- const params = buildClientParams([parameters], [
1536
- {
1537
- args: [
1538
- { in: "path", key: "ptyID" },
1539
- { in: "query", key: "directory" },
1540
- { in: "query", key: "workspace" },
1541
- { in: "body", key: "title" },
1542
- { in: "body", key: "size" }
1543
- ]
1544
- }
1545
- ]);
1546
- return (options?.client ?? this.client).put({
1547
- url: "/pty/{ptyID}",
1548
- ...options,
1549
- ...params,
1550
- headers: {
1551
- "Content-Type": "application/json",
1552
- ...options?.headers,
1553
- ...params.headers
1554
- }
1555
- });
1556
- }
1557
- /**
1558
- * Connect to PTY session
1365
+ * Workspace status
1559
1366
  *
1560
- * Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.
1367
+ * Get connection status for workspaces in the current project.
1561
1368
  */
1562
- connect(parameters, options) {
1369
+ status(parameters, options) {
1563
1370
  const params = buildClientParams([parameters], [
1564
1371
  {
1565
1372
  args: [
1566
- { in: "path", key: "ptyID" },
1567
1373
  { in: "query", key: "directory" },
1568
1374
  { in: "query", key: "workspace" }
1569
1375
  ]
1570
1376
  }
1571
1377
  ]);
1572
1378
  return (options?.client ?? this.client).get({
1573
- url: "/pty/{ptyID}/connect",
1379
+ url: "/experimental/workspace/status",
1574
1380
  ...options,
1575
1381
  ...params
1576
1382
  });
1577
1383
  }
1578
- };
1579
- var Config2 = class extends HeyApiClient {
1580
1384
  /**
1581
- * Get configuration
1385
+ * Remove workspace
1582
1386
  *
1583
- * Retrieve the current OpenCode configuration settings and preferences.
1387
+ * Remove an existing workspace.
1584
1388
  */
1585
- get(parameters, options) {
1389
+ remove(parameters, options) {
1586
1390
  const params = buildClientParams([parameters], [
1587
1391
  {
1588
1392
  args: [
1393
+ { in: "path", key: "id" },
1589
1394
  { in: "query", key: "directory" },
1590
1395
  { in: "query", key: "workspace" }
1591
1396
  ]
1592
1397
  }
1593
1398
  ]);
1594
- return (options?.client ?? this.client).get({
1595
- url: "/config",
1399
+ return (options?.client ?? this.client).delete({
1400
+ url: "/experimental/workspace/{id}",
1596
1401
  ...options,
1597
1402
  ...params
1598
1403
  });
1599
1404
  }
1600
1405
  /**
1601
- * Update configuration
1406
+ * Warp session into workspace
1602
1407
  *
1603
- * Update OpenCode configuration settings and preferences.
1408
+ * Move a session's sync history into the target workspace, or detach it to the local project.
1604
1409
  */
1605
- update(parameters, options) {
1410
+ warp(parameters, options) {
1606
1411
  const params = buildClientParams([parameters], [
1607
1412
  {
1608
1413
  args: [
1609
1414
  { in: "query", key: "directory" },
1610
1415
  { in: "query", key: "workspace" },
1611
- { key: "config", map: "body" }
1416
+ { in: "body", key: "id" },
1417
+ { in: "body", key: "sessionID" },
1418
+ { in: "body", key: "copyChanges" }
1612
1419
  ]
1613
1420
  }
1614
1421
  ]);
1615
- return (options?.client ?? this.client).patch({
1616
- url: "/config",
1422
+ return (options?.client ?? this.client).post({
1423
+ url: "/experimental/workspace/warp",
1617
1424
  ...options,
1618
1425
  ...params,
1619
1426
  headers: {
@@ -1623,28 +1430,52 @@ var Config2 = class extends HeyApiClient {
1623
1430
  }
1624
1431
  });
1625
1432
  }
1433
+ _adapter;
1434
+ get adapter() {
1435
+ return this._adapter ??= new Adapter({ client: this.client });
1436
+ }
1437
+ };
1438
+ var Experimental = class extends HeyApiClient {
1439
+ _console;
1440
+ get console() {
1441
+ return this._console ??= new Console({ client: this.client });
1442
+ }
1443
+ _session;
1444
+ get session() {
1445
+ return this._session ??= new Session({ client: this.client });
1446
+ }
1447
+ _resource;
1448
+ get resource() {
1449
+ return this._resource ??= new Resource({ client: this.client });
1450
+ }
1451
+ _workspace;
1452
+ get workspace() {
1453
+ return this._workspace ??= new Workspace({ client: this.client });
1454
+ }
1455
+ };
1456
+ var Tool = class extends HeyApiClient {
1626
1457
  /**
1627
- * List config providers
1458
+ * List tools
1628
1459
  *
1629
- * Get a list of all configured AI providers and their default models.
1460
+ * Get a list of available tools with their JSON schema parameters for a specific provider and model combination.
1630
1461
  */
1631
- providers(parameters, options) {
1462
+ list(parameters, options) {
1632
1463
  const params = buildClientParams([parameters], [
1633
1464
  {
1634
1465
  args: [
1635
1466
  { in: "query", key: "directory" },
1636
- { in: "query", key: "workspace" }
1467
+ { in: "query", key: "workspace" },
1468
+ { in: "query", key: "provider" },
1469
+ { in: "query", key: "model" }
1637
1470
  ]
1638
1471
  }
1639
1472
  ]);
1640
1473
  return (options?.client ?? this.client).get({
1641
- url: "/config/providers",
1474
+ url: "/experimental/tool",
1642
1475
  ...options,
1643
1476
  ...params
1644
1477
  });
1645
1478
  }
1646
- };
1647
- var Tool = class extends HeyApiClient {
1648
1479
  /**
1649
1480
  * List tool IDs
1650
1481
  *
@@ -1665,28 +1496,6 @@ var Tool = class extends HeyApiClient {
1665
1496
  ...params
1666
1497
  });
1667
1498
  }
1668
- /**
1669
- * List tools
1670
- *
1671
- * Get a list of available tools with their JSON schema parameters for a specific provider and model combination.
1672
- */
1673
- list(parameters, options) {
1674
- const params = buildClientParams([parameters], [
1675
- {
1676
- args: [
1677
- { in: "query", key: "directory" },
1678
- { in: "query", key: "workspace" },
1679
- { in: "query", key: "provider" },
1680
- { in: "query", key: "model" }
1681
- ]
1682
- }
1683
- ]);
1684
- return (options?.client ?? this.client).get({
1685
- url: "/experimental/tool",
1686
- ...options,
1687
- ...params
1688
- });
1689
- }
1690
1499
  };
1691
1500
  var Worktree = class extends HeyApiClient {
1692
1501
  /**
@@ -1788,554 +1597,494 @@ var Worktree = class extends HeyApiClient {
1788
1597
  });
1789
1598
  }
1790
1599
  };
1791
- var Session2 = class extends HeyApiClient {
1600
+ var Find = class extends HeyApiClient {
1792
1601
  /**
1793
- * List sessions
1602
+ * Find text
1794
1603
  *
1795
- * Get a list of all OpenCode sessions, sorted by most recently updated.
1604
+ * Search for text patterns across files in the project using ripgrep.
1796
1605
  */
1797
- list(parameters, options) {
1606
+ text(parameters, options) {
1798
1607
  const params = buildClientParams([parameters], [
1799
1608
  {
1800
1609
  args: [
1801
1610
  { in: "query", key: "directory" },
1802
1611
  { in: "query", key: "workspace" },
1803
- { in: "query", key: "roots" },
1804
- { in: "query", key: "start" },
1805
- { in: "query", key: "search" },
1806
- { in: "query", key: "limit" }
1612
+ { in: "query", key: "pattern" }
1807
1613
  ]
1808
1614
  }
1809
1615
  ]);
1810
1616
  return (options?.client ?? this.client).get({
1811
- url: "/session",
1617
+ url: "/find",
1812
1618
  ...options,
1813
1619
  ...params
1814
1620
  });
1815
1621
  }
1816
1622
  /**
1817
- * Create session
1623
+ * Find files
1818
1624
  *
1819
- * Create a new OpenCode session for interacting with AI assistants and managing conversations.
1625
+ * Search for files or directories by name or pattern in the project directory.
1820
1626
  */
1821
- create(parameters, options) {
1627
+ files(parameters, options) {
1822
1628
  const params = buildClientParams([parameters], [
1823
1629
  {
1824
1630
  args: [
1825
1631
  { in: "query", key: "directory" },
1826
1632
  { in: "query", key: "workspace" },
1827
- { in: "body", key: "parentID" },
1828
- { in: "body", key: "title" },
1829
- { in: "body", key: "permission" },
1830
- { in: "body", key: "workspaceID" }
1633
+ { in: "query", key: "query" },
1634
+ { in: "query", key: "dirs" },
1635
+ { in: "query", key: "type" },
1636
+ { in: "query", key: "limit" }
1831
1637
  ]
1832
1638
  }
1833
1639
  ]);
1834
- return (options?.client ?? this.client).post({
1835
- url: "/session",
1640
+ return (options?.client ?? this.client).get({
1641
+ url: "/find/file",
1836
1642
  ...options,
1837
- ...params,
1838
- headers: {
1839
- "Content-Type": "application/json",
1840
- ...options?.headers,
1841
- ...params.headers
1842
- }
1643
+ ...params
1843
1644
  });
1844
1645
  }
1845
1646
  /**
1846
- * Get session status
1647
+ * Find symbols
1847
1648
  *
1848
- * Retrieve the current status of all sessions, including active, idle, and completed states.
1649
+ * Search for workspace symbols like functions, classes, and variables using LSP.
1849
1650
  */
1850
- status(parameters, options) {
1651
+ symbols(parameters, options) {
1851
1652
  const params = buildClientParams([parameters], [
1852
1653
  {
1853
1654
  args: [
1854
1655
  { in: "query", key: "directory" },
1855
- { in: "query", key: "workspace" }
1656
+ { in: "query", key: "workspace" },
1657
+ { in: "query", key: "query" }
1856
1658
  ]
1857
1659
  }
1858
1660
  ]);
1859
1661
  return (options?.client ?? this.client).get({
1860
- url: "/session/status",
1662
+ url: "/find/symbol",
1861
1663
  ...options,
1862
1664
  ...params
1863
1665
  });
1864
1666
  }
1667
+ };
1668
+ var File = class extends HeyApiClient {
1865
1669
  /**
1866
- * Delete session
1670
+ * List files
1867
1671
  *
1868
- * Delete a session and permanently remove all associated data, including messages and history.
1672
+ * List files and directories in a specified path.
1869
1673
  */
1870
- delete(parameters, options) {
1674
+ list(parameters, options) {
1871
1675
  const params = buildClientParams([parameters], [
1872
1676
  {
1873
1677
  args: [
1874
- { in: "path", key: "sessionID" },
1875
1678
  { in: "query", key: "directory" },
1876
- { in: "query", key: "workspace" }
1679
+ { in: "query", key: "workspace" },
1680
+ { in: "query", key: "path" }
1877
1681
  ]
1878
1682
  }
1879
1683
  ]);
1880
- return (options?.client ?? this.client).delete({
1881
- url: "/session/{sessionID}",
1684
+ return (options?.client ?? this.client).get({
1685
+ url: "/file",
1882
1686
  ...options,
1883
1687
  ...params
1884
1688
  });
1885
1689
  }
1886
1690
  /**
1887
- * Get session
1691
+ * Read file
1888
1692
  *
1889
- * Retrieve detailed information about a specific OpenCode session.
1693
+ * Read the content of a specified file.
1890
1694
  */
1891
- get(parameters, options) {
1695
+ read(parameters, options) {
1892
1696
  const params = buildClientParams([parameters], [
1893
1697
  {
1894
1698
  args: [
1895
- { in: "path", key: "sessionID" },
1896
1699
  { in: "query", key: "directory" },
1897
- { in: "query", key: "workspace" }
1700
+ { in: "query", key: "workspace" },
1701
+ { in: "query", key: "path" }
1898
1702
  ]
1899
1703
  }
1900
1704
  ]);
1901
1705
  return (options?.client ?? this.client).get({
1902
- url: "/session/{sessionID}",
1706
+ url: "/file/content",
1903
1707
  ...options,
1904
1708
  ...params
1905
1709
  });
1906
1710
  }
1907
1711
  /**
1908
- * Update session
1712
+ * Get file status
1909
1713
  *
1910
- * Update properties of an existing session, such as title or other metadata.
1714
+ * Get the git status of all files in the project.
1911
1715
  */
1912
- update(parameters, options) {
1716
+ status(parameters, options) {
1913
1717
  const params = buildClientParams([parameters], [
1914
1718
  {
1915
1719
  args: [
1916
- { in: "path", key: "sessionID" },
1917
1720
  { in: "query", key: "directory" },
1918
- { in: "query", key: "workspace" },
1919
- { in: "body", key: "title" },
1920
- { in: "body", key: "permission" },
1921
- { in: "body", key: "time" }
1721
+ { in: "query", key: "workspace" }
1922
1722
  ]
1923
1723
  }
1924
1724
  ]);
1925
- return (options?.client ?? this.client).patch({
1926
- url: "/session/{sessionID}",
1725
+ return (options?.client ?? this.client).get({
1726
+ url: "/file/status",
1927
1727
  ...options,
1928
- ...params,
1929
- headers: {
1930
- "Content-Type": "application/json",
1931
- ...options?.headers,
1932
- ...params.headers
1933
- }
1728
+ ...params
1934
1729
  });
1935
1730
  }
1731
+ };
1732
+ var Instance = class extends HeyApiClient {
1936
1733
  /**
1937
- * Get session children
1734
+ * Dispose instance
1938
1735
  *
1939
- * Retrieve all child sessions that were forked from the specified parent session.
1736
+ * Clean up and dispose the current OpenCode instance, releasing all resources.
1940
1737
  */
1941
- children(parameters, options) {
1738
+ dispose(parameters, options) {
1942
1739
  const params = buildClientParams([parameters], [
1943
1740
  {
1944
1741
  args: [
1945
- { in: "path", key: "sessionID" },
1946
1742
  { in: "query", key: "directory" },
1947
1743
  { in: "query", key: "workspace" }
1948
1744
  ]
1949
1745
  }
1950
1746
  ]);
1951
- return (options?.client ?? this.client).get({
1952
- url: "/session/{sessionID}/children",
1747
+ return (options?.client ?? this.client).post({
1748
+ url: "/instance/dispose",
1953
1749
  ...options,
1954
1750
  ...params
1955
1751
  });
1956
1752
  }
1753
+ };
1754
+ var Path = class extends HeyApiClient {
1957
1755
  /**
1958
- * Get session todos
1756
+ * Get paths
1959
1757
  *
1960
- * Retrieve the todo list associated with a specific session, showing tasks and action items.
1758
+ * Retrieve the current working directory and related path information for the OpenCode instance.
1961
1759
  */
1962
- todo(parameters, options) {
1760
+ get(parameters, options) {
1963
1761
  const params = buildClientParams([parameters], [
1964
1762
  {
1965
1763
  args: [
1966
- { in: "path", key: "sessionID" },
1967
1764
  { in: "query", key: "directory" },
1968
1765
  { in: "query", key: "workspace" }
1969
1766
  ]
1970
1767
  }
1971
1768
  ]);
1972
1769
  return (options?.client ?? this.client).get({
1973
- url: "/session/{sessionID}/todo",
1770
+ url: "/path",
1974
1771
  ...options,
1975
1772
  ...params
1976
1773
  });
1977
1774
  }
1775
+ };
1776
+ var Diff = class extends HeyApiClient {
1978
1777
  /**
1979
- * Initialize session
1778
+ * Get raw VCS diff
1980
1779
  *
1981
- * Analyze the current application and create an AGENTS.md file with project-specific agent configurations.
1780
+ * Retrieve a raw patch for current uncommitted changes.
1982
1781
  */
1983
- init(parameters, options) {
1782
+ raw(parameters, options) {
1984
1783
  const params = buildClientParams([parameters], [
1985
1784
  {
1986
1785
  args: [
1987
- { in: "path", key: "sessionID" },
1988
1786
  { in: "query", key: "directory" },
1989
- { in: "query", key: "workspace" },
1990
- { in: "body", key: "modelID" },
1991
- { in: "body", key: "providerID" },
1992
- { in: "body", key: "messageID" }
1787
+ { in: "query", key: "workspace" }
1993
1788
  ]
1994
1789
  }
1995
1790
  ]);
1996
- return (options?.client ?? this.client).post({
1997
- url: "/session/{sessionID}/init",
1791
+ return (options?.client ?? this.client).get({
1792
+ url: "/vcs/diff/raw",
1998
1793
  ...options,
1999
- ...params,
2000
- headers: {
2001
- "Content-Type": "application/json",
2002
- ...options?.headers,
2003
- ...params.headers
2004
- }
1794
+ ...params
2005
1795
  });
2006
1796
  }
1797
+ };
1798
+ var Vcs = class extends HeyApiClient {
2007
1799
  /**
2008
- * Fork session
1800
+ * Get VCS info
2009
1801
  *
2010
- * Create a new session by forking an existing session at a specific message point.
1802
+ * Retrieve version control system (VCS) information for the current project, such as git branch.
2011
1803
  */
2012
- fork(parameters, options) {
1804
+ get(parameters, options) {
2013
1805
  const params = buildClientParams([parameters], [
2014
1806
  {
2015
1807
  args: [
2016
- { in: "path", key: "sessionID" },
2017
1808
  { in: "query", key: "directory" },
2018
- { in: "query", key: "workspace" },
2019
- { in: "body", key: "messageID" }
1809
+ { in: "query", key: "workspace" }
2020
1810
  ]
2021
1811
  }
2022
1812
  ]);
2023
- return (options?.client ?? this.client).post({
2024
- url: "/session/{sessionID}/fork",
1813
+ return (options?.client ?? this.client).get({
1814
+ url: "/vcs",
2025
1815
  ...options,
2026
- ...params,
2027
- headers: {
2028
- "Content-Type": "application/json",
2029
- ...options?.headers,
2030
- ...params.headers
2031
- }
1816
+ ...params
2032
1817
  });
2033
1818
  }
2034
1819
  /**
2035
- * Abort session
1820
+ * Get VCS status
2036
1821
  *
2037
- * Abort an active session and stop any ongoing AI processing or command execution.
1822
+ * Retrieve changed files in the current working tree without patches.
2038
1823
  */
2039
- abort(parameters, options) {
1824
+ status(parameters, options) {
2040
1825
  const params = buildClientParams([parameters], [
2041
1826
  {
2042
1827
  args: [
2043
- { in: "path", key: "sessionID" },
2044
1828
  { in: "query", key: "directory" },
2045
1829
  { in: "query", key: "workspace" }
2046
1830
  ]
2047
1831
  }
2048
1832
  ]);
2049
- return (options?.client ?? this.client).post({
2050
- url: "/session/{sessionID}/abort",
1833
+ return (options?.client ?? this.client).get({
1834
+ url: "/vcs/status",
2051
1835
  ...options,
2052
1836
  ...params
2053
1837
  });
2054
1838
  }
2055
1839
  /**
2056
- * Unshare session
1840
+ * Get VCS diff
2057
1841
  *
2058
- * Remove the shareable link for a session, making it private again.
1842
+ * Retrieve the current git diff for the working tree or against the default branch.
2059
1843
  */
2060
- unshare(parameters, options) {
1844
+ diff(parameters, options) {
2061
1845
  const params = buildClientParams([parameters], [
2062
1846
  {
2063
1847
  args: [
2064
- { in: "path", key: "sessionID" },
2065
1848
  { in: "query", key: "directory" },
2066
- { in: "query", key: "workspace" }
1849
+ { in: "query", key: "workspace" },
1850
+ { in: "query", key: "mode" }
2067
1851
  ]
2068
1852
  }
2069
1853
  ]);
2070
- return (options?.client ?? this.client).delete({
2071
- url: "/session/{sessionID}/share",
1854
+ return (options?.client ?? this.client).get({
1855
+ url: "/vcs/diff",
2072
1856
  ...options,
2073
1857
  ...params
2074
1858
  });
2075
1859
  }
2076
1860
  /**
2077
- * Share session
1861
+ * Apply VCS patch
2078
1862
  *
2079
- * Create a shareable link for a session, allowing others to view the conversation.
1863
+ * Apply a raw patch to the current working tree.
2080
1864
  */
2081
- share(parameters, options) {
1865
+ apply(parameters, options) {
2082
1866
  const params = buildClientParams([parameters], [
2083
1867
  {
2084
1868
  args: [
2085
- { in: "path", key: "sessionID" },
2086
1869
  { in: "query", key: "directory" },
2087
- { in: "query", key: "workspace" }
1870
+ { in: "query", key: "workspace" },
1871
+ { in: "body", key: "patch" }
2088
1872
  ]
2089
1873
  }
2090
1874
  ]);
2091
1875
  return (options?.client ?? this.client).post({
2092
- url: "/session/{sessionID}/share",
1876
+ url: "/vcs/apply",
2093
1877
  ...options,
2094
- ...params
1878
+ ...params,
1879
+ headers: {
1880
+ "Content-Type": "application/json",
1881
+ ...options?.headers,
1882
+ ...params.headers
1883
+ }
2095
1884
  });
2096
1885
  }
1886
+ _diff;
1887
+ get diff2() {
1888
+ return this._diff ??= new Diff({ client: this.client });
1889
+ }
1890
+ };
1891
+ var Command = class extends HeyApiClient {
2097
1892
  /**
2098
- * Get message diff
1893
+ * List commands
2099
1894
  *
2100
- * Get the file changes (diff) that resulted from a specific user message in the session.
1895
+ * Get a list of all available commands in the OpenCode system.
2101
1896
  */
2102
- diff(parameters, options) {
1897
+ list(parameters, options) {
2103
1898
  const params = buildClientParams([parameters], [
2104
1899
  {
2105
1900
  args: [
2106
- { in: "path", key: "sessionID" },
2107
1901
  { in: "query", key: "directory" },
2108
- { in: "query", key: "workspace" },
2109
- { in: "query", key: "messageID" }
1902
+ { in: "query", key: "workspace" }
2110
1903
  ]
2111
1904
  }
2112
1905
  ]);
2113
1906
  return (options?.client ?? this.client).get({
2114
- url: "/session/{sessionID}/diff",
1907
+ url: "/command",
2115
1908
  ...options,
2116
1909
  ...params
2117
1910
  });
2118
1911
  }
1912
+ };
1913
+ var Lsp = class extends HeyApiClient {
2119
1914
  /**
2120
- * Summarize session
1915
+ * Get LSP status
2121
1916
  *
2122
- * Generate a concise summary of the session using AI compaction to preserve key information.
1917
+ * Get LSP server status
2123
1918
  */
2124
- summarize(parameters, options) {
1919
+ status(parameters, options) {
2125
1920
  const params = buildClientParams([parameters], [
2126
1921
  {
2127
1922
  args: [
2128
- { in: "path", key: "sessionID" },
2129
1923
  { in: "query", key: "directory" },
2130
- { in: "query", key: "workspace" },
2131
- { in: "body", key: "providerID" },
2132
- { in: "body", key: "modelID" },
2133
- { in: "body", key: "auto" }
1924
+ { in: "query", key: "workspace" }
2134
1925
  ]
2135
1926
  }
2136
1927
  ]);
2137
- return (options?.client ?? this.client).post({
2138
- url: "/session/{sessionID}/summarize",
1928
+ return (options?.client ?? this.client).get({
1929
+ url: "/lsp",
2139
1930
  ...options,
2140
- ...params,
2141
- headers: {
2142
- "Content-Type": "application/json",
2143
- ...options?.headers,
2144
- ...params.headers
2145
- }
1931
+ ...params
2146
1932
  });
2147
1933
  }
1934
+ };
1935
+ var Formatter = class extends HeyApiClient {
2148
1936
  /**
2149
- * Get session messages
1937
+ * Get formatter status
2150
1938
  *
2151
- * Retrieve all messages in a session, including user prompts and AI responses.
1939
+ * Get formatter status
2152
1940
  */
2153
- messages(parameters, options) {
1941
+ status(parameters, options) {
2154
1942
  const params = buildClientParams([parameters], [
2155
1943
  {
2156
1944
  args: [
2157
- { in: "path", key: "sessionID" },
2158
1945
  { in: "query", key: "directory" },
2159
- { in: "query", key: "workspace" },
2160
- { in: "query", key: "limit" },
2161
- { in: "query", key: "before" }
1946
+ { in: "query", key: "workspace" }
2162
1947
  ]
2163
1948
  }
2164
1949
  ]);
2165
1950
  return (options?.client ?? this.client).get({
2166
- url: "/session/{sessionID}/message",
1951
+ url: "/formatter",
2167
1952
  ...options,
2168
1953
  ...params
2169
1954
  });
2170
1955
  }
1956
+ };
1957
+ var Auth2 = class extends HeyApiClient {
2171
1958
  /**
2172
- * Send message
1959
+ * Remove MCP OAuth
2173
1960
  *
2174
- * Create and send a new message to a session, streaming the AI response.
1961
+ * Remove OAuth credentials for an MCP server.
2175
1962
  */
2176
- prompt(parameters, options) {
1963
+ remove(parameters, options) {
2177
1964
  const params = buildClientParams([parameters], [
2178
1965
  {
2179
1966
  args: [
2180
- { in: "path", key: "sessionID" },
1967
+ { in: "path", key: "name" },
2181
1968
  { in: "query", key: "directory" },
2182
- { in: "query", key: "workspace" },
2183
- { in: "body", key: "messageID" },
2184
- { in: "body", key: "model" },
2185
- { in: "body", key: "agent" },
2186
- { in: "body", key: "noReply" },
2187
- { in: "body", key: "tools" },
2188
- { in: "body", key: "format" },
2189
- { in: "body", key: "system" },
2190
- { in: "body", key: "variant" },
2191
- { in: "body", key: "parts" }
1969
+ { in: "query", key: "workspace" }
2192
1970
  ]
2193
1971
  }
2194
1972
  ]);
2195
- return (options?.client ?? this.client).post({
2196
- url: "/session/{sessionID}/message",
1973
+ return (options?.client ?? this.client).delete({
1974
+ url: "/mcp/{name}/auth",
2197
1975
  ...options,
2198
- ...params,
2199
- headers: {
2200
- "Content-Type": "application/json",
2201
- ...options?.headers,
2202
- ...params.headers
2203
- }
1976
+ ...params
2204
1977
  });
2205
1978
  }
2206
1979
  /**
2207
- * Delete message
1980
+ * Start MCP OAuth
2208
1981
  *
2209
- * 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.
1982
+ * Start OAuth authentication flow for a Model Context Protocol (MCP) server.
2210
1983
  */
2211
- deleteMessage(parameters, options) {
1984
+ start(parameters, options) {
2212
1985
  const params = buildClientParams([parameters], [
2213
1986
  {
2214
1987
  args: [
2215
- { in: "path", key: "sessionID" },
2216
- { in: "path", key: "messageID" },
1988
+ { in: "path", key: "name" },
2217
1989
  { in: "query", key: "directory" },
2218
1990
  { in: "query", key: "workspace" }
2219
1991
  ]
2220
1992
  }
2221
1993
  ]);
2222
- return (options?.client ?? this.client).delete({
2223
- url: "/session/{sessionID}/message/{messageID}",
1994
+ return (options?.client ?? this.client).post({
1995
+ url: "/mcp/{name}/auth",
2224
1996
  ...options,
2225
1997
  ...params
2226
1998
  });
2227
1999
  }
2228
2000
  /**
2229
- * Get message
2001
+ * Complete MCP OAuth
2230
2002
  *
2231
- * Retrieve a specific message from a session by its message ID.
2003
+ * Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code.
2232
2004
  */
2233
- message(parameters, options) {
2005
+ callback(parameters, options) {
2234
2006
  const params = buildClientParams([parameters], [
2235
2007
  {
2236
2008
  args: [
2237
- { in: "path", key: "sessionID" },
2238
- { in: "path", key: "messageID" },
2009
+ { in: "path", key: "name" },
2239
2010
  { in: "query", key: "directory" },
2240
- { in: "query", key: "workspace" }
2011
+ { in: "query", key: "workspace" },
2012
+ { in: "body", key: "code" }
2241
2013
  ]
2242
2014
  }
2243
2015
  ]);
2244
- return (options?.client ?? this.client).get({
2245
- url: "/session/{sessionID}/message/{messageID}",
2016
+ return (options?.client ?? this.client).post({
2017
+ url: "/mcp/{name}/auth/callback",
2246
2018
  ...options,
2247
- ...params
2019
+ ...params,
2020
+ headers: {
2021
+ "Content-Type": "application/json",
2022
+ ...options?.headers,
2023
+ ...params.headers
2024
+ }
2248
2025
  });
2249
2026
  }
2250
2027
  /**
2251
- * Send async message
2028
+ * Authenticate MCP OAuth
2252
2029
  *
2253
- * Create and send a new message to a session asynchronously, starting the session if needed and returning immediately.
2030
+ * Start OAuth flow and wait for callback (opens browser).
2254
2031
  */
2255
- promptAsync(parameters, options) {
2032
+ authenticate(parameters, options) {
2256
2033
  const params = buildClientParams([parameters], [
2257
2034
  {
2258
2035
  args: [
2259
- { in: "path", key: "sessionID" },
2036
+ { in: "path", key: "name" },
2260
2037
  { in: "query", key: "directory" },
2261
- { in: "query", key: "workspace" },
2262
- { in: "body", key: "messageID" },
2263
- { in: "body", key: "model" },
2264
- { in: "body", key: "agent" },
2265
- { in: "body", key: "noReply" },
2266
- { in: "body", key: "tools" },
2267
- { in: "body", key: "format" },
2268
- { in: "body", key: "system" },
2269
- { in: "body", key: "variant" },
2270
- { in: "body", key: "parts" }
2038
+ { in: "query", key: "workspace" }
2271
2039
  ]
2272
2040
  }
2273
2041
  ]);
2274
2042
  return (options?.client ?? this.client).post({
2275
- url: "/session/{sessionID}/prompt_async",
2043
+ url: "/mcp/{name}/auth/authenticate",
2276
2044
  ...options,
2277
- ...params,
2278
- headers: {
2279
- "Content-Type": "application/json",
2280
- ...options?.headers,
2281
- ...params.headers
2282
- }
2045
+ ...params
2283
2046
  });
2284
2047
  }
2048
+ };
2049
+ var Mcp = class extends HeyApiClient {
2285
2050
  /**
2286
- * Send command
2051
+ * Get MCP status
2287
2052
  *
2288
- * Send a new command to a session for execution by the AI assistant.
2053
+ * Get the status of all Model Context Protocol (MCP) servers.
2289
2054
  */
2290
- command(parameters, options) {
2055
+ status(parameters, options) {
2291
2056
  const params = buildClientParams([parameters], [
2292
2057
  {
2293
2058
  args: [
2294
- { in: "path", key: "sessionID" },
2295
2059
  { in: "query", key: "directory" },
2296
- { in: "query", key: "workspace" },
2297
- { in: "body", key: "messageID" },
2298
- { in: "body", key: "agent" },
2299
- { in: "body", key: "model" },
2300
- { in: "body", key: "arguments" },
2301
- { in: "body", key: "command" },
2302
- { in: "body", key: "variant" },
2303
- { in: "body", key: "parts" }
2060
+ { in: "query", key: "workspace" }
2304
2061
  ]
2305
2062
  }
2306
2063
  ]);
2307
- return (options?.client ?? this.client).post({
2308
- url: "/session/{sessionID}/command",
2064
+ return (options?.client ?? this.client).get({
2065
+ url: "/mcp",
2309
2066
  ...options,
2310
- ...params,
2311
- headers: {
2312
- "Content-Type": "application/json",
2313
- ...options?.headers,
2314
- ...params.headers
2315
- }
2067
+ ...params
2316
2068
  });
2317
2069
  }
2318
2070
  /**
2319
- * Run shell command
2071
+ * Add MCP server
2320
2072
  *
2321
- * Execute a shell command within the session context and return the AI's response.
2073
+ * Dynamically add a new Model Context Protocol (MCP) server to the system.
2322
2074
  */
2323
- shell(parameters, options) {
2075
+ add(parameters, options) {
2324
2076
  const params = buildClientParams([parameters], [
2325
2077
  {
2326
2078
  args: [
2327
- { in: "path", key: "sessionID" },
2328
2079
  { in: "query", key: "directory" },
2329
2080
  { in: "query", key: "workspace" },
2330
- { in: "body", key: "messageID" },
2331
- { in: "body", key: "agent" },
2332
- { in: "body", key: "model" },
2333
- { in: "body", key: "command" }
2081
+ { in: "body", key: "name" },
2082
+ { in: "body", key: "config" }
2334
2083
  ]
2335
2084
  }
2336
2085
  ]);
2337
2086
  return (options?.client ?? this.client).post({
2338
- url: "/session/{sessionID}/shell",
2087
+ url: "/mcp",
2339
2088
  ...options,
2340
2089
  ...params,
2341
2090
  headers: {
@@ -2346,155 +2095,129 @@ var Session2 = class extends HeyApiClient {
2346
2095
  });
2347
2096
  }
2348
2097
  /**
2349
- * Revert message
2350
- *
2351
- * Revert a specific message in a session, undoing its effects and restoring the previous state.
2098
+ * Connect an MCP server.
2352
2099
  */
2353
- revert(parameters, options) {
2100
+ connect(parameters, options) {
2354
2101
  const params = buildClientParams([parameters], [
2355
2102
  {
2356
2103
  args: [
2357
- { in: "path", key: "sessionID" },
2104
+ { in: "path", key: "name" },
2358
2105
  { in: "query", key: "directory" },
2359
- { in: "query", key: "workspace" },
2360
- { in: "body", key: "messageID" },
2361
- { in: "body", key: "partID" }
2106
+ { in: "query", key: "workspace" }
2362
2107
  ]
2363
2108
  }
2364
2109
  ]);
2365
2110
  return (options?.client ?? this.client).post({
2366
- url: "/session/{sessionID}/revert",
2111
+ url: "/mcp/{name}/connect",
2367
2112
  ...options,
2368
- ...params,
2369
- headers: {
2370
- "Content-Type": "application/json",
2371
- ...options?.headers,
2372
- ...params.headers
2373
- }
2113
+ ...params
2374
2114
  });
2375
2115
  }
2376
2116
  /**
2377
- * Restore reverted messages
2378
- *
2379
- * Restore all previously reverted messages in a session.
2117
+ * Disconnect an MCP server.
2380
2118
  */
2381
- unrevert(parameters, options) {
2119
+ disconnect(parameters, options) {
2382
2120
  const params = buildClientParams([parameters], [
2383
2121
  {
2384
2122
  args: [
2385
- { in: "path", key: "sessionID" },
2123
+ { in: "path", key: "name" },
2386
2124
  { in: "query", key: "directory" },
2387
2125
  { in: "query", key: "workspace" }
2388
2126
  ]
2389
2127
  }
2390
2128
  ]);
2391
2129
  return (options?.client ?? this.client).post({
2392
- url: "/session/{sessionID}/unrevert",
2130
+ url: "/mcp/{name}/disconnect",
2393
2131
  ...options,
2394
2132
  ...params
2395
2133
  });
2396
2134
  }
2135
+ _auth;
2136
+ get auth() {
2137
+ return this._auth ??= new Auth2({ client: this.client });
2138
+ }
2397
2139
  };
2398
- var Part = class extends HeyApiClient {
2140
+ var Project = class extends HeyApiClient {
2399
2141
  /**
2400
- * Delete a part from a message
2142
+ * List all projects
2143
+ *
2144
+ * Get a list of projects that have been opened with OpenCode.
2401
2145
  */
2402
- delete(parameters, options) {
2146
+ list(parameters, options) {
2403
2147
  const params = buildClientParams([parameters], [
2404
2148
  {
2405
2149
  args: [
2406
- { in: "path", key: "sessionID" },
2407
- { in: "path", key: "messageID" },
2408
- { in: "path", key: "partID" },
2409
2150
  { in: "query", key: "directory" },
2410
2151
  { in: "query", key: "workspace" }
2411
2152
  ]
2412
2153
  }
2413
2154
  ]);
2414
- return (options?.client ?? this.client).delete({
2415
- url: "/session/{sessionID}/message/{messageID}/part/{partID}",
2155
+ return (options?.client ?? this.client).get({
2156
+ url: "/project",
2416
2157
  ...options,
2417
2158
  ...params
2418
2159
  });
2419
2160
  }
2420
2161
  /**
2421
- * Update a part in a message
2162
+ * Get current project
2163
+ *
2164
+ * Retrieve the currently active project that OpenCode is working with.
2422
2165
  */
2423
- update(parameters, options) {
2166
+ current(parameters, options) {
2424
2167
  const params = buildClientParams([parameters], [
2425
2168
  {
2426
2169
  args: [
2427
- { in: "path", key: "sessionID" },
2428
- { in: "path", key: "messageID" },
2429
- { in: "path", key: "partID" },
2430
2170
  { in: "query", key: "directory" },
2431
- { in: "query", key: "workspace" },
2432
- { key: "part", map: "body" }
2171
+ { in: "query", key: "workspace" }
2433
2172
  ]
2434
2173
  }
2435
2174
  ]);
2436
- return (options?.client ?? this.client).patch({
2437
- url: "/session/{sessionID}/message/{messageID}/part/{partID}",
2175
+ return (options?.client ?? this.client).get({
2176
+ url: "/project/current",
2438
2177
  ...options,
2439
- ...params,
2440
- headers: {
2441
- "Content-Type": "application/json",
2442
- ...options?.headers,
2443
- ...params.headers
2444
- }
2178
+ ...params
2445
2179
  });
2446
2180
  }
2447
- };
2448
- var Permission = class extends HeyApiClient {
2449
2181
  /**
2450
- * Respond to permission
2451
- *
2452
- * Approve or deny a permission request from the AI assistant.
2182
+ * Initialize git repository
2453
2183
  *
2454
- * @deprecated
2184
+ * Create a git repository for the current project and return the refreshed project info.
2455
2185
  */
2456
- respond(parameters, options) {
2186
+ initGit(parameters, options) {
2457
2187
  const params = buildClientParams([parameters], [
2458
2188
  {
2459
2189
  args: [
2460
- { in: "path", key: "sessionID" },
2461
- { in: "path", key: "permissionID" },
2462
2190
  { in: "query", key: "directory" },
2463
- { in: "query", key: "workspace" },
2464
- { in: "body", key: "response" }
2191
+ { in: "query", key: "workspace" }
2465
2192
  ]
2466
2193
  }
2467
2194
  ]);
2468
2195
  return (options?.client ?? this.client).post({
2469
- url: "/session/{sessionID}/permissions/{permissionID}",
2196
+ url: "/project/git/init",
2470
2197
  ...options,
2471
- ...params,
2472
- headers: {
2473
- "Content-Type": "application/json",
2474
- ...options?.headers,
2475
- ...params.headers
2476
- }
2198
+ ...params
2477
2199
  });
2478
2200
  }
2479
2201
  /**
2480
- * Respond to permission request
2202
+ * Update project
2481
2203
  *
2482
- * Approve or deny a permission request from the AI assistant.
2204
+ * Update project properties such as name, icon, and commands.
2483
2205
  */
2484
- reply(parameters, options) {
2206
+ update(parameters, options) {
2485
2207
  const params = buildClientParams([parameters], [
2486
2208
  {
2487
2209
  args: [
2488
- { in: "path", key: "requestID" },
2210
+ { in: "path", key: "projectID" },
2489
2211
  { in: "query", key: "directory" },
2490
2212
  { in: "query", key: "workspace" },
2491
- { in: "body", key: "reply" },
2492
- { in: "body", key: "message" }
2213
+ { in: "body", key: "name" },
2214
+ { in: "body", key: "icon" },
2215
+ { in: "body", key: "commands" }
2493
2216
  ]
2494
2217
  }
2495
2218
  ]);
2496
- return (options?.client ?? this.client).post({
2497
- url: "/permission/{requestID}/reply",
2219
+ return (options?.client ?? this.client).patch({
2220
+ url: "/project/{projectID}",
2498
2221
  ...options,
2499
2222
  ...params,
2500
2223
  headers: {
@@ -2504,12 +2227,14 @@ var Permission = class extends HeyApiClient {
2504
2227
  }
2505
2228
  });
2506
2229
  }
2230
+ };
2231
+ var Pty = class extends HeyApiClient {
2507
2232
  /**
2508
- * List pending permissions
2233
+ * List available shells
2509
2234
  *
2510
- * Get all pending permission requests across all sessions.
2235
+ * Get a list of available shells on the system.
2511
2236
  */
2512
- list(parameters, options) {
2237
+ shells(parameters, options) {
2513
2238
  const params = buildClientParams([parameters], [
2514
2239
  {
2515
2240
  args: [
@@ -2519,17 +2244,15 @@ var Permission = class extends HeyApiClient {
2519
2244
  }
2520
2245
  ]);
2521
2246
  return (options?.client ?? this.client).get({
2522
- url: "/permission",
2247
+ url: "/pty/shells",
2523
2248
  ...options,
2524
2249
  ...params
2525
2250
  });
2526
2251
  }
2527
- };
2528
- var Question = class extends HeyApiClient {
2529
2252
  /**
2530
- * List pending questions
2253
+ * List PTY sessions
2531
2254
  *
2532
- * Get all pending question requests across all sessions.
2255
+ * Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode.
2533
2256
  */
2534
2257
  list(parameters, options) {
2535
2258
  const params = buildClientParams([parameters], [
@@ -2541,29 +2264,32 @@ var Question = class extends HeyApiClient {
2541
2264
  }
2542
2265
  ]);
2543
2266
  return (options?.client ?? this.client).get({
2544
- url: "/question",
2267
+ url: "/pty",
2545
2268
  ...options,
2546
2269
  ...params
2547
2270
  });
2548
2271
  }
2549
2272
  /**
2550
- * Reply to question request
2273
+ * Create PTY session
2551
2274
  *
2552
- * Provide answers to a question request from the AI assistant.
2275
+ * Create a new pseudo-terminal (PTY) session for running shell commands and processes.
2553
2276
  */
2554
- reply(parameters, options) {
2277
+ create(parameters, options) {
2555
2278
  const params = buildClientParams([parameters], [
2556
2279
  {
2557
2280
  args: [
2558
- { in: "path", key: "requestID" },
2559
2281
  { in: "query", key: "directory" },
2560
2282
  { in: "query", key: "workspace" },
2561
- { in: "body", key: "answers" }
2283
+ { in: "body", key: "command" },
2284
+ { in: "body", key: "args" },
2285
+ { in: "body", key: "cwd" },
2286
+ { in: "body", key: "title" },
2287
+ { in: "body", key: "env" }
2562
2288
  ]
2563
2289
  }
2564
2290
  ]);
2565
2291
  return (options?.client ?? this.client).post({
2566
- url: "/question/{requestID}/reply",
2292
+ url: "/pty",
2567
2293
  ...options,
2568
2294
  ...params,
2569
2295
  headers: {
@@ -2574,75 +2300,66 @@ var Question = class extends HeyApiClient {
2574
2300
  });
2575
2301
  }
2576
2302
  /**
2577
- * Reject question request
2303
+ * Remove PTY session
2578
2304
  *
2579
- * Reject a question request from the AI assistant.
2305
+ * Remove and terminate a specific pseudo-terminal (PTY) session.
2580
2306
  */
2581
- reject(parameters, options) {
2307
+ remove(parameters, options) {
2582
2308
  const params = buildClientParams([parameters], [
2583
2309
  {
2584
2310
  args: [
2585
- { in: "path", key: "requestID" },
2311
+ { in: "path", key: "ptyID" },
2586
2312
  { in: "query", key: "directory" },
2587
2313
  { in: "query", key: "workspace" }
2588
2314
  ]
2589
2315
  }
2590
2316
  ]);
2591
- return (options?.client ?? this.client).post({
2592
- url: "/question/{requestID}/reject",
2317
+ return (options?.client ?? this.client).delete({
2318
+ url: "/pty/{ptyID}",
2593
2319
  ...options,
2594
2320
  ...params
2595
2321
  });
2596
2322
  }
2597
- };
2598
- var Oauth = class extends HeyApiClient {
2599
2323
  /**
2600
- * OAuth authorize
2324
+ * Get PTY session
2601
2325
  *
2602
- * Initiate OAuth authorization for a specific AI provider to get an authorization URL.
2326
+ * Retrieve detailed information about a specific pseudo-terminal (PTY) session.
2603
2327
  */
2604
- authorize(parameters, options) {
2328
+ get(parameters, options) {
2605
2329
  const params = buildClientParams([parameters], [
2606
2330
  {
2607
2331
  args: [
2608
- { in: "path", key: "providerID" },
2332
+ { in: "path", key: "ptyID" },
2609
2333
  { in: "query", key: "directory" },
2610
- { in: "query", key: "workspace" },
2611
- { in: "body", key: "method" },
2612
- { in: "body", key: "inputs" }
2334
+ { in: "query", key: "workspace" }
2613
2335
  ]
2614
2336
  }
2615
2337
  ]);
2616
- return (options?.client ?? this.client).post({
2617
- url: "/provider/{providerID}/oauth/authorize",
2338
+ return (options?.client ?? this.client).get({
2339
+ url: "/pty/{ptyID}",
2618
2340
  ...options,
2619
- ...params,
2620
- headers: {
2621
- "Content-Type": "application/json",
2622
- ...options?.headers,
2623
- ...params.headers
2624
- }
2341
+ ...params
2625
2342
  });
2626
2343
  }
2627
2344
  /**
2628
- * OAuth callback
2345
+ * Update PTY session
2629
2346
  *
2630
- * Handle the OAuth callback from a provider after user authorization.
2347
+ * Update properties of an existing pseudo-terminal (PTY) session.
2631
2348
  */
2632
- callback(parameters, options) {
2349
+ update(parameters, options) {
2633
2350
  const params = buildClientParams([parameters], [
2634
2351
  {
2635
2352
  args: [
2636
- { in: "path", key: "providerID" },
2353
+ { in: "path", key: "ptyID" },
2637
2354
  { in: "query", key: "directory" },
2638
2355
  { in: "query", key: "workspace" },
2639
- { in: "body", key: "method" },
2640
- { in: "body", key: "code" }
2356
+ { in: "body", key: "title" },
2357
+ { in: "body", key: "size" }
2641
2358
  ]
2642
2359
  }
2643
2360
  ]);
2644
- return (options?.client ?? this.client).post({
2645
- url: "/provider/{providerID}/oauth/callback",
2361
+ return (options?.client ?? this.client).put({
2362
+ url: "/pty/{ptyID}",
2646
2363
  ...options,
2647
2364
  ...params,
2648
2365
  headers: {
@@ -2652,71 +2369,88 @@ var Oauth = class extends HeyApiClient {
2652
2369
  }
2653
2370
  });
2654
2371
  }
2655
- };
2656
- var Provider = class extends HeyApiClient {
2657
2372
  /**
2658
- * List providers
2373
+ * Create PTY WebSocket token
2659
2374
  *
2660
- * Get a list of all available AI providers, including both available and connected ones.
2375
+ * Create a short-lived ticket for opening a PTY WebSocket connection.
2661
2376
  */
2662
- list(parameters, options) {
2377
+ connectToken(parameters, options) {
2663
2378
  const params = buildClientParams([parameters], [
2664
2379
  {
2665
2380
  args: [
2381
+ { in: "path", key: "ptyID" },
2666
2382
  { in: "query", key: "directory" },
2667
2383
  { in: "query", key: "workspace" }
2668
2384
  ]
2669
2385
  }
2670
2386
  ]);
2671
- return (options?.client ?? this.client).get({
2672
- url: "/provider",
2387
+ return (options?.client ?? this.client).post({
2388
+ url: "/pty/{ptyID}/connect-token",
2673
2389
  ...options,
2674
2390
  ...params
2675
2391
  });
2676
2392
  }
2677
2393
  /**
2678
- * Get provider auth methods
2394
+ * Connect to PTY session
2679
2395
  *
2680
- * Retrieve available authentication methods for all AI providers.
2396
+ * Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.
2681
2397
  */
2682
- auth(parameters, options) {
2398
+ connect(parameters, options) {
2683
2399
  const params = buildClientParams([parameters], [
2684
2400
  {
2685
2401
  args: [
2402
+ { in: "path", key: "ptyID" },
2686
2403
  { in: "query", key: "directory" },
2687
2404
  { in: "query", key: "workspace" }
2688
2405
  ]
2689
2406
  }
2690
2407
  ]);
2691
2408
  return (options?.client ?? this.client).get({
2692
- url: "/provider/auth",
2409
+ url: "/pty/{ptyID}/connect",
2693
2410
  ...options,
2694
2411
  ...params
2695
2412
  });
2696
2413
  }
2697
- _oauth;
2698
- get oauth() {
2699
- return this._oauth ??= new Oauth({ client: this.client });
2700
- }
2701
2414
  };
2702
- var History = class extends HeyApiClient {
2415
+ var Question = class extends HeyApiClient {
2703
2416
  /**
2704
- * List sync events
2417
+ * List pending questions
2705
2418
  *
2706
- * 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.
2419
+ * Get all pending question requests across all sessions.
2707
2420
  */
2708
2421
  list(parameters, options) {
2709
2422
  const params = buildClientParams([parameters], [
2710
2423
  {
2711
2424
  args: [
2425
+ { in: "query", key: "directory" },
2426
+ { in: "query", key: "workspace" }
2427
+ ]
2428
+ }
2429
+ ]);
2430
+ return (options?.client ?? this.client).get({
2431
+ url: "/question",
2432
+ ...options,
2433
+ ...params
2434
+ });
2435
+ }
2436
+ /**
2437
+ * Reply to question request
2438
+ *
2439
+ * Provide answers to a question request from the AI assistant.
2440
+ */
2441
+ reply(parameters, options) {
2442
+ const params = buildClientParams([parameters], [
2443
+ {
2444
+ args: [
2445
+ { in: "path", key: "requestID" },
2712
2446
  { in: "query", key: "directory" },
2713
2447
  { in: "query", key: "workspace" },
2714
- { key: "body", map: "body" }
2448
+ { in: "body", key: "answers" }
2715
2449
  ]
2716
2450
  }
2717
2451
  ]);
2718
2452
  return (options?.client ?? this.client).post({
2719
- url: "/sync/history",
2453
+ url: "/question/{requestID}/reply",
2720
2454
  ...options,
2721
2455
  ...params,
2722
2456
  headers: {
@@ -2726,54 +2460,68 @@ var History = class extends HeyApiClient {
2726
2460
  }
2727
2461
  });
2728
2462
  }
2729
- };
2730
- var Sync = class extends HeyApiClient {
2731
2463
  /**
2732
- * Start workspace sync
2464
+ * Reject question request
2733
2465
  *
2734
- * Start sync loops for workspaces in the current project that have active sessions.
2466
+ * Reject a question request from the AI assistant.
2735
2467
  */
2736
- start(parameters, options) {
2468
+ reject(parameters, options) {
2737
2469
  const params = buildClientParams([parameters], [
2738
2470
  {
2739
2471
  args: [
2472
+ { in: "path", key: "requestID" },
2740
2473
  { in: "query", key: "directory" },
2741
2474
  { in: "query", key: "workspace" }
2742
2475
  ]
2743
2476
  }
2744
2477
  ]);
2745
2478
  return (options?.client ?? this.client).post({
2746
- url: "/sync/start",
2479
+ url: "/question/{requestID}/reject",
2747
2480
  ...options,
2748
2481
  ...params
2749
2482
  });
2750
2483
  }
2484
+ };
2485
+ var Permission = class extends HeyApiClient {
2751
2486
  /**
2752
- * Replay sync events
2487
+ * List pending permissions
2753
2488
  *
2754
- * Validate and replay a complete sync event history.
2489
+ * Get all pending permission requests across all sessions.
2755
2490
  */
2756
- replay(parameters, options) {
2491
+ list(parameters, options) {
2757
2492
  const params = buildClientParams([parameters], [
2758
2493
  {
2759
2494
  args: [
2760
- {
2761
- in: "query",
2762
- key: "query_directory",
2763
- map: "directory"
2764
- },
2495
+ { in: "query", key: "directory" },
2496
+ { in: "query", key: "workspace" }
2497
+ ]
2498
+ }
2499
+ ]);
2500
+ return (options?.client ?? this.client).get({
2501
+ url: "/permission",
2502
+ ...options,
2503
+ ...params
2504
+ });
2505
+ }
2506
+ /**
2507
+ * Respond to permission request
2508
+ *
2509
+ * Approve or deny a permission request from the AI assistant.
2510
+ */
2511
+ reply(parameters, options) {
2512
+ const params = buildClientParams([parameters], [
2513
+ {
2514
+ args: [
2515
+ { in: "path", key: "requestID" },
2516
+ { in: "query", key: "directory" },
2765
2517
  { in: "query", key: "workspace" },
2766
- {
2767
- in: "body",
2768
- key: "body_directory",
2769
- map: "directory"
2770
- },
2771
- { in: "body", key: "events" }
2518
+ { in: "body", key: "reply" },
2519
+ { in: "body", key: "message" }
2772
2520
  ]
2773
2521
  }
2774
2522
  ]);
2775
2523
  return (options?.client ?? this.client).post({
2776
- url: "/sync/replay",
2524
+ url: "/permission/{requestID}/reply",
2777
2525
  ...options,
2778
2526
  ...params,
2779
2527
  headers: {
@@ -2783,126 +2531,203 @@ var Sync = class extends HeyApiClient {
2783
2531
  }
2784
2532
  });
2785
2533
  }
2786
- _history;
2787
- get history() {
2788
- return this._history ??= new History({ client: this.client });
2789
- }
2790
- };
2791
- var Find = class extends HeyApiClient {
2792
2534
  /**
2793
- * Find text
2535
+ * Respond to permission
2794
2536
  *
2795
- * Search for text patterns across files in the project using ripgrep.
2537
+ * Approve or deny a permission request from the AI assistant.
2538
+ *
2539
+ * @deprecated
2796
2540
  */
2797
- text(parameters, options) {
2541
+ respond(parameters, options) {
2798
2542
  const params = buildClientParams([parameters], [
2799
2543
  {
2800
2544
  args: [
2545
+ { in: "path", key: "sessionID" },
2546
+ { in: "path", key: "permissionID" },
2801
2547
  { in: "query", key: "directory" },
2802
2548
  { in: "query", key: "workspace" },
2803
- { in: "query", key: "pattern" }
2549
+ { in: "body", key: "response" }
2804
2550
  ]
2805
2551
  }
2806
2552
  ]);
2807
- return (options?.client ?? this.client).get({
2808
- url: "/find",
2553
+ return (options?.client ?? this.client).post({
2554
+ url: "/session/{sessionID}/permissions/{permissionID}",
2809
2555
  ...options,
2810
- ...params
2556
+ ...params,
2557
+ headers: {
2558
+ "Content-Type": "application/json",
2559
+ ...options?.headers,
2560
+ ...params.headers
2561
+ }
2811
2562
  });
2812
2563
  }
2564
+ };
2565
+ var Oauth = class extends HeyApiClient {
2813
2566
  /**
2814
- * Find files
2567
+ * Start OAuth authorization
2815
2568
  *
2816
- * Search for files or directories by name or pattern in the project directory.
2569
+ * Start the OAuth authorization flow for a provider.
2817
2570
  */
2818
- files(parameters, options) {
2571
+ authorize(parameters, options) {
2819
2572
  const params = buildClientParams([parameters], [
2820
2573
  {
2821
2574
  args: [
2575
+ { in: "path", key: "providerID" },
2822
2576
  { in: "query", key: "directory" },
2823
2577
  { in: "query", key: "workspace" },
2824
- { in: "query", key: "query" },
2825
- { in: "query", key: "dirs" },
2826
- { in: "query", key: "type" },
2827
- { in: "query", key: "limit" }
2578
+ { in: "body", key: "method" },
2579
+ { in: "body", key: "inputs" }
2828
2580
  ]
2829
2581
  }
2830
2582
  ]);
2831
- return (options?.client ?? this.client).get({
2832
- url: "/find/file",
2583
+ return (options?.client ?? this.client).post({
2584
+ url: "/provider/{providerID}/oauth/authorize",
2833
2585
  ...options,
2834
- ...params
2586
+ ...params,
2587
+ headers: {
2588
+ "Content-Type": "application/json",
2589
+ ...options?.headers,
2590
+ ...params.headers
2591
+ }
2835
2592
  });
2836
2593
  }
2837
2594
  /**
2838
- * Find symbols
2595
+ * Handle OAuth callback
2839
2596
  *
2840
- * Search for workspace symbols like functions, classes, and variables using LSP.
2597
+ * Handle the OAuth callback from a provider after user authorization.
2841
2598
  */
2842
- symbols(parameters, options) {
2599
+ callback(parameters, options) {
2843
2600
  const params = buildClientParams([parameters], [
2844
2601
  {
2845
2602
  args: [
2603
+ { in: "path", key: "providerID" },
2846
2604
  { in: "query", key: "directory" },
2847
2605
  { in: "query", key: "workspace" },
2848
- { in: "query", key: "query" }
2606
+ { in: "body", key: "method" },
2607
+ { in: "body", key: "code" }
2849
2608
  ]
2850
2609
  }
2851
2610
  ]);
2852
- return (options?.client ?? this.client).get({
2853
- url: "/find/symbol",
2611
+ return (options?.client ?? this.client).post({
2612
+ url: "/provider/{providerID}/oauth/callback",
2854
2613
  ...options,
2855
- ...params
2614
+ ...params,
2615
+ headers: {
2616
+ "Content-Type": "application/json",
2617
+ ...options?.headers,
2618
+ ...params.headers
2619
+ }
2856
2620
  });
2857
2621
  }
2858
2622
  };
2859
- var File = class extends HeyApiClient {
2623
+ var Provider = class extends HeyApiClient {
2860
2624
  /**
2861
- * List files
2625
+ * List providers
2862
2626
  *
2863
- * List files and directories in a specified path.
2627
+ * Get a list of all available AI providers, including both available and connected ones.
2864
2628
  */
2865
2629
  list(parameters, options) {
2866
2630
  const params = buildClientParams([parameters], [
2867
2631
  {
2868
2632
  args: [
2869
2633
  { in: "query", key: "directory" },
2870
- { in: "query", key: "workspace" },
2871
- { in: "query", key: "path" }
2634
+ { in: "query", key: "workspace" }
2872
2635
  ]
2873
2636
  }
2874
2637
  ]);
2875
2638
  return (options?.client ?? this.client).get({
2876
- url: "/file",
2639
+ url: "/provider",
2877
2640
  ...options,
2878
2641
  ...params
2879
2642
  });
2880
2643
  }
2881
2644
  /**
2882
- * Read file
2645
+ * Get provider auth methods
2883
2646
  *
2884
- * Read the content of a specified file.
2647
+ * Retrieve available authentication methods for all AI providers.
2885
2648
  */
2886
- read(parameters, options) {
2649
+ auth(parameters, options) {
2650
+ const params = buildClientParams([parameters], [
2651
+ {
2652
+ args: [
2653
+ { in: "query", key: "directory" },
2654
+ { in: "query", key: "workspace" }
2655
+ ]
2656
+ }
2657
+ ]);
2658
+ return (options?.client ?? this.client).get({
2659
+ url: "/provider/auth",
2660
+ ...options,
2661
+ ...params
2662
+ });
2663
+ }
2664
+ _oauth;
2665
+ get oauth() {
2666
+ return this._oauth ??= new Oauth({ client: this.client });
2667
+ }
2668
+ };
2669
+ var Session2 = class extends HeyApiClient {
2670
+ /**
2671
+ * List sessions
2672
+ *
2673
+ * Get a list of all OpenCode sessions, sorted by most recently updated.
2674
+ */
2675
+ list(parameters, options) {
2887
2676
  const params = buildClientParams([parameters], [
2888
2677
  {
2889
2678
  args: [
2890
2679
  { in: "query", key: "directory" },
2891
2680
  { in: "query", key: "workspace" },
2892
- { in: "query", key: "path" }
2681
+ { in: "query", key: "scope" },
2682
+ { in: "query", key: "path" },
2683
+ { in: "query", key: "roots" },
2684
+ { in: "query", key: "start" },
2685
+ { in: "query", key: "search" },
2686
+ { in: "query", key: "limit" }
2893
2687
  ]
2894
2688
  }
2895
2689
  ]);
2896
2690
  return (options?.client ?? this.client).get({
2897
- url: "/file/content",
2691
+ url: "/session",
2898
2692
  ...options,
2899
2693
  ...params
2900
2694
  });
2901
2695
  }
2902
2696
  /**
2903
- * Get file status
2697
+ * Create session
2904
2698
  *
2905
- * Get the git status of all files in the project.
2699
+ * Create a new OpenCode session for interacting with AI assistants and managing conversations.
2700
+ */
2701
+ create(parameters, options) {
2702
+ const params = buildClientParams([parameters], [
2703
+ {
2704
+ args: [
2705
+ { in: "query", key: "directory" },
2706
+ { in: "query", key: "workspace" },
2707
+ { in: "body", key: "parentID" },
2708
+ { in: "body", key: "title" },
2709
+ { in: "body", key: "agent" },
2710
+ { in: "body", key: "model" },
2711
+ { in: "body", key: "permission" },
2712
+ { in: "body", key: "workspaceID" }
2713
+ ]
2714
+ }
2715
+ ]);
2716
+ return (options?.client ?? this.client).post({
2717
+ url: "/session",
2718
+ ...options,
2719
+ ...params,
2720
+ headers: {
2721
+ "Content-Type": "application/json",
2722
+ ...options?.headers,
2723
+ ...params.headers
2724
+ }
2725
+ });
2726
+ }
2727
+ /**
2728
+ * Get session status
2729
+ *
2730
+ * Retrieve the current status of all sessions, including active, idle, and completed states.
2906
2731
  */
2907
2732
  status(parameters, options) {
2908
2733
  const params = buildClientParams([parameters], [
@@ -2914,95 +2739,195 @@ var File = class extends HeyApiClient {
2914
2739
  }
2915
2740
  ]);
2916
2741
  return (options?.client ?? this.client).get({
2917
- url: "/file/status",
2742
+ url: "/session/status",
2918
2743
  ...options,
2919
2744
  ...params
2920
2745
  });
2921
2746
  }
2922
- };
2923
- var Event = class extends HeyApiClient {
2924
2747
  /**
2925
- * Subscribe to events
2748
+ * Delete session
2926
2749
  *
2927
- * Get events
2750
+ * Delete a session and permanently remove all associated data, including messages and history.
2928
2751
  */
2929
- subscribe(parameters, options) {
2752
+ delete(parameters, options) {
2930
2753
  const params = buildClientParams([parameters], [
2931
2754
  {
2932
2755
  args: [
2756
+ { in: "path", key: "sessionID" },
2933
2757
  { in: "query", key: "directory" },
2934
2758
  { in: "query", key: "workspace" }
2935
2759
  ]
2936
2760
  }
2937
2761
  ]);
2938
- return (options?.client ?? this.client).sse.get({
2939
- url: "/event",
2762
+ return (options?.client ?? this.client).delete({
2763
+ url: "/session/{sessionID}",
2940
2764
  ...options,
2941
2765
  ...params
2942
2766
  });
2943
2767
  }
2944
- };
2945
- var Auth2 = class extends HeyApiClient {
2946
2768
  /**
2947
- * Remove MCP OAuth
2769
+ * Get session
2948
2770
  *
2949
- * Remove OAuth credentials for an MCP server
2771
+ * Retrieve detailed information about a specific OpenCode session.
2950
2772
  */
2951
- remove(parameters, options) {
2773
+ get(parameters, options) {
2952
2774
  const params = buildClientParams([parameters], [
2953
2775
  {
2954
2776
  args: [
2955
- { in: "path", key: "name" },
2777
+ { in: "path", key: "sessionID" },
2956
2778
  { in: "query", key: "directory" },
2957
2779
  { in: "query", key: "workspace" }
2958
2780
  ]
2959
2781
  }
2960
2782
  ]);
2961
- return (options?.client ?? this.client).delete({
2962
- url: "/mcp/{name}/auth",
2783
+ return (options?.client ?? this.client).get({
2784
+ url: "/session/{sessionID}",
2963
2785
  ...options,
2964
2786
  ...params
2965
2787
  });
2966
2788
  }
2967
2789
  /**
2968
- * Start MCP OAuth
2790
+ * Update session
2969
2791
  *
2970
- * Start OAuth authentication flow for a Model Context Protocol (MCP) server.
2792
+ * Update properties of an existing session, such as title or other metadata.
2971
2793
  */
2972
- start(parameters, options) {
2794
+ update(parameters, options) {
2973
2795
  const params = buildClientParams([parameters], [
2974
2796
  {
2975
2797
  args: [
2976
- { in: "path", key: "name" },
2798
+ { in: "path", key: "sessionID" },
2799
+ { in: "query", key: "directory" },
2800
+ { in: "query", key: "workspace" },
2801
+ { in: "body", key: "title" },
2802
+ { in: "body", key: "permission" },
2803
+ { in: "body", key: "time" }
2804
+ ]
2805
+ }
2806
+ ]);
2807
+ return (options?.client ?? this.client).patch({
2808
+ url: "/session/{sessionID}",
2809
+ ...options,
2810
+ ...params,
2811
+ headers: {
2812
+ "Content-Type": "application/json",
2813
+ ...options?.headers,
2814
+ ...params.headers
2815
+ }
2816
+ });
2817
+ }
2818
+ /**
2819
+ * Get session children
2820
+ *
2821
+ * Retrieve all child sessions that were forked from the specified parent session.
2822
+ */
2823
+ children(parameters, options) {
2824
+ const params = buildClientParams([parameters], [
2825
+ {
2826
+ args: [
2827
+ { in: "path", key: "sessionID" },
2977
2828
  { in: "query", key: "directory" },
2978
2829
  { in: "query", key: "workspace" }
2979
2830
  ]
2980
2831
  }
2981
2832
  ]);
2982
- return (options?.client ?? this.client).post({
2983
- url: "/mcp/{name}/auth",
2833
+ return (options?.client ?? this.client).get({
2834
+ url: "/session/{sessionID}/children",
2984
2835
  ...options,
2985
2836
  ...params
2986
2837
  });
2987
2838
  }
2988
2839
  /**
2989
- * Complete MCP OAuth
2840
+ * Get session todos
2990
2841
  *
2991
- * Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code.
2842
+ * Retrieve the todo list associated with a specific session, showing tasks and action items.
2992
2843
  */
2993
- callback(parameters, options) {
2844
+ todo(parameters, options) {
2994
2845
  const params = buildClientParams([parameters], [
2995
2846
  {
2996
2847
  args: [
2997
- { in: "path", key: "name" },
2848
+ { in: "path", key: "sessionID" },
2849
+ { in: "query", key: "directory" },
2850
+ { in: "query", key: "workspace" }
2851
+ ]
2852
+ }
2853
+ ]);
2854
+ return (options?.client ?? this.client).get({
2855
+ url: "/session/{sessionID}/todo",
2856
+ ...options,
2857
+ ...params
2858
+ });
2859
+ }
2860
+ /**
2861
+ * Get message diff
2862
+ *
2863
+ * Get the file changes (diff) that resulted from a specific user message in the session.
2864
+ */
2865
+ diff(parameters, options) {
2866
+ const params = buildClientParams([parameters], [
2867
+ {
2868
+ args: [
2869
+ { in: "path", key: "sessionID" },
2998
2870
  { in: "query", key: "directory" },
2999
2871
  { in: "query", key: "workspace" },
3000
- { in: "body", key: "code" }
2872
+ { in: "query", key: "messageID" }
2873
+ ]
2874
+ }
2875
+ ]);
2876
+ return (options?.client ?? this.client).get({
2877
+ url: "/session/{sessionID}/diff",
2878
+ ...options,
2879
+ ...params
2880
+ });
2881
+ }
2882
+ /**
2883
+ * Get session messages
2884
+ *
2885
+ * Retrieve all messages in a session, including user prompts and AI responses.
2886
+ */
2887
+ messages(parameters, options) {
2888
+ const params = buildClientParams([parameters], [
2889
+ {
2890
+ args: [
2891
+ { in: "path", key: "sessionID" },
2892
+ { in: "query", key: "directory" },
2893
+ { in: "query", key: "workspace" },
2894
+ { in: "query", key: "limit" },
2895
+ { in: "query", key: "before" }
2896
+ ]
2897
+ }
2898
+ ]);
2899
+ return (options?.client ?? this.client).get({
2900
+ url: "/session/{sessionID}/message",
2901
+ ...options,
2902
+ ...params
2903
+ });
2904
+ }
2905
+ /**
2906
+ * Send message
2907
+ *
2908
+ * Create and send a new message to a session, streaming the AI response.
2909
+ */
2910
+ prompt(parameters, options) {
2911
+ const params = buildClientParams([parameters], [
2912
+ {
2913
+ args: [
2914
+ { in: "path", key: "sessionID" },
2915
+ { in: "query", key: "directory" },
2916
+ { in: "query", key: "workspace" },
2917
+ { in: "body", key: "messageID" },
2918
+ { in: "body", key: "model" },
2919
+ { in: "body", key: "agent" },
2920
+ { in: "body", key: "noReply" },
2921
+ { in: "body", key: "tools" },
2922
+ { in: "body", key: "format" },
2923
+ { in: "body", key: "system" },
2924
+ { in: "body", key: "variant" },
2925
+ { in: "body", key: "parts" }
3001
2926
  ]
3002
2927
  }
3003
2928
  ]);
3004
2929
  return (options?.client ?? this.client).post({
3005
- url: "/mcp/{name}/auth/callback",
2930
+ url: "/session/{sessionID}/message",
3006
2931
  ...options,
3007
2932
  ...params,
3008
2933
  headers: {
@@ -3013,66 +2938,385 @@ var Auth2 = class extends HeyApiClient {
3013
2938
  });
3014
2939
  }
3015
2940
  /**
3016
- * Authenticate MCP OAuth
2941
+ * Delete message
2942
+ *
2943
+ * Permanently delete a specific message and all of its parts from a session without reverting file changes.
2944
+ */
2945
+ deleteMessage(parameters, options) {
2946
+ const params = buildClientParams([parameters], [
2947
+ {
2948
+ args: [
2949
+ { in: "path", key: "sessionID" },
2950
+ { in: "path", key: "messageID" },
2951
+ { in: "query", key: "directory" },
2952
+ { in: "query", key: "workspace" }
2953
+ ]
2954
+ }
2955
+ ]);
2956
+ return (options?.client ?? this.client).delete({
2957
+ url: "/session/{sessionID}/message/{messageID}",
2958
+ ...options,
2959
+ ...params
2960
+ });
2961
+ }
2962
+ /**
2963
+ * Get message
3017
2964
  *
3018
- * Start OAuth flow and wait for callback (opens browser)
2965
+ * Retrieve a specific message from a session by its message ID.
2966
+ */
2967
+ message(parameters, options) {
2968
+ const params = buildClientParams([parameters], [
2969
+ {
2970
+ args: [
2971
+ { in: "path", key: "sessionID" },
2972
+ { in: "path", key: "messageID" },
2973
+ { in: "query", key: "directory" },
2974
+ { in: "query", key: "workspace" }
2975
+ ]
2976
+ }
2977
+ ]);
2978
+ return (options?.client ?? this.client).get({
2979
+ url: "/session/{sessionID}/message/{messageID}",
2980
+ ...options,
2981
+ ...params
2982
+ });
2983
+ }
2984
+ /**
2985
+ * Fork session
2986
+ *
2987
+ * Create a new session by forking an existing session at a specific message point.
2988
+ */
2989
+ fork(parameters, options) {
2990
+ const params = buildClientParams([parameters], [
2991
+ {
2992
+ args: [
2993
+ { in: "path", key: "sessionID" },
2994
+ { in: "query", key: "directory" },
2995
+ { in: "query", key: "workspace" },
2996
+ { in: "body", key: "messageID" }
2997
+ ]
2998
+ }
2999
+ ]);
3000
+ return (options?.client ?? this.client).post({
3001
+ url: "/session/{sessionID}/fork",
3002
+ ...options,
3003
+ ...params,
3004
+ headers: {
3005
+ "Content-Type": "application/json",
3006
+ ...options?.headers,
3007
+ ...params.headers
3008
+ }
3009
+ });
3010
+ }
3011
+ /**
3012
+ * Abort session
3013
+ *
3014
+ * Abort an active session and stop any ongoing AI processing or command execution.
3015
+ */
3016
+ abort(parameters, options) {
3017
+ const params = buildClientParams([parameters], [
3018
+ {
3019
+ args: [
3020
+ { in: "path", key: "sessionID" },
3021
+ { in: "query", key: "directory" },
3022
+ { in: "query", key: "workspace" }
3023
+ ]
3024
+ }
3025
+ ]);
3026
+ return (options?.client ?? this.client).post({
3027
+ url: "/session/{sessionID}/abort",
3028
+ ...options,
3029
+ ...params
3030
+ });
3031
+ }
3032
+ /**
3033
+ * Initialize session
3034
+ *
3035
+ * Analyze the current application and create an AGENTS.md file with project-specific agent configurations.
3036
+ */
3037
+ init(parameters, options) {
3038
+ const params = buildClientParams([parameters], [
3039
+ {
3040
+ args: [
3041
+ { in: "path", key: "sessionID" },
3042
+ { in: "query", key: "directory" },
3043
+ { in: "query", key: "workspace" },
3044
+ { in: "body", key: "modelID" },
3045
+ { in: "body", key: "providerID" },
3046
+ { in: "body", key: "messageID" }
3047
+ ]
3048
+ }
3049
+ ]);
3050
+ return (options?.client ?? this.client).post({
3051
+ url: "/session/{sessionID}/init",
3052
+ ...options,
3053
+ ...params,
3054
+ headers: {
3055
+ "Content-Type": "application/json",
3056
+ ...options?.headers,
3057
+ ...params.headers
3058
+ }
3059
+ });
3060
+ }
3061
+ /**
3062
+ * Unshare session
3063
+ *
3064
+ * Remove the shareable link for a session, making it private again.
3065
+ */
3066
+ unshare(parameters, options) {
3067
+ const params = buildClientParams([parameters], [
3068
+ {
3069
+ args: [
3070
+ { in: "path", key: "sessionID" },
3071
+ { in: "query", key: "directory" },
3072
+ { in: "query", key: "workspace" }
3073
+ ]
3074
+ }
3075
+ ]);
3076
+ return (options?.client ?? this.client).delete({
3077
+ url: "/session/{sessionID}/share",
3078
+ ...options,
3079
+ ...params
3080
+ });
3081
+ }
3082
+ /**
3083
+ * Share session
3084
+ *
3085
+ * Create a shareable link for a session, allowing others to view the conversation.
3086
+ */
3087
+ share(parameters, options) {
3088
+ const params = buildClientParams([parameters], [
3089
+ {
3090
+ args: [
3091
+ { in: "path", key: "sessionID" },
3092
+ { in: "query", key: "directory" },
3093
+ { in: "query", key: "workspace" }
3094
+ ]
3095
+ }
3096
+ ]);
3097
+ return (options?.client ?? this.client).post({
3098
+ url: "/session/{sessionID}/share",
3099
+ ...options,
3100
+ ...params
3101
+ });
3102
+ }
3103
+ /**
3104
+ * Summarize session
3105
+ *
3106
+ * Generate a concise summary of the session using AI compaction to preserve key information.
3107
+ */
3108
+ summarize(parameters, options) {
3109
+ const params = buildClientParams([parameters], [
3110
+ {
3111
+ args: [
3112
+ { in: "path", key: "sessionID" },
3113
+ { in: "query", key: "directory" },
3114
+ { in: "query", key: "workspace" },
3115
+ { in: "body", key: "providerID" },
3116
+ { in: "body", key: "modelID" },
3117
+ { in: "body", key: "auto" }
3118
+ ]
3119
+ }
3120
+ ]);
3121
+ return (options?.client ?? this.client).post({
3122
+ url: "/session/{sessionID}/summarize",
3123
+ ...options,
3124
+ ...params,
3125
+ headers: {
3126
+ "Content-Type": "application/json",
3127
+ ...options?.headers,
3128
+ ...params.headers
3129
+ }
3130
+ });
3131
+ }
3132
+ /**
3133
+ * Send async message
3134
+ *
3135
+ * Create and send a new message to a session asynchronously, starting the session if needed and returning immediately.
3136
+ */
3137
+ promptAsync(parameters, options) {
3138
+ const params = buildClientParams([parameters], [
3139
+ {
3140
+ args: [
3141
+ { in: "path", key: "sessionID" },
3142
+ { in: "query", key: "directory" },
3143
+ { in: "query", key: "workspace" },
3144
+ { in: "body", key: "messageID" },
3145
+ { in: "body", key: "model" },
3146
+ { in: "body", key: "agent" },
3147
+ { in: "body", key: "noReply" },
3148
+ { in: "body", key: "tools" },
3149
+ { in: "body", key: "format" },
3150
+ { in: "body", key: "system" },
3151
+ { in: "body", key: "variant" },
3152
+ { in: "body", key: "parts" }
3153
+ ]
3154
+ }
3155
+ ]);
3156
+ return (options?.client ?? this.client).post({
3157
+ url: "/session/{sessionID}/prompt_async",
3158
+ ...options,
3159
+ ...params,
3160
+ headers: {
3161
+ "Content-Type": "application/json",
3162
+ ...options?.headers,
3163
+ ...params.headers
3164
+ }
3165
+ });
3166
+ }
3167
+ /**
3168
+ * Send command
3169
+ *
3170
+ * Send a new command to a session for execution by the AI assistant.
3171
+ */
3172
+ command(parameters, options) {
3173
+ const params = buildClientParams([parameters], [
3174
+ {
3175
+ args: [
3176
+ { in: "path", key: "sessionID" },
3177
+ { in: "query", key: "directory" },
3178
+ { in: "query", key: "workspace" },
3179
+ { in: "body", key: "messageID" },
3180
+ { in: "body", key: "agent" },
3181
+ { in: "body", key: "model" },
3182
+ { in: "body", key: "arguments" },
3183
+ { in: "body", key: "command" },
3184
+ { in: "body", key: "variant" },
3185
+ { in: "body", key: "parts" }
3186
+ ]
3187
+ }
3188
+ ]);
3189
+ return (options?.client ?? this.client).post({
3190
+ url: "/session/{sessionID}/command",
3191
+ ...options,
3192
+ ...params,
3193
+ headers: {
3194
+ "Content-Type": "application/json",
3195
+ ...options?.headers,
3196
+ ...params.headers
3197
+ }
3198
+ });
3199
+ }
3200
+ /**
3201
+ * Run shell command
3202
+ *
3203
+ * Execute a shell command within the session context and return the AI's response.
3204
+ */
3205
+ shell(parameters, options) {
3206
+ const params = buildClientParams([parameters], [
3207
+ {
3208
+ args: [
3209
+ { in: "path", key: "sessionID" },
3210
+ { in: "query", key: "directory" },
3211
+ { in: "query", key: "workspace" },
3212
+ { in: "body", key: "messageID" },
3213
+ { in: "body", key: "agent" },
3214
+ { in: "body", key: "model" },
3215
+ { in: "body", key: "command" }
3216
+ ]
3217
+ }
3218
+ ]);
3219
+ return (options?.client ?? this.client).post({
3220
+ url: "/session/{sessionID}/shell",
3221
+ ...options,
3222
+ ...params,
3223
+ headers: {
3224
+ "Content-Type": "application/json",
3225
+ ...options?.headers,
3226
+ ...params.headers
3227
+ }
3228
+ });
3229
+ }
3230
+ /**
3231
+ * Revert message
3232
+ *
3233
+ * Revert a specific message in a session, undoing its effects and restoring the previous state.
3234
+ */
3235
+ revert(parameters, options) {
3236
+ const params = buildClientParams([parameters], [
3237
+ {
3238
+ args: [
3239
+ { in: "path", key: "sessionID" },
3240
+ { in: "query", key: "directory" },
3241
+ { in: "query", key: "workspace" },
3242
+ { in: "body", key: "messageID" },
3243
+ { in: "body", key: "partID" }
3244
+ ]
3245
+ }
3246
+ ]);
3247
+ return (options?.client ?? this.client).post({
3248
+ url: "/session/{sessionID}/revert",
3249
+ ...options,
3250
+ ...params,
3251
+ headers: {
3252
+ "Content-Type": "application/json",
3253
+ ...options?.headers,
3254
+ ...params.headers
3255
+ }
3256
+ });
3257
+ }
3258
+ /**
3259
+ * Restore reverted messages
3260
+ *
3261
+ * Restore all previously reverted messages in a session.
3019
3262
  */
3020
- authenticate(parameters, options) {
3263
+ unrevert(parameters, options) {
3021
3264
  const params = buildClientParams([parameters], [
3022
3265
  {
3023
3266
  args: [
3024
- { in: "path", key: "name" },
3267
+ { in: "path", key: "sessionID" },
3025
3268
  { in: "query", key: "directory" },
3026
3269
  { in: "query", key: "workspace" }
3027
3270
  ]
3028
3271
  }
3029
3272
  ]);
3030
3273
  return (options?.client ?? this.client).post({
3031
- url: "/mcp/{name}/auth/authenticate",
3274
+ url: "/session/{sessionID}/unrevert",
3032
3275
  ...options,
3033
3276
  ...params
3034
3277
  });
3035
3278
  }
3036
3279
  };
3037
- var Mcp = class extends HeyApiClient {
3280
+ var Part = class extends HeyApiClient {
3038
3281
  /**
3039
- * Get MCP status
3040
- *
3041
- * Get the status of all Model Context Protocol (MCP) servers.
3282
+ * Delete a part from a message.
3042
3283
  */
3043
- status(parameters, options) {
3284
+ delete(parameters, options) {
3044
3285
  const params = buildClientParams([parameters], [
3045
3286
  {
3046
3287
  args: [
3288
+ { in: "path", key: "sessionID" },
3289
+ { in: "path", key: "messageID" },
3290
+ { in: "path", key: "partID" },
3047
3291
  { in: "query", key: "directory" },
3048
3292
  { in: "query", key: "workspace" }
3049
3293
  ]
3050
3294
  }
3051
3295
  ]);
3052
- return (options?.client ?? this.client).get({
3053
- url: "/mcp",
3296
+ return (options?.client ?? this.client).delete({
3297
+ url: "/session/{sessionID}/message/{messageID}/part/{partID}",
3054
3298
  ...options,
3055
3299
  ...params
3056
3300
  });
3057
3301
  }
3058
3302
  /**
3059
- * Add MCP server
3060
- *
3061
- * Dynamically add a new Model Context Protocol (MCP) server to the system.
3303
+ * Update a part in a message.
3062
3304
  */
3063
- add(parameters, options) {
3305
+ update(parameters, options) {
3064
3306
  const params = buildClientParams([parameters], [
3065
3307
  {
3066
3308
  args: [
3309
+ { in: "path", key: "sessionID" },
3310
+ { in: "path", key: "messageID" },
3311
+ { in: "path", key: "partID" },
3067
3312
  { in: "query", key: "directory" },
3068
3313
  { in: "query", key: "workspace" },
3069
- { in: "body", key: "name" },
3070
- { in: "body", key: "config" }
3314
+ { key: "part", map: "body" }
3071
3315
  ]
3072
3316
  }
3073
3317
  ]);
3074
- return (options?.client ?? this.client).post({
3075
- url: "/mcp",
3318
+ return (options?.client ?? this.client).patch({
3319
+ url: "/session/{sessionID}/message/{messageID}/part/{partID}",
3076
3320
  ...options,
3077
3321
  ...params,
3078
3322
  headers: {
@@ -3082,87 +3326,108 @@ var Mcp = class extends HeyApiClient {
3082
3326
  }
3083
3327
  });
3084
3328
  }
3329
+ };
3330
+ var History = class extends HeyApiClient {
3085
3331
  /**
3086
- * Connect an MCP server
3332
+ * List sync events
3333
+ *
3334
+ * 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.
3087
3335
  */
3088
- connect(parameters, options) {
3336
+ list(parameters, options) {
3089
3337
  const params = buildClientParams([parameters], [
3090
3338
  {
3091
3339
  args: [
3092
- { in: "path", key: "name" },
3093
3340
  { in: "query", key: "directory" },
3094
- { in: "query", key: "workspace" }
3341
+ { in: "query", key: "workspace" },
3342
+ { key: "body", map: "body" }
3095
3343
  ]
3096
3344
  }
3097
3345
  ]);
3098
3346
  return (options?.client ?? this.client).post({
3099
- url: "/mcp/{name}/connect",
3347
+ url: "/sync/history",
3100
3348
  ...options,
3101
- ...params
3349
+ ...params,
3350
+ headers: {
3351
+ "Content-Type": "application/json",
3352
+ ...options?.headers,
3353
+ ...params.headers
3354
+ }
3102
3355
  });
3103
3356
  }
3357
+ };
3358
+ var Sync = class extends HeyApiClient {
3104
3359
  /**
3105
- * Disconnect an MCP server
3360
+ * Start workspace sync
3361
+ *
3362
+ * Start sync loops for workspaces in the current project that have active sessions.
3106
3363
  */
3107
- disconnect(parameters, options) {
3364
+ start(parameters, options) {
3108
3365
  const params = buildClientParams([parameters], [
3109
3366
  {
3110
3367
  args: [
3111
- { in: "path", key: "name" },
3112
3368
  { in: "query", key: "directory" },
3113
3369
  { in: "query", key: "workspace" }
3114
3370
  ]
3115
3371
  }
3116
3372
  ]);
3117
3373
  return (options?.client ?? this.client).post({
3118
- url: "/mcp/{name}/disconnect",
3374
+ url: "/sync/start",
3119
3375
  ...options,
3120
3376
  ...params
3121
3377
  });
3122
3378
  }
3123
- _auth;
3124
- get auth() {
3125
- return this._auth ??= new Auth2({ client: this.client });
3126
- }
3127
- };
3128
- var Control = class extends HeyApiClient {
3129
3379
  /**
3130
- * Get next TUI request
3380
+ * Replay sync events
3131
3381
  *
3132
- * Retrieve the next TUI (Terminal User Interface) request from the queue for processing.
3382
+ * Validate and replay a complete sync event history.
3133
3383
  */
3134
- next(parameters, options) {
3384
+ replay(parameters, options) {
3135
3385
  const params = buildClientParams([parameters], [
3136
3386
  {
3137
3387
  args: [
3138
- { in: "query", key: "directory" },
3139
- { in: "query", key: "workspace" }
3388
+ {
3389
+ in: "query",
3390
+ key: "query_directory",
3391
+ map: "directory"
3392
+ },
3393
+ { in: "query", key: "workspace" },
3394
+ {
3395
+ in: "body",
3396
+ key: "body_directory",
3397
+ map: "directory"
3398
+ },
3399
+ { in: "body", key: "events" }
3140
3400
  ]
3141
3401
  }
3142
3402
  ]);
3143
- return (options?.client ?? this.client).get({
3144
- url: "/tui/control/next",
3403
+ return (options?.client ?? this.client).post({
3404
+ url: "/sync/replay",
3145
3405
  ...options,
3146
- ...params
3406
+ ...params,
3407
+ headers: {
3408
+ "Content-Type": "application/json",
3409
+ ...options?.headers,
3410
+ ...params.headers
3411
+ }
3147
3412
  });
3148
3413
  }
3149
3414
  /**
3150
- * Submit TUI response
3415
+ * Steal session into workspace
3151
3416
  *
3152
- * Submit a response to the TUI request queue to complete a pending request.
3417
+ * Update a session to belong to the current workspace through the sync event system.
3153
3418
  */
3154
- response(parameters, options) {
3419
+ steal(parameters, options) {
3155
3420
  const params = buildClientParams([parameters], [
3156
3421
  {
3157
3422
  args: [
3158
3423
  { in: "query", key: "directory" },
3159
3424
  { in: "query", key: "workspace" },
3160
- { key: "body", map: "body" }
3425
+ { in: "body", key: "sessionID" }
3161
3426
  ]
3162
3427
  }
3163
3428
  ]);
3164
3429
  return (options?.client ?? this.client).post({
3165
- url: "/tui/control/response",
3430
+ url: "/sync/steal",
3166
3431
  ...options,
3167
3432
  ...params,
3168
3433
  headers: {
@@ -3172,140 +3437,168 @@ var Control = class extends HeyApiClient {
3172
3437
  }
3173
3438
  });
3174
3439
  }
3440
+ _history;
3441
+ get history() {
3442
+ return this._history ??= new History({ client: this.client });
3443
+ }
3175
3444
  };
3176
- var Tui = class extends HeyApiClient {
3445
+ var Session3 = class extends HeyApiClient {
3177
3446
  /**
3178
- * Append TUI prompt
3447
+ * List v2 sessions
3179
3448
  *
3180
- * Append prompt to the TUI
3449
+ * Retrieve sessions in the requested order. Items keep that order across pages; use cursor.next or cursor.previous to move through the ordered list.
3181
3450
  */
3182
- appendPrompt(parameters, options) {
3451
+ list(parameters, options) {
3183
3452
  const params = buildClientParams([parameters], [
3184
3453
  {
3185
3454
  args: [
3186
3455
  { in: "query", key: "directory" },
3187
3456
  { in: "query", key: "workspace" },
3188
- { in: "body", key: "text" }
3457
+ { in: "query", key: "limit" },
3458
+ { in: "query", key: "order" },
3459
+ { in: "query", key: "path" },
3460
+ { in: "query", key: "roots" },
3461
+ { in: "query", key: "start" },
3462
+ { in: "query", key: "search" },
3463
+ { in: "query", key: "cursor" }
3189
3464
  ]
3190
3465
  }
3191
3466
  ]);
3192
- return (options?.client ?? this.client).post({
3193
- url: "/tui/append-prompt",
3467
+ return (options?.client ?? this.client).get({
3468
+ url: "/api/session",
3194
3469
  ...options,
3195
- ...params,
3196
- headers: {
3197
- "Content-Type": "application/json",
3198
- ...options?.headers,
3199
- ...params.headers
3200
- }
3470
+ ...params
3201
3471
  });
3202
3472
  }
3203
3473
  /**
3204
- * Open help dialog
3474
+ * Send v2 message
3205
3475
  *
3206
- * Open the help dialog in the TUI to display user assistance information.
3476
+ * Create a v2 session message and queue it for the agent loop.
3207
3477
  */
3208
- openHelp(parameters, options) {
3478
+ prompt(parameters, options) {
3209
3479
  const params = buildClientParams([parameters], [
3210
3480
  {
3211
3481
  args: [
3482
+ { in: "path", key: "sessionID" },
3212
3483
  { in: "query", key: "directory" },
3213
- { in: "query", key: "workspace" }
3484
+ { in: "query", key: "workspace" },
3485
+ { in: "body", key: "prompt" },
3486
+ { in: "body", key: "delivery" }
3214
3487
  ]
3215
3488
  }
3216
3489
  ]);
3217
3490
  return (options?.client ?? this.client).post({
3218
- url: "/tui/open-help",
3491
+ url: "/api/session/{sessionID}/prompt",
3219
3492
  ...options,
3220
- ...params
3493
+ ...params,
3494
+ headers: {
3495
+ "Content-Type": "application/json",
3496
+ ...options?.headers,
3497
+ ...params.headers
3498
+ }
3221
3499
  });
3222
3500
  }
3223
3501
  /**
3224
- * Open sessions dialog
3502
+ * Compact v2 session
3225
3503
  *
3226
- * Open the session dialog
3504
+ * Compact a v2 session conversation.
3227
3505
  */
3228
- openSessions(parameters, options) {
3506
+ compact(parameters, options) {
3229
3507
  const params = buildClientParams([parameters], [
3230
3508
  {
3231
3509
  args: [
3510
+ { in: "path", key: "sessionID" },
3232
3511
  { in: "query", key: "directory" },
3233
3512
  { in: "query", key: "workspace" }
3234
3513
  ]
3235
3514
  }
3236
3515
  ]);
3237
3516
  return (options?.client ?? this.client).post({
3238
- url: "/tui/open-sessions",
3517
+ url: "/api/session/{sessionID}/compact",
3239
3518
  ...options,
3240
3519
  ...params
3241
3520
  });
3242
3521
  }
3243
3522
  /**
3244
- * Open themes dialog
3523
+ * Wait for v2 session
3245
3524
  *
3246
- * Open the theme dialog
3525
+ * Wait for a v2 session agent loop to become idle.
3247
3526
  */
3248
- openThemes(parameters, options) {
3527
+ wait(parameters, options) {
3249
3528
  const params = buildClientParams([parameters], [
3250
3529
  {
3251
3530
  args: [
3531
+ { in: "path", key: "sessionID" },
3252
3532
  { in: "query", key: "directory" },
3253
3533
  { in: "query", key: "workspace" }
3254
3534
  ]
3255
3535
  }
3256
3536
  ]);
3257
3537
  return (options?.client ?? this.client).post({
3258
- url: "/tui/open-themes",
3538
+ url: "/api/session/{sessionID}/wait",
3259
3539
  ...options,
3260
3540
  ...params
3261
3541
  });
3262
3542
  }
3263
3543
  /**
3264
- * Open models dialog
3544
+ * Get v2 session context
3265
3545
  *
3266
- * Open the model dialog
3546
+ * Retrieve the active context messages for a v2 session (all messages after the last compaction).
3267
3547
  */
3268
- openModels(parameters, options) {
3548
+ context(parameters, options) {
3269
3549
  const params = buildClientParams([parameters], [
3270
3550
  {
3271
3551
  args: [
3552
+ { in: "path", key: "sessionID" },
3272
3553
  { in: "query", key: "directory" },
3273
3554
  { in: "query", key: "workspace" }
3274
3555
  ]
3275
3556
  }
3276
3557
  ]);
3277
- return (options?.client ?? this.client).post({
3278
- url: "/tui/open-models",
3558
+ return (options?.client ?? this.client).get({
3559
+ url: "/api/session/{sessionID}/context",
3279
3560
  ...options,
3280
3561
  ...params
3281
3562
  });
3282
3563
  }
3283
3564
  /**
3284
- * Submit TUI prompt
3565
+ * Get v2 session messages
3285
3566
  *
3286
- * Submit the prompt
3567
+ * 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.
3287
3568
  */
3288
- submitPrompt(parameters, options) {
3569
+ messages(parameters, options) {
3289
3570
  const params = buildClientParams([parameters], [
3290
3571
  {
3291
3572
  args: [
3573
+ { in: "path", key: "sessionID" },
3292
3574
  { in: "query", key: "directory" },
3293
- { in: "query", key: "workspace" }
3575
+ { in: "query", key: "workspace" },
3576
+ { in: "query", key: "limit" },
3577
+ { in: "query", key: "order" },
3578
+ { in: "query", key: "cursor" }
3294
3579
  ]
3295
3580
  }
3296
3581
  ]);
3297
- return (options?.client ?? this.client).post({
3298
- url: "/tui/submit-prompt",
3582
+ return (options?.client ?? this.client).get({
3583
+ url: "/api/session/{sessionID}/message",
3299
3584
  ...options,
3300
3585
  ...params
3301
3586
  });
3302
3587
  }
3588
+ };
3589
+ var V2 = class extends HeyApiClient {
3590
+ _session;
3591
+ get session() {
3592
+ return this._session ??= new Session3({ client: this.client });
3593
+ }
3594
+ };
3595
+ var Control = class extends HeyApiClient {
3303
3596
  /**
3304
- * Clear TUI prompt
3597
+ * Get next TUI request
3305
3598
  *
3306
- * Clear the prompt
3599
+ * Retrieve the next TUI request from the queue for processing.
3307
3600
  */
3308
- clearPrompt(parameters, options) {
3601
+ next(parameters, options) {
3309
3602
  const params = buildClientParams([parameters], [
3310
3603
  {
3311
3604
  args: [
@@ -3314,29 +3607,29 @@ var Tui = class extends HeyApiClient {
3314
3607
  ]
3315
3608
  }
3316
3609
  ]);
3317
- return (options?.client ?? this.client).post({
3318
- url: "/tui/clear-prompt",
3610
+ return (options?.client ?? this.client).get({
3611
+ url: "/tui/control/next",
3319
3612
  ...options,
3320
3613
  ...params
3321
3614
  });
3322
3615
  }
3323
3616
  /**
3324
- * Execute TUI command
3617
+ * Submit TUI response
3325
3618
  *
3326
- * Execute a TUI command (e.g. agent_cycle)
3619
+ * Submit a response to the TUI request queue to complete a pending request.
3327
3620
  */
3328
- executeCommand(parameters, options) {
3621
+ response(parameters, options) {
3329
3622
  const params = buildClientParams([parameters], [
3330
3623
  {
3331
3624
  args: [
3332
3625
  { in: "query", key: "directory" },
3333
3626
  { in: "query", key: "workspace" },
3334
- { in: "body", key: "command" }
3627
+ { key: "body", map: "body" }
3335
3628
  ]
3336
3629
  }
3337
3630
  ]);
3338
3631
  return (options?.client ?? this.client).post({
3339
- url: "/tui/execute-command",
3632
+ url: "/tui/control/response",
3340
3633
  ...options,
3341
3634
  ...params,
3342
3635
  headers: {
@@ -3346,26 +3639,25 @@ var Tui = class extends HeyApiClient {
3346
3639
  }
3347
3640
  });
3348
3641
  }
3642
+ };
3643
+ var Tui = class extends HeyApiClient {
3349
3644
  /**
3350
- * Show TUI toast
3645
+ * Append TUI prompt
3351
3646
  *
3352
- * Show a toast notification in the TUI
3647
+ * Append prompt to the TUI.
3353
3648
  */
3354
- showToast(parameters, options) {
3649
+ appendPrompt(parameters, options) {
3355
3650
  const params = buildClientParams([parameters], [
3356
3651
  {
3357
3652
  args: [
3358
3653
  { in: "query", key: "directory" },
3359
3654
  { in: "query", key: "workspace" },
3360
- { in: "body", key: "title" },
3361
- { in: "body", key: "message" },
3362
- { in: "body", key: "variant" },
3363
- { in: "body", key: "duration" }
3655
+ { in: "body", key: "text" }
3364
3656
  ]
3365
3657
  }
3366
3658
  ]);
3367
3659
  return (options?.client ?? this.client).post({
3368
- url: "/tui/show-toast",
3660
+ url: "/tui/append-prompt",
3369
3661
  ...options,
3370
3662
  ...params,
3371
3663
  headers: {
@@ -3376,69 +3668,71 @@ var Tui = class extends HeyApiClient {
3376
3668
  });
3377
3669
  }
3378
3670
  /**
3379
- * Publish TUI event
3671
+ * Open help dialog
3380
3672
  *
3381
- * Publish a TUI event
3673
+ * Open the help dialog in the TUI to display user assistance information.
3382
3674
  */
3383
- publish(parameters, options) {
3675
+ openHelp(parameters, options) {
3384
3676
  const params = buildClientParams([parameters], [
3385
3677
  {
3386
3678
  args: [
3387
3679
  { in: "query", key: "directory" },
3388
- { in: "query", key: "workspace" },
3389
- { key: "body", map: "body" }
3680
+ { in: "query", key: "workspace" }
3390
3681
  ]
3391
3682
  }
3392
3683
  ]);
3393
3684
  return (options?.client ?? this.client).post({
3394
- url: "/tui/publish",
3685
+ url: "/tui/open-help",
3395
3686
  ...options,
3396
- ...params,
3397
- headers: {
3398
- "Content-Type": "application/json",
3399
- ...options?.headers,
3400
- ...params.headers
3401
- }
3687
+ ...params
3402
3688
  });
3403
3689
  }
3404
3690
  /**
3405
- * Select session
3691
+ * Open sessions dialog
3406
3692
  *
3407
- * Navigate the TUI to display the specified session.
3693
+ * Open the session dialog.
3408
3694
  */
3409
- selectSession(parameters, options) {
3695
+ openSessions(parameters, options) {
3410
3696
  const params = buildClientParams([parameters], [
3411
3697
  {
3412
3698
  args: [
3413
3699
  { in: "query", key: "directory" },
3414
- { in: "query", key: "workspace" },
3415
- { in: "body", key: "sessionID" }
3700
+ { in: "query", key: "workspace" }
3416
3701
  ]
3417
3702
  }
3418
3703
  ]);
3419
3704
  return (options?.client ?? this.client).post({
3420
- url: "/tui/select-session",
3705
+ url: "/tui/open-sessions",
3421
3706
  ...options,
3422
- ...params,
3423
- headers: {
3424
- "Content-Type": "application/json",
3425
- ...options?.headers,
3426
- ...params.headers
3707
+ ...params
3708
+ });
3709
+ }
3710
+ /**
3711
+ * Open themes dialog
3712
+ *
3713
+ * Open the theme dialog.
3714
+ */
3715
+ openThemes(parameters, options) {
3716
+ const params = buildClientParams([parameters], [
3717
+ {
3718
+ args: [
3719
+ { in: "query", key: "directory" },
3720
+ { in: "query", key: "workspace" }
3721
+ ]
3427
3722
  }
3723
+ ]);
3724
+ return (options?.client ?? this.client).post({
3725
+ url: "/tui/open-themes",
3726
+ ...options,
3727
+ ...params
3428
3728
  });
3429
3729
  }
3430
- _control;
3431
- get control() {
3432
- return this._control ??= new Control({ client: this.client });
3433
- }
3434
- };
3435
- var Instance = class extends HeyApiClient {
3436
3730
  /**
3437
- * Dispose instance
3731
+ * Open models dialog
3438
3732
  *
3439
- * Clean up and dispose the current OpenCode instance, releasing all resources.
3733
+ * Open the model dialog.
3440
3734
  */
3441
- dispose(parameters, options) {
3735
+ openModels(parameters, options) {
3442
3736
  const params = buildClientParams([parameters], [
3443
3737
  {
3444
3738
  args: [
@@ -3448,19 +3742,17 @@ var Instance = class extends HeyApiClient {
3448
3742
  }
3449
3743
  ]);
3450
3744
  return (options?.client ?? this.client).post({
3451
- url: "/instance/dispose",
3745
+ url: "/tui/open-models",
3452
3746
  ...options,
3453
3747
  ...params
3454
3748
  });
3455
3749
  }
3456
- };
3457
- var Path = class extends HeyApiClient {
3458
3750
  /**
3459
- * Get paths
3751
+ * Submit TUI prompt
3460
3752
  *
3461
- * Retrieve the current working directory and related path information for the OpenCode instance.
3753
+ * Submit the prompt.
3462
3754
  */
3463
- get(parameters, options) {
3755
+ submitPrompt(parameters, options) {
3464
3756
  const params = buildClientParams([parameters], [
3465
3757
  {
3466
3758
  args: [
@@ -3469,20 +3761,18 @@ var Path = class extends HeyApiClient {
3469
3761
  ]
3470
3762
  }
3471
3763
  ]);
3472
- return (options?.client ?? this.client).get({
3473
- url: "/path",
3764
+ return (options?.client ?? this.client).post({
3765
+ url: "/tui/submit-prompt",
3474
3766
  ...options,
3475
3767
  ...params
3476
3768
  });
3477
3769
  }
3478
- };
3479
- var Vcs = class extends HeyApiClient {
3480
3770
  /**
3481
- * Get VCS info
3771
+ * Clear TUI prompt
3482
3772
  *
3483
- * Retrieve version control system (VCS) information for the current project, such as git branch.
3773
+ * Clear the prompt.
3484
3774
  */
3485
- get(parameters, options) {
3775
+ clearPrompt(parameters, options) {
3486
3776
  const params = buildClientParams([parameters], [
3487
3777
  {
3488
3778
  args: [
@@ -3491,99 +3781,123 @@ var Vcs = class extends HeyApiClient {
3491
3781
  ]
3492
3782
  }
3493
3783
  ]);
3494
- return (options?.client ?? this.client).get({
3495
- url: "/vcs",
3784
+ return (options?.client ?? this.client).post({
3785
+ url: "/tui/clear-prompt",
3496
3786
  ...options,
3497
3787
  ...params
3498
3788
  });
3499
3789
  }
3500
3790
  /**
3501
- * Get VCS diff
3791
+ * Execute TUI command
3502
3792
  *
3503
- * Retrieve the current git diff for the working tree or against the default branch.
3793
+ * Execute a TUI command.
3504
3794
  */
3505
- diff(parameters, options) {
3795
+ executeCommand(parameters, options) {
3506
3796
  const params = buildClientParams([parameters], [
3507
3797
  {
3508
3798
  args: [
3509
3799
  { in: "query", key: "directory" },
3510
3800
  { in: "query", key: "workspace" },
3511
- { in: "query", key: "mode" }
3801
+ { in: "body", key: "command" }
3512
3802
  ]
3513
3803
  }
3514
3804
  ]);
3515
- return (options?.client ?? this.client).get({
3516
- url: "/vcs/diff",
3805
+ return (options?.client ?? this.client).post({
3806
+ url: "/tui/execute-command",
3517
3807
  ...options,
3518
- ...params
3808
+ ...params,
3809
+ headers: {
3810
+ "Content-Type": "application/json",
3811
+ ...options?.headers,
3812
+ ...params.headers
3813
+ }
3519
3814
  });
3520
3815
  }
3521
- };
3522
- var Command = class extends HeyApiClient {
3523
3816
  /**
3524
- * List commands
3817
+ * Show TUI toast
3525
3818
  *
3526
- * Get a list of all available commands in the OpenCode system.
3819
+ * Show a toast notification in the TUI.
3527
3820
  */
3528
- list(parameters, options) {
3821
+ showToast(parameters, options) {
3529
3822
  const params = buildClientParams([parameters], [
3530
3823
  {
3531
3824
  args: [
3532
3825
  { in: "query", key: "directory" },
3533
- { in: "query", key: "workspace" }
3826
+ { in: "query", key: "workspace" },
3827
+ { in: "body", key: "title" },
3828
+ { in: "body", key: "message" },
3829
+ { in: "body", key: "variant" },
3830
+ { in: "body", key: "duration" }
3534
3831
  ]
3535
3832
  }
3536
3833
  ]);
3537
- return (options?.client ?? this.client).get({
3538
- url: "/command",
3834
+ return (options?.client ?? this.client).post({
3835
+ url: "/tui/show-toast",
3539
3836
  ...options,
3540
- ...params
3837
+ ...params,
3838
+ headers: {
3839
+ "Content-Type": "application/json",
3840
+ ...options?.headers,
3841
+ ...params.headers
3842
+ }
3541
3843
  });
3542
3844
  }
3543
- };
3544
- var Lsp = class extends HeyApiClient {
3545
3845
  /**
3546
- * Get LSP status
3846
+ * Publish TUI event
3547
3847
  *
3548
- * Get LSP server status
3848
+ * Publish a TUI event.
3549
3849
  */
3550
- status(parameters, options) {
3850
+ publish(parameters, options) {
3551
3851
  const params = buildClientParams([parameters], [
3552
3852
  {
3553
3853
  args: [
3554
3854
  { in: "query", key: "directory" },
3555
- { in: "query", key: "workspace" }
3855
+ { in: "query", key: "workspace" },
3856
+ { key: "body", map: "body" }
3556
3857
  ]
3557
3858
  }
3558
3859
  ]);
3559
- return (options?.client ?? this.client).get({
3560
- url: "/lsp",
3860
+ return (options?.client ?? this.client).post({
3861
+ url: "/tui/publish",
3561
3862
  ...options,
3562
- ...params
3863
+ ...params,
3864
+ headers: {
3865
+ "Content-Type": "application/json",
3866
+ ...options?.headers,
3867
+ ...params.headers
3868
+ }
3563
3869
  });
3564
3870
  }
3565
- };
3566
- var Formatter = class extends HeyApiClient {
3567
3871
  /**
3568
- * Get formatter status
3872
+ * Select session
3569
3873
  *
3570
- * Get formatter status
3874
+ * Navigate the TUI to display the specified session.
3571
3875
  */
3572
- status(parameters, options) {
3876
+ selectSession(parameters, options) {
3573
3877
  const params = buildClientParams([parameters], [
3574
3878
  {
3575
3879
  args: [
3576
3880
  { in: "query", key: "directory" },
3577
- { in: "query", key: "workspace" }
3881
+ { in: "query", key: "workspace" },
3882
+ { in: "body", key: "sessionID" }
3578
3883
  ]
3579
3884
  }
3580
3885
  ]);
3581
- return (options?.client ?? this.client).get({
3582
- url: "/formatter",
3886
+ return (options?.client ?? this.client).post({
3887
+ url: "/tui/select-session",
3583
3888
  ...options,
3584
- ...params
3889
+ ...params,
3890
+ headers: {
3891
+ "Content-Type": "application/json",
3892
+ ...options?.headers,
3893
+ ...params.headers
3894
+ }
3585
3895
  });
3586
3896
  }
3897
+ _control;
3898
+ get control() {
3899
+ return this._control ??= new Control({ client: this.client });
3900
+ }
3587
3901
  };
3588
3902
  var OpencodeClient = class _OpencodeClient extends HeyApiClient {
3589
3903
  static __registry = new HeyApiRegistry();
@@ -3591,10 +3905,6 @@ var OpencodeClient = class _OpencodeClient extends HeyApiClient {
3591
3905
  super(args);
3592
3906
  _OpencodeClient.__registry.set(this, args?.key);
3593
3907
  }
3594
- _global;
3595
- get global() {
3596
- return this._global ??= new Global({ client: this.client });
3597
- }
3598
3908
  _auth;
3599
3909
  get auth() {
3600
3910
  return this._auth ??= new Auth({ client: this.client });
@@ -3603,22 +3913,22 @@ var OpencodeClient = class _OpencodeClient extends HeyApiClient {
3603
3913
  get app() {
3604
3914
  return this._app ??= new App({ client: this.client });
3605
3915
  }
3606
- _experimental;
3607
- get experimental() {
3608
- return this._experimental ??= new Experimental({ client: this.client });
3609
- }
3610
- _project;
3611
- get project() {
3612
- return this._project ??= new Project({ client: this.client });
3916
+ _global;
3917
+ get global() {
3918
+ return this._global ??= new Global({ client: this.client });
3613
3919
  }
3614
- _pty;
3615
- get pty() {
3616
- return this._pty ??= new Pty({ client: this.client });
3920
+ _event;
3921
+ get event() {
3922
+ return this._event ??= new Event({ client: this.client });
3617
3923
  }
3618
3924
  _config;
3619
3925
  get config() {
3620
3926
  return this._config ??= new Config2({ client: this.client });
3621
3927
  }
3928
+ _experimental;
3929
+ get experimental() {
3930
+ return this._experimental ??= new Experimental({ client: this.client });
3931
+ }
3622
3932
  _tool;
3623
3933
  get tool() {
3624
3934
  return this._tool ??= new Tool({ client: this.client });
@@ -3627,30 +3937,6 @@ var OpencodeClient = class _OpencodeClient extends HeyApiClient {
3627
3937
  get worktree() {
3628
3938
  return this._worktree ??= new Worktree({ client: this.client });
3629
3939
  }
3630
- _session;
3631
- get session() {
3632
- return this._session ??= new Session2({ client: this.client });
3633
- }
3634
- _part;
3635
- get part() {
3636
- return this._part ??= new Part({ client: this.client });
3637
- }
3638
- _permission;
3639
- get permission() {
3640
- return this._permission ??= new Permission({ client: this.client });
3641
- }
3642
- _question;
3643
- get question() {
3644
- return this._question ??= new Question({ client: this.client });
3645
- }
3646
- _provider;
3647
- get provider() {
3648
- return this._provider ??= new Provider({ client: this.client });
3649
- }
3650
- _sync;
3651
- get sync() {
3652
- return this._sync ??= new Sync({ client: this.client });
3653
- }
3654
3940
  _find;
3655
3941
  get find() {
3656
3942
  return this._find ??= new Find({ client: this.client });
@@ -3659,18 +3945,6 @@ var OpencodeClient = class _OpencodeClient extends HeyApiClient {
3659
3945
  get file() {
3660
3946
  return this._file ??= new File({ client: this.client });
3661
3947
  }
3662
- _event;
3663
- get event() {
3664
- return this._event ??= new Event({ client: this.client });
3665
- }
3666
- _mcp;
3667
- get mcp() {
3668
- return this._mcp ??= new Mcp({ client: this.client });
3669
- }
3670
- _tui;
3671
- get tui() {
3672
- return this._tui ??= new Tui({ client: this.client });
3673
- }
3674
3948
  _instance;
3675
3949
  get instance() {
3676
3950
  return this._instance ??= new Instance({ client: this.client });
@@ -3695,8 +3969,79 @@ var OpencodeClient = class _OpencodeClient extends HeyApiClient {
3695
3969
  get formatter() {
3696
3970
  return this._formatter ??= new Formatter({ client: this.client });
3697
3971
  }
3972
+ _mcp;
3973
+ get mcp() {
3974
+ return this._mcp ??= new Mcp({ client: this.client });
3975
+ }
3976
+ _project;
3977
+ get project() {
3978
+ return this._project ??= new Project({ client: this.client });
3979
+ }
3980
+ _pty;
3981
+ get pty() {
3982
+ return this._pty ??= new Pty({ client: this.client });
3983
+ }
3984
+ _question;
3985
+ get question() {
3986
+ return this._question ??= new Question({ client: this.client });
3987
+ }
3988
+ _permission;
3989
+ get permission() {
3990
+ return this._permission ??= new Permission({ client: this.client });
3991
+ }
3992
+ _provider;
3993
+ get provider() {
3994
+ return this._provider ??= new Provider({ client: this.client });
3995
+ }
3996
+ _session;
3997
+ get session() {
3998
+ return this._session ??= new Session2({ client: this.client });
3999
+ }
4000
+ _part;
4001
+ get part() {
4002
+ return this._part ??= new Part({ client: this.client });
4003
+ }
4004
+ _sync;
4005
+ get sync() {
4006
+ return this._sync ??= new Sync({ client: this.client });
4007
+ }
4008
+ _v2;
4009
+ get v2() {
4010
+ return this._v2 ??= new V2({ client: this.client });
4011
+ }
4012
+ _tui;
4013
+ get tui() {
4014
+ return this._tui ??= new Tui({ client: this.client });
4015
+ }
3698
4016
  };
3699
4017
 
4018
+ // node_modules/@opencode-ai/sdk/dist/error-interceptor.js
4019
+ function wrapClientError(error, response, request, opts) {
4020
+ if (!opts?.throwOnError)
4021
+ return error;
4022
+ if (error instanceof Error)
4023
+ return error;
4024
+ if (typeof error === "object" && error !== null && Object.keys(error).length > 0) {
4025
+ const obj = error;
4026
+ const message = typeof obj.data?.message === "string" && obj.data.message || typeof obj.message === "string" && obj.message || typeof obj.name === "string" && obj.name || describe(request, response);
4027
+ return new Error(message, { cause: { body: error, status: response?.status } });
4028
+ }
4029
+ if (typeof error === "string" && error.length > 0) {
4030
+ return new Error(error, { cause: { body: error, status: response?.status } });
4031
+ }
4032
+ const reason = response ? "(empty response body)" : "network error (no response)";
4033
+ return new Error(`opencode server ${describe(request, response)}: ${reason}`, {
4034
+ cause: { body: error, status: response?.status }
4035
+ });
4036
+ }
4037
+ function describe(request, response) {
4038
+ const method = request?.method ?? "?";
4039
+ const url = request?.url ?? "?";
4040
+ const status = response?.status;
4041
+ const statusText = response?.statusText;
4042
+ return `${method} ${url}${status ? " \u2192 " + status : ""}${statusText ? " " + statusText : ""}`;
4043
+ }
4044
+
3700
4045
  // node_modules/@opencode-ai/sdk/dist/v2/client.js
3701
4046
  function pick(value, fallback, encode) {
3702
4047
  if (!value)
@@ -3767,6 +4112,7 @@ function createOpencodeClient(config) {
3767
4112
  throw new Error("Request is not supported by this version of OpenCode Server (Server responded with text/html)");
3768
4113
  return response;
3769
4114
  });
4115
+ client2.interceptors.error.use(wrapClientError);
3770
4116
  return new OpencodeClient({ client: client2 });
3771
4117
  }
3772
4118
 
@@ -3940,7 +4286,8 @@ function shouldSuppressRootRetryForChildActivity(state, rootSessionID) {
3940
4286
  async function createManagedUltraworkSession(state, title) {
3941
4287
  const result = await state.client.session.create({
3942
4288
  directory: state.input.directory,
3943
- title
4289
+ title,
4290
+ agent: ULTRAWORK_AGENT
3944
4291
  });
3945
4292
  if (result.error || !result.response.ok) {
3946
4293
  throw new Error(
@@ -4231,10 +4578,29 @@ function markUltraworkSessionActive(state, sessionID) {
4231
4578
  function getModelProviderID(model) {
4232
4579
  return model?.providerID || model?.modelID.split("/")[0];
4233
4580
  }
4581
+ function modelRefFromRuntimeModel(model) {
4582
+ if (!isRecord(model)) return void 0;
4583
+ const providerID = stringifyErrorField(model.providerID);
4584
+ const id = stringifyErrorField(model.id);
4585
+ const modelID = stringifyErrorField(model.modelID) ?? id;
4586
+ if (!providerID || !modelID) return void 0;
4587
+ const variant = stringifyErrorField(model.variant);
4588
+ return variant ? { providerID, modelID, variant } : { providerID, modelID };
4589
+ }
4590
+ function providerIDFromRuntimeProvider(provider) {
4591
+ if (!isRecord(provider)) return void 0;
4592
+ const directID = stringifyErrorField(provider.id);
4593
+ if (directID) return directID;
4594
+ const info = isRecord(provider.info) ? provider.info : void 0;
4595
+ return stringifyErrorField(info?.id);
4596
+ }
4234
4597
  function isSameModel(a, b) {
4235
4598
  if (!a || !b) return false;
4236
4599
  return a.providerID === b.providerID && a.modelID === b.modelID;
4237
4600
  }
4601
+ function getEventModel(properties) {
4602
+ return modelRefFromRuntimeModel(properties?.model);
4603
+ }
4238
4604
  function getModelCapabilityScore(model) {
4239
4605
  if (!model) return 90;
4240
4606
  const modelID = model.modelID.toLowerCase();
@@ -4359,6 +4725,8 @@ function extractManagedErrorDetails(error) {
4359
4725
  error.message,
4360
4726
  data?.message,
4361
4727
  nestedError?.message,
4728
+ data?.responseBody,
4729
+ nestedError?.responseBody,
4362
4730
  code,
4363
4731
  type
4364
4732
  ].map(stringifyErrorField).filter(Boolean).join(" ").toLowerCase();
@@ -4382,13 +4750,23 @@ function getManagedSessionErrorAction(error) {
4382
4750
  if (details.status === 408 || details.status === 409 || details.status === 425 || details.status >= 500) {
4383
4751
  return "retry";
4384
4752
  }
4753
+ if (details.status === 401 || details.status === 403) {
4754
+ return "none";
4755
+ }
4385
4756
  if (details.status >= 400 && details.status < 500) {
4386
4757
  return "fallback";
4387
4758
  }
4388
4759
  }
4389
4760
  if (details.isRetryable === true) return "retry";
4761
+ if (details.isRetryable === false) return "fallback";
4390
4762
  if (details.code && /^E[A-Z0-9_]+$/.test(details.code)) return "retry";
4391
- if (details.hasApiShape || details.message) return "fallback";
4763
+ if (/certificate has expired|unknown certificate verification error/i.test(details.message)) {
4764
+ return "fallback";
4765
+ }
4766
+ if (details.name === "ProviderAuthError" || details.name === "MessageAbortedError") return "none";
4767
+ if (details.name === "APIError" || details.name === "ContextOverflowError") return "fallback";
4768
+ if (details.name === "MessageOutputLengthError" || details.name === "StructuredOutputError") return "retry";
4769
+ if (details.hasApiShape) return "fallback";
4392
4770
  return "none";
4393
4771
  }
4394
4772
  function shouldUseFallbackForManagedError(error, managedSession, retryCount) {
@@ -5582,11 +5960,16 @@ function createKeywordDetectorChatMessage(_state) {
5582
5960
  }
5583
5961
  function createFallbackModels(state) {
5584
5962
  return async (input, _output) => {
5963
+ const runtimeModel = modelRefFromRuntimeModel(input.model);
5964
+ const runtimeProviderID = providerIDFromRuntimeProvider(input.provider) ?? runtimeModel?.providerID;
5585
5965
  if (input.agent === ULTRAWORK_AGENT) {
5586
5966
  const wasAlreadyManaged = isManagedUltraworkSession(state, input.sessionID);
5587
5967
  await addManagedUltraworkSession(state, input.sessionID);
5588
5968
  await writeUltraworkMarker(state);
5589
- scheduleProviderRetryWatchdog(state, input.sessionID);
5969
+ if (runtimeModel) {
5970
+ await updateManagedSessionModel(state, input.sessionID, runtimeModel);
5971
+ scheduleProviderRetryWatchdog(state, input.sessionID, runtimeModel);
5972
+ }
5590
5973
  if (!wasAlreadyManaged && !state.autoResumeAttempted && !state.autoResumeInFlight) {
5591
5974
  const markerActive = await isUltraworkMarkerActive(state);
5592
5975
  if (markerActive) {
@@ -5624,13 +6007,10 @@ function createFallbackModels(state) {
5624
6007
  } else if (getManagedSession(state, input.sessionID)?.kind === "child") {
5625
6008
  await updateManagedSessionAgent(state, input.sessionID, input.agent);
5626
6009
  }
5627
- const modelId = input.model && "id" in input.model ? input.model.id ?? "unknown" : "unknown";
5628
- const providerId = input.provider?.info && "id" in input.provider.info ? input.provider.info.id ?? "unknown" : "unknown";
5629
- if (input.sessionID && modelId !== "unknown" && providerId !== "unknown") {
5630
- await updateManagedSessionModel(state, input.sessionID, {
5631
- providerID: providerId,
5632
- modelID: modelId
5633
- });
6010
+ const modelId = runtimeModel?.modelID ?? "unknown";
6011
+ const providerId = runtimeProviderID ?? "unknown";
6012
+ if (input.sessionID && runtimeModel && getManagedSession(state, input.sessionID)) {
6013
+ await updateManagedSessionModel(state, input.sessionID, runtimeModel);
5634
6014
  }
5635
6015
  pluginLog.info(
5636
6016
  `[opencode-immune] Model Observer: agent="${input.agent}", model="${modelId}", provider="${providerId}"`
@@ -5650,6 +6030,57 @@ function createEventHandler(state) {
5650
6030
  const info = properties?.info;
5651
6031
  const sessionID = properties?.sessionID ?? info?.sessionID ?? info?.id;
5652
6032
  const error = properties?.error ?? info?.error;
6033
+ if (sessionID && eventType === "session.next.model.switched") {
6034
+ const model = getEventModel(properties);
6035
+ if (model && getManagedSession(state, sessionID)) {
6036
+ await updateManagedSessionModel(state, sessionID, model);
6037
+ }
6038
+ }
6039
+ if (sessionID && eventType === "session.next.step.started") {
6040
+ const model = getEventModel(properties);
6041
+ const agent = stringifyErrorField(properties?.agent);
6042
+ const existing = getManagedSession(state, sessionID);
6043
+ if (model && existing) {
6044
+ await updateManagedSessionModel(state, sessionID, model);
6045
+ }
6046
+ if (agent && existing?.kind === "child") {
6047
+ await updateManagedSessionAgent(state, sessionID, agent);
6048
+ }
6049
+ }
6050
+ if (sessionID && eventType === "session.next.step.ended") {
6051
+ cancelProviderRetryWatchdog(state, sessionID, "session step ended");
6052
+ if (getManagedSession(state, sessionID)) {
6053
+ state.sessionErrorRetryCount.delete(sessionID);
6054
+ }
6055
+ }
6056
+ if (sessionID && eventType === "session.next.text.ended") {
6057
+ cancelProviderRetryWatchdog(state, sessionID, "session text ended");
6058
+ }
6059
+ if (sessionID && eventType === "session.next.retried") {
6060
+ const retryError = properties?.error;
6061
+ await writeDiagnosticLog(state, "session-retry:provider-retried", {
6062
+ sessionID,
6063
+ attempt: properties?.attempt,
6064
+ action: getManagedSessionErrorAction(retryError),
6065
+ errorType: getRetryableErrorType(retryError)
6066
+ });
6067
+ const managedSession = getManagedSession(state, sessionID);
6068
+ if (managedSession?.kind === "root" && !state.sessionRetryTimers.has(sessionID)) {
6069
+ const selectedFallbackModel = selectFallbackModel(
6070
+ state,
6071
+ getFailedModelFromError(retryError) ?? managedSession.currentModel
6072
+ );
6073
+ if (selectedFallbackModel) {
6074
+ await setSessionFallbackModel(state, sessionID, selectedFallbackModel);
6075
+ scheduleManagedSessionRetry(state, sessionID, {
6076
+ delayMs: 1e3,
6077
+ reason: "provider retry event fallback",
6078
+ countAgainstBudget: false,
6079
+ abortBeforePrompt: true
6080
+ });
6081
+ }
6082
+ }
6083
+ }
5653
6084
  if (sessionID && isAbortedMessageEvent(eventType, properties)) {
5654
6085
  const messageID = getMessageIDFromEvent(properties) ?? `${sessionID}:unknown`;
5655
6086
  const retryKey = `${sessionID}:${messageID}`;
@@ -5734,7 +6165,7 @@ function createEventHandler(state) {
5734
6165
  }
5735
6166
  }
5736
6167
  }
5737
- if (eventType === "session.error" && sessionID) {
6168
+ if ((eventType === "session.error" || eventType === "session.next.step.failed") && sessionID) {
5738
6169
  const managedSession = getManagedSession(state, sessionID) ?? await recoverUntrackedRootSessionForRetry(state, sessionID, error);
5739
6170
  const isRoot = managedSession?.kind === "root";
5740
6171
  const isChild = managedSession?.kind === "child";
@@ -5845,6 +6276,10 @@ function createEventHandler(state) {
5845
6276
  "session.deleted",
5846
6277
  "session.error",
5847
6278
  "session.compacted",
6279
+ "session.idle",
6280
+ "session.next.model.switched",
6281
+ "session.next.step.failed",
6282
+ "session.next.retried",
5848
6283
  "file.edited"
5849
6284
  ];
5850
6285
  if (significantEvents.includes(eventType)) {