@hueyexe/opencode-ensemble 0.13.3 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,19 +1,488 @@
1
1
  // @bun
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
2
4
  var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __toESM = (mod, isNodeMode, target) => {
8
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
9
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
+ for (let key of __getOwnPropNames(mod))
11
+ if (!__hasOwnProp.call(to, key))
12
+ __defProp(to, key, {
13
+ get: () => mod[key],
14
+ enumerable: true
15
+ });
16
+ return to;
17
+ };
18
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
7
19
  var __export = (target, all) => {
8
20
  for (var name in all)
9
21
  __defProp(target, name, {
10
22
  get: all[name],
11
23
  enumerable: true,
12
24
  configurable: true,
13
- set: __exportSetter.bind(all, name)
25
+ set: (newValue) => all[name] = () => newValue
14
26
  });
15
27
  };
16
28
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
29
+ var __require = import.meta.require;
30
+
31
+ // node_modules/isexe/windows.js
32
+ var require_windows = __commonJS((exports, module) => {
33
+ module.exports = isexe;
34
+ isexe.sync = sync;
35
+ var fs = __require("fs");
36
+ function checkPathExt(path, options) {
37
+ var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT;
38
+ if (!pathext) {
39
+ return true;
40
+ }
41
+ pathext = pathext.split(";");
42
+ if (pathext.indexOf("") !== -1) {
43
+ return true;
44
+ }
45
+ for (var i = 0;i < pathext.length; i++) {
46
+ var p = pathext[i].toLowerCase();
47
+ if (p && path.substr(-p.length).toLowerCase() === p) {
48
+ return true;
49
+ }
50
+ }
51
+ return false;
52
+ }
53
+ function checkStat(stat, path, options) {
54
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
55
+ return false;
56
+ }
57
+ return checkPathExt(path, options);
58
+ }
59
+ function isexe(path, options, cb) {
60
+ fs.stat(path, function(er, stat) {
61
+ cb(er, er ? false : checkStat(stat, path, options));
62
+ });
63
+ }
64
+ function sync(path, options) {
65
+ return checkStat(fs.statSync(path), path, options);
66
+ }
67
+ });
68
+
69
+ // node_modules/isexe/mode.js
70
+ var require_mode = __commonJS((exports, module) => {
71
+ module.exports = isexe;
72
+ isexe.sync = sync;
73
+ var fs = __require("fs");
74
+ function isexe(path, options, cb) {
75
+ fs.stat(path, function(er, stat) {
76
+ cb(er, er ? false : checkStat(stat, options));
77
+ });
78
+ }
79
+ function sync(path, options) {
80
+ return checkStat(fs.statSync(path), options);
81
+ }
82
+ function checkStat(stat, options) {
83
+ return stat.isFile() && checkMode(stat, options);
84
+ }
85
+ function checkMode(stat, options) {
86
+ var mod = stat.mode;
87
+ var uid = stat.uid;
88
+ var gid = stat.gid;
89
+ var myUid = options.uid !== undefined ? options.uid : process.getuid && process.getuid();
90
+ var myGid = options.gid !== undefined ? options.gid : process.getgid && process.getgid();
91
+ var u = parseInt("100", 8);
92
+ var g = parseInt("010", 8);
93
+ var o = parseInt("001", 8);
94
+ var ug = u | g;
95
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
96
+ return ret;
97
+ }
98
+ });
99
+
100
+ // node_modules/isexe/index.js
101
+ var require_isexe = __commonJS((exports, module) => {
102
+ var fs = __require("fs");
103
+ var core2;
104
+ if (process.platform === "win32" || global.TESTING_WINDOWS) {
105
+ core2 = require_windows();
106
+ } else {
107
+ core2 = require_mode();
108
+ }
109
+ module.exports = isexe;
110
+ isexe.sync = sync;
111
+ function isexe(path, options, cb) {
112
+ if (typeof options === "function") {
113
+ cb = options;
114
+ options = {};
115
+ }
116
+ if (!cb) {
117
+ if (typeof Promise !== "function") {
118
+ throw new TypeError("callback not provided");
119
+ }
120
+ return new Promise(function(resolve, reject) {
121
+ isexe(path, options || {}, function(er, is) {
122
+ if (er) {
123
+ reject(er);
124
+ } else {
125
+ resolve(is);
126
+ }
127
+ });
128
+ });
129
+ }
130
+ core2(path, options || {}, function(er, is) {
131
+ if (er) {
132
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
133
+ er = null;
134
+ is = false;
135
+ }
136
+ }
137
+ cb(er, is);
138
+ });
139
+ }
140
+ function sync(path, options) {
141
+ try {
142
+ return core2.sync(path, options || {});
143
+ } catch (er) {
144
+ if (options && options.ignoreErrors || er.code === "EACCES") {
145
+ return false;
146
+ } else {
147
+ throw er;
148
+ }
149
+ }
150
+ }
151
+ });
152
+
153
+ // node_modules/which/which.js
154
+ var require_which = __commonJS((exports, module) => {
155
+ var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
156
+ var path = __require("path");
157
+ var COLON = isWindows ? ";" : ":";
158
+ var isexe = require_isexe();
159
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
160
+ var getPathInfo = (cmd, opt) => {
161
+ const colon = opt.colon || COLON;
162
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
163
+ ...isWindows ? [process.cwd()] : [],
164
+ ...(opt.path || process.env.PATH || "").split(colon)
165
+ ];
166
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
167
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
168
+ if (isWindows) {
169
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
170
+ pathExt.unshift("");
171
+ }
172
+ return {
173
+ pathEnv,
174
+ pathExt,
175
+ pathExtExe
176
+ };
177
+ };
178
+ var which = (cmd, opt, cb) => {
179
+ if (typeof opt === "function") {
180
+ cb = opt;
181
+ opt = {};
182
+ }
183
+ if (!opt)
184
+ opt = {};
185
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
186
+ const found = [];
187
+ const step = (i) => new Promise((resolve, reject) => {
188
+ if (i === pathEnv.length)
189
+ return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
190
+ const ppRaw = pathEnv[i];
191
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
192
+ const pCmd = path.join(pathPart, cmd);
193
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
194
+ resolve(subStep(p, i, 0));
195
+ });
196
+ const subStep = (p, i, ii) => new Promise((resolve, reject) => {
197
+ if (ii === pathExt.length)
198
+ return resolve(step(i + 1));
199
+ const ext = pathExt[ii];
200
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
201
+ if (!er && is) {
202
+ if (opt.all)
203
+ found.push(p + ext);
204
+ else
205
+ return resolve(p + ext);
206
+ }
207
+ return resolve(subStep(p, i, ii + 1));
208
+ });
209
+ });
210
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
211
+ };
212
+ var whichSync = (cmd, opt) => {
213
+ opt = opt || {};
214
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
215
+ const found = [];
216
+ for (let i = 0;i < pathEnv.length; i++) {
217
+ const ppRaw = pathEnv[i];
218
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
219
+ const pCmd = path.join(pathPart, cmd);
220
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
221
+ for (let j = 0;j < pathExt.length; j++) {
222
+ const cur = p + pathExt[j];
223
+ try {
224
+ const is = isexe.sync(cur, { pathExt: pathExtExe });
225
+ if (is) {
226
+ if (opt.all)
227
+ found.push(cur);
228
+ else
229
+ return cur;
230
+ }
231
+ } catch (ex) {}
232
+ }
233
+ }
234
+ if (opt.all && found.length)
235
+ return found;
236
+ if (opt.nothrow)
237
+ return null;
238
+ throw getNotFoundError(cmd);
239
+ };
240
+ module.exports = which;
241
+ which.sync = whichSync;
242
+ });
243
+
244
+ // node_modules/path-key/index.js
245
+ var require_path_key = __commonJS((exports, module) => {
246
+ var pathKey = (options = {}) => {
247
+ const environment = options.env || process.env;
248
+ const platform = options.platform || process.platform;
249
+ if (platform !== "win32") {
250
+ return "PATH";
251
+ }
252
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
253
+ };
254
+ module.exports = pathKey;
255
+ module.exports.default = pathKey;
256
+ });
257
+
258
+ // node_modules/cross-spawn/lib/util/resolveCommand.js
259
+ var require_resolveCommand = __commonJS((exports, module) => {
260
+ var path = __require("path");
261
+ var which = require_which();
262
+ var getPathKey = require_path_key();
263
+ function resolveCommandAttempt(parsed, withoutPathExt) {
264
+ const env = parsed.options.env || process.env;
265
+ const cwd = process.cwd();
266
+ const hasCustomCwd = parsed.options.cwd != null;
267
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled;
268
+ if (shouldSwitchCwd) {
269
+ try {
270
+ process.chdir(parsed.options.cwd);
271
+ } catch (err) {}
272
+ }
273
+ let resolved;
274
+ try {
275
+ resolved = which.sync(parsed.command, {
276
+ path: env[getPathKey({ env })],
277
+ pathExt: withoutPathExt ? path.delimiter : undefined
278
+ });
279
+ } catch (e) {} finally {
280
+ if (shouldSwitchCwd) {
281
+ process.chdir(cwd);
282
+ }
283
+ }
284
+ if (resolved) {
285
+ resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
286
+ }
287
+ return resolved;
288
+ }
289
+ function resolveCommand(parsed) {
290
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
291
+ }
292
+ module.exports = resolveCommand;
293
+ });
294
+
295
+ // node_modules/cross-spawn/lib/util/escape.js
296
+ var require_escape = __commonJS((exports, module) => {
297
+ var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
298
+ function escapeCommand(arg) {
299
+ arg = arg.replace(metaCharsRegExp, "^$1");
300
+ return arg;
301
+ }
302
+ function escapeArgument(arg, doubleEscapeMetaChars) {
303
+ arg = `${arg}`;
304
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
305
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
306
+ arg = `"${arg}"`;
307
+ arg = arg.replace(metaCharsRegExp, "^$1");
308
+ if (doubleEscapeMetaChars) {
309
+ arg = arg.replace(metaCharsRegExp, "^$1");
310
+ }
311
+ return arg;
312
+ }
313
+ exports.command = escapeCommand;
314
+ exports.argument = escapeArgument;
315
+ });
316
+
317
+ // node_modules/shebang-regex/index.js
318
+ var require_shebang_regex = __commonJS((exports, module) => {
319
+ module.exports = /^#!(.*)/;
320
+ });
321
+
322
+ // node_modules/shebang-command/index.js
323
+ var require_shebang_command = __commonJS((exports, module) => {
324
+ var shebangRegex = require_shebang_regex();
325
+ module.exports = (string4 = "") => {
326
+ const match = string4.match(shebangRegex);
327
+ if (!match) {
328
+ return null;
329
+ }
330
+ const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
331
+ const binary = path.split("/").pop();
332
+ if (binary === "env") {
333
+ return argument;
334
+ }
335
+ return argument ? `${binary} ${argument}` : binary;
336
+ };
337
+ });
338
+
339
+ // node_modules/cross-spawn/lib/util/readShebang.js
340
+ var require_readShebang = __commonJS((exports, module) => {
341
+ var fs = __require("fs");
342
+ var shebangCommand = require_shebang_command();
343
+ function readShebang(command) {
344
+ const size = 150;
345
+ const buffer = Buffer.alloc(size);
346
+ let fd;
347
+ try {
348
+ fd = fs.openSync(command, "r");
349
+ fs.readSync(fd, buffer, 0, size, 0);
350
+ fs.closeSync(fd);
351
+ } catch (e) {}
352
+ return shebangCommand(buffer.toString());
353
+ }
354
+ module.exports = readShebang;
355
+ });
356
+
357
+ // node_modules/cross-spawn/lib/parse.js
358
+ var require_parse = __commonJS((exports, module) => {
359
+ var path = __require("path");
360
+ var resolveCommand = require_resolveCommand();
361
+ var escape = require_escape();
362
+ var readShebang = require_readShebang();
363
+ var isWin = process.platform === "win32";
364
+ var isExecutableRegExp = /\.(?:com|exe)$/i;
365
+ var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
366
+ function detectShebang(parsed) {
367
+ parsed.file = resolveCommand(parsed);
368
+ const shebang = parsed.file && readShebang(parsed.file);
369
+ if (shebang) {
370
+ parsed.args.unshift(parsed.file);
371
+ parsed.command = shebang;
372
+ return resolveCommand(parsed);
373
+ }
374
+ return parsed.file;
375
+ }
376
+ function parseNonShell(parsed) {
377
+ if (!isWin) {
378
+ return parsed;
379
+ }
380
+ const commandFile = detectShebang(parsed);
381
+ const needsShell = !isExecutableRegExp.test(commandFile);
382
+ if (parsed.options.forceShell || needsShell) {
383
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
384
+ parsed.command = path.normalize(parsed.command);
385
+ parsed.command = escape.command(parsed.command);
386
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
387
+ const shellCommand = [parsed.command].concat(parsed.args).join(" ");
388
+ parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
389
+ parsed.command = process.env.comspec || "cmd.exe";
390
+ parsed.options.windowsVerbatimArguments = true;
391
+ }
392
+ return parsed;
393
+ }
394
+ function parse5(command, args, options) {
395
+ if (args && !Array.isArray(args)) {
396
+ options = args;
397
+ args = null;
398
+ }
399
+ args = args ? args.slice(0) : [];
400
+ options = Object.assign({}, options);
401
+ const parsed = {
402
+ command,
403
+ args,
404
+ options,
405
+ file: undefined,
406
+ original: {
407
+ command,
408
+ args
409
+ }
410
+ };
411
+ return options.shell ? parsed : parseNonShell(parsed);
412
+ }
413
+ module.exports = parse5;
414
+ });
415
+
416
+ // node_modules/cross-spawn/lib/enoent.js
417
+ var require_enoent = __commonJS((exports, module) => {
418
+ var isWin = process.platform === "win32";
419
+ function notFoundError(original, syscall) {
420
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
421
+ code: "ENOENT",
422
+ errno: "ENOENT",
423
+ syscall: `${syscall} ${original.command}`,
424
+ path: original.command,
425
+ spawnargs: original.args
426
+ });
427
+ }
428
+ function hookChildProcess(cp, parsed) {
429
+ if (!isWin) {
430
+ return;
431
+ }
432
+ const originalEmit = cp.emit;
433
+ cp.emit = function(name, arg1) {
434
+ if (name === "exit") {
435
+ const err = verifyENOENT(arg1, parsed);
436
+ if (err) {
437
+ return originalEmit.call(cp, "error", err);
438
+ }
439
+ }
440
+ return originalEmit.apply(cp, arguments);
441
+ };
442
+ }
443
+ function verifyENOENT(status, parsed) {
444
+ if (isWin && status === 1 && !parsed.file) {
445
+ return notFoundError(parsed.original, "spawn");
446
+ }
447
+ return null;
448
+ }
449
+ function verifyENOENTSync(status, parsed) {
450
+ if (isWin && status === 1 && !parsed.file) {
451
+ return notFoundError(parsed.original, "spawnSync");
452
+ }
453
+ return null;
454
+ }
455
+ module.exports = {
456
+ hookChildProcess,
457
+ verifyENOENT,
458
+ verifyENOENTSync,
459
+ notFoundError
460
+ };
461
+ });
462
+
463
+ // node_modules/cross-spawn/index.js
464
+ var require_cross_spawn = __commonJS((exports, module) => {
465
+ var cp = __require("child_process");
466
+ var parse5 = require_parse();
467
+ var enoent = require_enoent();
468
+ function spawn(command, args, options) {
469
+ const parsed = parse5(command, args, options);
470
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
471
+ enoent.hookChildProcess(spawned, parsed);
472
+ return spawned;
473
+ }
474
+ function spawnSync(command, args, options) {
475
+ const parsed = parse5(command, args, options);
476
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
477
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
478
+ return result;
479
+ }
480
+ module.exports = spawn;
481
+ module.exports.spawn = spawn;
482
+ module.exports.sync = spawnSync;
483
+ module.exports._parse = parse5;
484
+ module.exports._enoent = enoent;
485
+ });
17
486
 
18
487
  // src/log.ts
19
488
  function initLog(client3) {
@@ -13287,6 +13756,94 @@ class HeyApiRegistry {
13287
13756
  }
13288
13757
  }
13289
13758
 
13759
+ class Auth extends HeyApiClient {
13760
+ remove(parameters, options) {
13761
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "providerID" }] }]);
13762
+ return (options?.client ?? this.client).delete({
13763
+ url: "/auth/{providerID}",
13764
+ ...options,
13765
+ ...params
13766
+ });
13767
+ }
13768
+ set(parameters, options) {
13769
+ const params = buildClientParams([parameters], [
13770
+ {
13771
+ args: [
13772
+ { in: "path", key: "providerID" },
13773
+ { key: "auth", map: "body" }
13774
+ ]
13775
+ }
13776
+ ]);
13777
+ return (options?.client ?? this.client).put({
13778
+ url: "/auth/{providerID}",
13779
+ ...options,
13780
+ ...params,
13781
+ headers: {
13782
+ "Content-Type": "application/json",
13783
+ ...options?.headers,
13784
+ ...params.headers
13785
+ }
13786
+ });
13787
+ }
13788
+ }
13789
+
13790
+ class App extends HeyApiClient {
13791
+ log(parameters, options) {
13792
+ const params = buildClientParams([parameters], [
13793
+ {
13794
+ args: [
13795
+ { in: "query", key: "directory" },
13796
+ { in: "query", key: "workspace" },
13797
+ { in: "body", key: "service" },
13798
+ { in: "body", key: "level" },
13799
+ { in: "body", key: "message" },
13800
+ { in: "body", key: "extra" }
13801
+ ]
13802
+ }
13803
+ ]);
13804
+ return (options?.client ?? this.client).post({
13805
+ url: "/log",
13806
+ ...options,
13807
+ ...params,
13808
+ headers: {
13809
+ "Content-Type": "application/json",
13810
+ ...options?.headers,
13811
+ ...params.headers
13812
+ }
13813
+ });
13814
+ }
13815
+ agents(parameters, options) {
13816
+ const params = buildClientParams([parameters], [
13817
+ {
13818
+ args: [
13819
+ { in: "query", key: "directory" },
13820
+ { in: "query", key: "workspace" }
13821
+ ]
13822
+ }
13823
+ ]);
13824
+ return (options?.client ?? this.client).get({
13825
+ url: "/agent",
13826
+ ...options,
13827
+ ...params
13828
+ });
13829
+ }
13830
+ skills(parameters, options) {
13831
+ const params = buildClientParams([parameters], [
13832
+ {
13833
+ args: [
13834
+ { in: "query", key: "directory" },
13835
+ { in: "query", key: "workspace" }
13836
+ ]
13837
+ }
13838
+ ]);
13839
+ return (options?.client ?? this.client).get({
13840
+ url: "/skill",
13841
+ ...options,
13842
+ ...params
13843
+ });
13844
+ }
13845
+ }
13846
+
13290
13847
  class Config extends HeyApiClient {
13291
13848
  get(options) {
13292
13849
  return (options?.client ?? this.client).get({
@@ -13347,39 +13904,26 @@ class Global extends HeyApiClient {
13347
13904
  }
13348
13905
  }
13349
13906
 
13350
- class Auth extends HeyApiClient {
13351
- remove(parameters, options) {
13352
- const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "providerID" }] }]);
13353
- return (options?.client ?? this.client).delete({
13354
- url: "/auth/{providerID}",
13355
- ...options,
13356
- ...params
13357
- });
13358
- }
13359
- set(parameters, options) {
13907
+ class Event extends HeyApiClient {
13908
+ subscribe(parameters, options) {
13360
13909
  const params = buildClientParams([parameters], [
13361
13910
  {
13362
13911
  args: [
13363
- { in: "path", key: "providerID" },
13364
- { key: "auth", map: "body" }
13912
+ { in: "query", key: "directory" },
13913
+ { in: "query", key: "workspace" }
13365
13914
  ]
13366
13915
  }
13367
13916
  ]);
13368
- return (options?.client ?? this.client).put({
13369
- url: "/auth/{providerID}",
13917
+ return (options?.client ?? this.client).sse.get({
13918
+ url: "/event",
13370
13919
  ...options,
13371
- ...params,
13372
- headers: {
13373
- "Content-Type": "application/json",
13374
- ...options?.headers,
13375
- ...params.headers
13376
- }
13920
+ ...params
13377
13921
  });
13378
13922
  }
13379
13923
  }
13380
13924
 
13381
- class Project extends HeyApiClient {
13382
- list(parameters, options) {
13925
+ class Config2 extends HeyApiClient {
13926
+ get(parameters, options) {
13383
13927
  const params = buildClientParams([parameters], [
13384
13928
  {
13385
13929
  args: [
@@ -13389,27 +13933,33 @@ class Project extends HeyApiClient {
13389
13933
  }
13390
13934
  ]);
13391
13935
  return (options?.client ?? this.client).get({
13392
- url: "/project",
13936
+ url: "/config",
13393
13937
  ...options,
13394
13938
  ...params
13395
13939
  });
13396
13940
  }
13397
- current(parameters, options) {
13941
+ update(parameters, options) {
13398
13942
  const params = buildClientParams([parameters], [
13399
13943
  {
13400
13944
  args: [
13401
13945
  { in: "query", key: "directory" },
13402
- { in: "query", key: "workspace" }
13946
+ { in: "query", key: "workspace" },
13947
+ { key: "config", map: "body" }
13403
13948
  ]
13404
13949
  }
13405
13950
  ]);
13406
- return (options?.client ?? this.client).get({
13407
- url: "/project/current",
13951
+ return (options?.client ?? this.client).patch({
13952
+ url: "/config",
13408
13953
  ...options,
13409
- ...params
13954
+ ...params,
13955
+ headers: {
13956
+ "Content-Type": "application/json",
13957
+ ...options?.headers,
13958
+ ...params.headers
13959
+ }
13410
13960
  });
13411
13961
  }
13412
- initGit(parameters, options) {
13962
+ providers(parameters, options) {
13413
13963
  const params = buildClientParams([parameters], [
13414
13964
  {
13415
13965
  args: [
@@ -13418,40 +13968,31 @@ class Project extends HeyApiClient {
13418
13968
  ]
13419
13969
  }
13420
13970
  ]);
13421
- return (options?.client ?? this.client).post({
13422
- url: "/project/git/init",
13971
+ return (options?.client ?? this.client).get({
13972
+ url: "/config/providers",
13423
13973
  ...options,
13424
13974
  ...params
13425
13975
  });
13426
13976
  }
13427
- update(parameters, options) {
13977
+ }
13978
+
13979
+ class Console extends HeyApiClient {
13980
+ get(parameters, options) {
13428
13981
  const params = buildClientParams([parameters], [
13429
13982
  {
13430
13983
  args: [
13431
- { in: "path", key: "projectID" },
13432
13984
  { in: "query", key: "directory" },
13433
- { in: "query", key: "workspace" },
13434
- { in: "body", key: "name" },
13435
- { in: "body", key: "icon" },
13436
- { in: "body", key: "commands" }
13985
+ { in: "query", key: "workspace" }
13437
13986
  ]
13438
13987
  }
13439
13988
  ]);
13440
- return (options?.client ?? this.client).patch({
13441
- url: "/project/{projectID}",
13989
+ return (options?.client ?? this.client).get({
13990
+ url: "/experimental/console",
13442
13991
  ...options,
13443
- ...params,
13444
- headers: {
13445
- "Content-Type": "application/json",
13446
- ...options?.headers,
13447
- ...params.headers
13448
- }
13992
+ ...params
13449
13993
  });
13450
13994
  }
13451
- }
13452
-
13453
- class Pty extends HeyApiClient {
13454
- list(parameters, options) {
13995
+ listOrgs(parameters, options) {
13455
13996
  const params = buildClientParams([parameters], [
13456
13997
  {
13457
13998
  args: [
@@ -13461,27 +14002,24 @@ class Pty extends HeyApiClient {
13461
14002
  }
13462
14003
  ]);
13463
14004
  return (options?.client ?? this.client).get({
13464
- url: "/pty",
14005
+ url: "/experimental/console/orgs",
13465
14006
  ...options,
13466
14007
  ...params
13467
14008
  });
13468
14009
  }
13469
- create(parameters, options) {
14010
+ switchOrg(parameters, options) {
13470
14011
  const params = buildClientParams([parameters], [
13471
14012
  {
13472
14013
  args: [
13473
14014
  { in: "query", key: "directory" },
13474
14015
  { in: "query", key: "workspace" },
13475
- { in: "body", key: "command" },
13476
- { in: "body", key: "args" },
13477
- { in: "body", key: "cwd" },
13478
- { in: "body", key: "title" },
13479
- { in: "body", key: "env" }
14016
+ { in: "body", key: "accountID" },
14017
+ { in: "body", key: "orgID" }
13480
14018
  ]
13481
14019
  }
13482
14020
  ]);
13483
14021
  return (options?.client ?? this.client).post({
13484
- url: "/pty",
14022
+ url: "/experimental/console/switch",
13485
14023
  ...options,
13486
14024
  ...params,
13487
14025
  headers: {
@@ -13491,81 +14029,70 @@ class Pty extends HeyApiClient {
13491
14029
  }
13492
14030
  });
13493
14031
  }
13494
- remove(parameters, options) {
14032
+ }
14033
+
14034
+ class Session extends HeyApiClient {
14035
+ list(parameters, options) {
13495
14036
  const params = buildClientParams([parameters], [
13496
14037
  {
13497
14038
  args: [
13498
- { in: "path", key: "ptyID" },
13499
14039
  { in: "query", key: "directory" },
13500
- { in: "query", key: "workspace" }
14040
+ { in: "query", key: "workspace" },
14041
+ { in: "query", key: "roots" },
14042
+ { in: "query", key: "start" },
14043
+ { in: "query", key: "cursor" },
14044
+ { in: "query", key: "search" },
14045
+ { in: "query", key: "limit" },
14046
+ { in: "query", key: "archived" }
13501
14047
  ]
13502
14048
  }
13503
14049
  ]);
13504
- return (options?.client ?? this.client).delete({
13505
- url: "/pty/{ptyID}",
14050
+ return (options?.client ?? this.client).get({
14051
+ url: "/experimental/session",
13506
14052
  ...options,
13507
14053
  ...params
13508
14054
  });
13509
14055
  }
13510
- get(parameters, options) {
14056
+ }
14057
+
14058
+ class Resource extends HeyApiClient {
14059
+ list(parameters, options) {
13511
14060
  const params = buildClientParams([parameters], [
13512
14061
  {
13513
14062
  args: [
13514
- { in: "path", key: "ptyID" },
13515
14063
  { in: "query", key: "directory" },
13516
14064
  { in: "query", key: "workspace" }
13517
14065
  ]
13518
14066
  }
13519
14067
  ]);
13520
14068
  return (options?.client ?? this.client).get({
13521
- url: "/pty/{ptyID}",
14069
+ url: "/experimental/resource",
13522
14070
  ...options,
13523
14071
  ...params
13524
14072
  });
13525
14073
  }
13526
- update(parameters, options) {
13527
- const params = buildClientParams([parameters], [
13528
- {
13529
- args: [
13530
- { in: "path", key: "ptyID" },
13531
- { in: "query", key: "directory" },
13532
- { in: "query", key: "workspace" },
13533
- { in: "body", key: "title" },
13534
- { in: "body", key: "size" }
13535
- ]
13536
- }
13537
- ]);
13538
- return (options?.client ?? this.client).put({
13539
- url: "/pty/{ptyID}",
13540
- ...options,
13541
- ...params,
13542
- headers: {
13543
- "Content-Type": "application/json",
13544
- ...options?.headers,
13545
- ...params.headers
13546
- }
13547
- });
13548
- }
13549
- connect(parameters, options) {
14074
+ }
14075
+
14076
+ class Adapter extends HeyApiClient {
14077
+ list(parameters, options) {
13550
14078
  const params = buildClientParams([parameters], [
13551
14079
  {
13552
14080
  args: [
13553
- { in: "path", key: "ptyID" },
13554
14081
  { in: "query", key: "directory" },
13555
14082
  { in: "query", key: "workspace" }
13556
14083
  ]
13557
14084
  }
13558
14085
  ]);
13559
14086
  return (options?.client ?? this.client).get({
13560
- url: "/pty/{ptyID}/connect",
14087
+ url: "/experimental/workspace/adapter",
13561
14088
  ...options,
13562
14089
  ...params
13563
14090
  });
13564
14091
  }
13565
14092
  }
13566
14093
 
13567
- class Config2 extends HeyApiClient {
13568
- get(parameters, options) {
14094
+ class Workspace extends HeyApiClient {
14095
+ list(parameters, options) {
13569
14096
  const params = buildClientParams([parameters], [
13570
14097
  {
13571
14098
  args: [
@@ -13575,23 +14102,26 @@ class Config2 extends HeyApiClient {
13575
14102
  }
13576
14103
  ]);
13577
14104
  return (options?.client ?? this.client).get({
13578
- url: "/config",
14105
+ url: "/experimental/workspace",
13579
14106
  ...options,
13580
14107
  ...params
13581
14108
  });
13582
14109
  }
13583
- update(parameters, options) {
14110
+ create(parameters, options) {
13584
14111
  const params = buildClientParams([parameters], [
13585
14112
  {
13586
14113
  args: [
13587
14114
  { in: "query", key: "directory" },
13588
14115
  { in: "query", key: "workspace" },
13589
- { key: "config", map: "body" }
14116
+ { in: "body", key: "id" },
14117
+ { in: "body", key: "type" },
14118
+ { in: "body", key: "branch" },
14119
+ { in: "body", key: "extra" }
13590
14120
  ]
13591
14121
  }
13592
14122
  ]);
13593
- return (options?.client ?? this.client).patch({
13594
- url: "/config",
14123
+ return (options?.client ?? this.client).post({
14124
+ url: "/experimental/workspace",
13595
14125
  ...options,
13596
14126
  ...params,
13597
14127
  headers: {
@@ -13601,7 +14131,7 @@ class Config2 extends HeyApiClient {
13601
14131
  }
13602
14132
  });
13603
14133
  }
13604
- providers(parameters, options) {
14134
+ syncList(parameters, options) {
13605
14135
  const params = buildClientParams([parameters], [
13606
14136
  {
13607
14137
  args: [
@@ -13610,16 +14140,13 @@ class Config2 extends HeyApiClient {
13610
14140
  ]
13611
14141
  }
13612
14142
  ]);
13613
- return (options?.client ?? this.client).get({
13614
- url: "/config/providers",
14143
+ return (options?.client ?? this.client).post({
14144
+ url: "/experimental/workspace/sync-list",
13615
14145
  ...options,
13616
14146
  ...params
13617
14147
  });
13618
14148
  }
13619
- }
13620
-
13621
- class Tool extends HeyApiClient {
13622
- ids(parameters, options) {
14149
+ status(parameters, options) {
13623
14150
  const params = buildClientParams([parameters], [
13624
14151
  {
13625
14152
  args: [
@@ -13629,61 +14156,41 @@ class Tool extends HeyApiClient {
13629
14156
  }
13630
14157
  ]);
13631
14158
  return (options?.client ?? this.client).get({
13632
- url: "/experimental/tool/ids",
13633
- ...options,
13634
- ...params
13635
- });
13636
- }
13637
- list(parameters, options) {
13638
- const params = buildClientParams([parameters], [
13639
- {
13640
- args: [
13641
- { in: "query", key: "directory" },
13642
- { in: "query", key: "workspace" },
13643
- { in: "query", key: "provider" },
13644
- { in: "query", key: "model" }
13645
- ]
13646
- }
13647
- ]);
13648
- return (options?.client ?? this.client).get({
13649
- url: "/experimental/tool",
14159
+ url: "/experimental/workspace/status",
13650
14160
  ...options,
13651
14161
  ...params
13652
14162
  });
13653
14163
  }
13654
- }
13655
-
13656
- class Workspace extends HeyApiClient {
13657
- list(parameters, options) {
14164
+ remove(parameters, options) {
13658
14165
  const params = buildClientParams([parameters], [
13659
14166
  {
13660
14167
  args: [
14168
+ { in: "path", key: "id" },
13661
14169
  { in: "query", key: "directory" },
13662
14170
  { in: "query", key: "workspace" }
13663
14171
  ]
13664
14172
  }
13665
14173
  ]);
13666
- return (options?.client ?? this.client).get({
13667
- url: "/experimental/workspace",
14174
+ return (options?.client ?? this.client).delete({
14175
+ url: "/experimental/workspace/{id}",
13668
14176
  ...options,
13669
14177
  ...params
13670
14178
  });
13671
14179
  }
13672
- create(parameters, options) {
14180
+ warp(parameters, options) {
13673
14181
  const params = buildClientParams([parameters], [
13674
14182
  {
13675
14183
  args: [
13676
14184
  { in: "query", key: "directory" },
13677
14185
  { in: "query", key: "workspace" },
13678
14186
  { in: "body", key: "id" },
13679
- { in: "body", key: "type" },
13680
- { in: "body", key: "branch" },
13681
- { in: "body", key: "extra" }
14187
+ { in: "body", key: "sessionID" },
14188
+ { in: "body", key: "copyChanges" }
13682
14189
  ]
13683
14190
  }
13684
14191
  ]);
13685
14192
  return (options?.client ?? this.client).post({
13686
- url: "/experimental/workspace",
14193
+ url: "/experimental/workspace/warp",
13687
14194
  ...options,
13688
14195
  ...params,
13689
14196
  headers: {
@@ -13693,50 +14200,50 @@ class Workspace extends HeyApiClient {
13693
14200
  }
13694
14201
  });
13695
14202
  }
13696
- remove(parameters, options) {
13697
- const params = buildClientParams([parameters], [
13698
- {
13699
- args: [
13700
- { in: "path", key: "id" },
13701
- { in: "query", key: "directory" },
13702
- { in: "query", key: "workspace" }
13703
- ]
13704
- }
13705
- ]);
13706
- return (options?.client ?? this.client).delete({
13707
- url: "/experimental/workspace/{id}",
13708
- ...options,
13709
- ...params
13710
- });
14203
+ _adapter;
14204
+ get adapter() {
14205
+ return this._adapter ??= new Adapter({ client: this.client });
13711
14206
  }
13712
14207
  }
13713
14208
 
13714
- class Session extends HeyApiClient {
14209
+ class Experimental extends HeyApiClient {
14210
+ _console;
14211
+ get console() {
14212
+ return this._console ??= new Console({ client: this.client });
14213
+ }
14214
+ _session;
14215
+ get session() {
14216
+ return this._session ??= new Session({ client: this.client });
14217
+ }
14218
+ _resource;
14219
+ get resource() {
14220
+ return this._resource ??= new Resource({ client: this.client });
14221
+ }
14222
+ _workspace;
14223
+ get workspace() {
14224
+ return this._workspace ??= new Workspace({ client: this.client });
14225
+ }
14226
+ }
14227
+
14228
+ class Tool extends HeyApiClient {
13715
14229
  list(parameters, options) {
13716
14230
  const params = buildClientParams([parameters], [
13717
14231
  {
13718
14232
  args: [
13719
14233
  { in: "query", key: "directory" },
13720
14234
  { in: "query", key: "workspace" },
13721
- { in: "query", key: "roots" },
13722
- { in: "query", key: "start" },
13723
- { in: "query", key: "cursor" },
13724
- { in: "query", key: "search" },
13725
- { in: "query", key: "limit" },
13726
- { in: "query", key: "archived" }
14235
+ { in: "query", key: "provider" },
14236
+ { in: "query", key: "model" }
13727
14237
  ]
13728
14238
  }
13729
14239
  ]);
13730
14240
  return (options?.client ?? this.client).get({
13731
- url: "/experimental/session",
14241
+ url: "/experimental/tool",
13732
14242
  ...options,
13733
14243
  ...params
13734
14244
  });
13735
14245
  }
13736
- }
13737
-
13738
- class Resource extends HeyApiClient {
13739
- list(parameters, options) {
14246
+ ids(parameters, options) {
13740
14247
  const params = buildClientParams([parameters], [
13741
14248
  {
13742
14249
  args: [
@@ -13746,28 +14253,13 @@ class Resource extends HeyApiClient {
13746
14253
  }
13747
14254
  ]);
13748
14255
  return (options?.client ?? this.client).get({
13749
- url: "/experimental/resource",
14256
+ url: "/experimental/tool/ids",
13750
14257
  ...options,
13751
14258
  ...params
13752
14259
  });
13753
14260
  }
13754
14261
  }
13755
14262
 
13756
- class Experimental extends HeyApiClient {
13757
- _workspace;
13758
- get workspace() {
13759
- return this._workspace ??= new Workspace({ client: this.client });
13760
- }
13761
- _session;
13762
- get session() {
13763
- return this._session ??= new Session({ client: this.client });
13764
- }
13765
- _resource;
13766
- get resource() {
13767
- return this._resource ??= new Resource({ client: this.client });
13768
- }
13769
- }
13770
-
13771
14263
  class Worktree extends HeyApiClient {
13772
14264
  remove(parameters, options) {
13773
14265
  const params = buildClientParams([parameters], [
@@ -13849,242 +14341,191 @@ class Worktree extends HeyApiClient {
13849
14341
  }
13850
14342
  }
13851
14343
 
13852
- class Session2 extends HeyApiClient {
13853
- list(parameters, options) {
14344
+ class Find extends HeyApiClient {
14345
+ text(parameters, options) {
13854
14346
  const params = buildClientParams([parameters], [
13855
14347
  {
13856
14348
  args: [
13857
14349
  { in: "query", key: "directory" },
13858
14350
  { in: "query", key: "workspace" },
13859
- { in: "query", key: "roots" },
13860
- { in: "query", key: "start" },
13861
- { in: "query", key: "search" },
13862
- { in: "query", key: "limit" }
14351
+ { in: "query", key: "pattern" }
13863
14352
  ]
13864
14353
  }
13865
14354
  ]);
13866
14355
  return (options?.client ?? this.client).get({
13867
- url: "/session",
14356
+ url: "/find",
13868
14357
  ...options,
13869
14358
  ...params
13870
14359
  });
13871
14360
  }
13872
- create(parameters, options) {
14361
+ files(parameters, options) {
13873
14362
  const params = buildClientParams([parameters], [
13874
14363
  {
13875
14364
  args: [
13876
14365
  { in: "query", key: "directory" },
13877
14366
  { in: "query", key: "workspace" },
13878
- { in: "body", key: "parentID" },
13879
- { in: "body", key: "title" },
13880
- { in: "body", key: "permission" },
13881
- { in: "body", key: "workspaceID" }
14367
+ { in: "query", key: "query" },
14368
+ { in: "query", key: "dirs" },
14369
+ { in: "query", key: "type" },
14370
+ { in: "query", key: "limit" }
13882
14371
  ]
13883
14372
  }
13884
14373
  ]);
13885
- return (options?.client ?? this.client).post({
13886
- url: "/session",
14374
+ return (options?.client ?? this.client).get({
14375
+ url: "/find/file",
13887
14376
  ...options,
13888
- ...params,
13889
- headers: {
13890
- "Content-Type": "application/json",
13891
- ...options?.headers,
13892
- ...params.headers
13893
- }
14377
+ ...params
13894
14378
  });
13895
14379
  }
13896
- status(parameters, options) {
14380
+ symbols(parameters, options) {
13897
14381
  const params = buildClientParams([parameters], [
13898
14382
  {
13899
14383
  args: [
13900
14384
  { in: "query", key: "directory" },
13901
- { in: "query", key: "workspace" }
14385
+ { in: "query", key: "workspace" },
14386
+ { in: "query", key: "query" }
13902
14387
  ]
13903
14388
  }
13904
14389
  ]);
13905
14390
  return (options?.client ?? this.client).get({
13906
- url: "/session/status",
14391
+ url: "/find/symbol",
13907
14392
  ...options,
13908
14393
  ...params
13909
14394
  });
13910
14395
  }
13911
- delete(parameters, options) {
14396
+ }
14397
+
14398
+ class File2 extends HeyApiClient {
14399
+ list(parameters, options) {
13912
14400
  const params = buildClientParams([parameters], [
13913
14401
  {
13914
14402
  args: [
13915
- { in: "path", key: "sessionID" },
13916
14403
  { in: "query", key: "directory" },
13917
- { in: "query", key: "workspace" }
13918
- ]
13919
- }
13920
- ]);
13921
- return (options?.client ?? this.client).delete({
13922
- url: "/session/{sessionID}",
13923
- ...options,
13924
- ...params
13925
- });
13926
- }
13927
- get(parameters, options) {
13928
- const params = buildClientParams([parameters], [
13929
- {
13930
- args: [
13931
- { in: "path", key: "sessionID" },
13932
- { in: "query", key: "directory" },
13933
- { in: "query", key: "workspace" }
14404
+ { in: "query", key: "workspace" },
14405
+ { in: "query", key: "path" }
13934
14406
  ]
13935
14407
  }
13936
14408
  ]);
13937
14409
  return (options?.client ?? this.client).get({
13938
- url: "/session/{sessionID}",
14410
+ url: "/file",
13939
14411
  ...options,
13940
14412
  ...params
13941
14413
  });
13942
14414
  }
13943
- update(parameters, options) {
14415
+ read(parameters, options) {
13944
14416
  const params = buildClientParams([parameters], [
13945
14417
  {
13946
14418
  args: [
13947
- { in: "path", key: "sessionID" },
13948
14419
  { in: "query", key: "directory" },
13949
14420
  { in: "query", key: "workspace" },
13950
- { in: "body", key: "title" },
13951
- { in: "body", key: "time" }
13952
- ]
13953
- }
13954
- ]);
13955
- return (options?.client ?? this.client).patch({
13956
- url: "/session/{sessionID}",
13957
- ...options,
13958
- ...params,
13959
- headers: {
13960
- "Content-Type": "application/json",
13961
- ...options?.headers,
13962
- ...params.headers
13963
- }
13964
- });
13965
- }
13966
- children(parameters, options) {
13967
- const params = buildClientParams([parameters], [
13968
- {
13969
- args: [
13970
- { in: "path", key: "sessionID" },
13971
- { in: "query", key: "directory" },
13972
- { in: "query", key: "workspace" }
14421
+ { in: "query", key: "path" }
13973
14422
  ]
13974
14423
  }
13975
14424
  ]);
13976
14425
  return (options?.client ?? this.client).get({
13977
- url: "/session/{sessionID}/children",
14426
+ url: "/file/content",
13978
14427
  ...options,
13979
14428
  ...params
13980
14429
  });
13981
14430
  }
13982
- todo(parameters, options) {
14431
+ status(parameters, options) {
13983
14432
  const params = buildClientParams([parameters], [
13984
14433
  {
13985
14434
  args: [
13986
- { in: "path", key: "sessionID" },
13987
14435
  { in: "query", key: "directory" },
13988
14436
  { in: "query", key: "workspace" }
13989
14437
  ]
13990
14438
  }
13991
14439
  ]);
13992
14440
  return (options?.client ?? this.client).get({
13993
- url: "/session/{sessionID}/todo",
14441
+ url: "/file/status",
13994
14442
  ...options,
13995
14443
  ...params
13996
14444
  });
13997
14445
  }
13998
- init(parameters, options) {
14446
+ }
14447
+
14448
+ class Instance extends HeyApiClient {
14449
+ dispose(parameters, options) {
13999
14450
  const params = buildClientParams([parameters], [
14000
14451
  {
14001
14452
  args: [
14002
- { in: "path", key: "sessionID" },
14003
14453
  { in: "query", key: "directory" },
14004
- { in: "query", key: "workspace" },
14005
- { in: "body", key: "modelID" },
14006
- { in: "body", key: "providerID" },
14007
- { in: "body", key: "messageID" }
14454
+ { in: "query", key: "workspace" }
14008
14455
  ]
14009
14456
  }
14010
14457
  ]);
14011
14458
  return (options?.client ?? this.client).post({
14012
- url: "/session/{sessionID}/init",
14459
+ url: "/instance/dispose",
14013
14460
  ...options,
14014
- ...params,
14015
- headers: {
14016
- "Content-Type": "application/json",
14017
- ...options?.headers,
14018
- ...params.headers
14019
- }
14461
+ ...params
14020
14462
  });
14021
14463
  }
14022
- fork(parameters, options) {
14464
+ }
14465
+
14466
+ class Path extends HeyApiClient {
14467
+ get(parameters, options) {
14023
14468
  const params = buildClientParams([parameters], [
14024
14469
  {
14025
14470
  args: [
14026
- { in: "path", key: "sessionID" },
14027
14471
  { in: "query", key: "directory" },
14028
- { in: "query", key: "workspace" },
14029
- { in: "body", key: "messageID" }
14472
+ { in: "query", key: "workspace" }
14030
14473
  ]
14031
14474
  }
14032
14475
  ]);
14033
- return (options?.client ?? this.client).post({
14034
- url: "/session/{sessionID}/fork",
14476
+ return (options?.client ?? this.client).get({
14477
+ url: "/path",
14035
14478
  ...options,
14036
- ...params,
14037
- headers: {
14038
- "Content-Type": "application/json",
14039
- ...options?.headers,
14040
- ...params.headers
14041
- }
14479
+ ...params
14042
14480
  });
14043
14481
  }
14044
- abort(parameters, options) {
14482
+ }
14483
+
14484
+ class Diff extends HeyApiClient {
14485
+ raw(parameters, options) {
14045
14486
  const params = buildClientParams([parameters], [
14046
14487
  {
14047
14488
  args: [
14048
- { in: "path", key: "sessionID" },
14049
14489
  { in: "query", key: "directory" },
14050
14490
  { in: "query", key: "workspace" }
14051
14491
  ]
14052
14492
  }
14053
14493
  ]);
14054
- return (options?.client ?? this.client).post({
14055
- url: "/session/{sessionID}/abort",
14494
+ return (options?.client ?? this.client).get({
14495
+ url: "/vcs/diff/raw",
14056
14496
  ...options,
14057
14497
  ...params
14058
14498
  });
14059
14499
  }
14060
- unshare(parameters, options) {
14500
+ }
14501
+
14502
+ class Vcs extends HeyApiClient {
14503
+ get(parameters, options) {
14061
14504
  const params = buildClientParams([parameters], [
14062
14505
  {
14063
14506
  args: [
14064
- { in: "path", key: "sessionID" },
14065
14507
  { in: "query", key: "directory" },
14066
14508
  { in: "query", key: "workspace" }
14067
14509
  ]
14068
14510
  }
14069
14511
  ]);
14070
- return (options?.client ?? this.client).delete({
14071
- url: "/session/{sessionID}/share",
14512
+ return (options?.client ?? this.client).get({
14513
+ url: "/vcs",
14072
14514
  ...options,
14073
14515
  ...params
14074
14516
  });
14075
14517
  }
14076
- share(parameters, options) {
14518
+ status(parameters, options) {
14077
14519
  const params = buildClientParams([parameters], [
14078
14520
  {
14079
14521
  args: [
14080
- { in: "path", key: "sessionID" },
14081
14522
  { in: "query", key: "directory" },
14082
14523
  { in: "query", key: "workspace" }
14083
14524
  ]
14084
14525
  }
14085
14526
  ]);
14086
- return (options?.client ?? this.client).post({
14087
- url: "/session/{sessionID}/share",
14527
+ return (options?.client ?? this.client).get({
14528
+ url: "/vcs/status",
14088
14529
  ...options,
14089
14530
  ...params
14090
14531
  });
@@ -14093,34 +14534,30 @@ class Session2 extends HeyApiClient {
14093
14534
  const params = buildClientParams([parameters], [
14094
14535
  {
14095
14536
  args: [
14096
- { in: "path", key: "sessionID" },
14097
14537
  { in: "query", key: "directory" },
14098
14538
  { in: "query", key: "workspace" },
14099
- { in: "query", key: "messageID" }
14539
+ { in: "query", key: "mode" }
14100
14540
  ]
14101
14541
  }
14102
14542
  ]);
14103
14543
  return (options?.client ?? this.client).get({
14104
- url: "/session/{sessionID}/diff",
14544
+ url: "/vcs/diff",
14105
14545
  ...options,
14106
14546
  ...params
14107
14547
  });
14108
14548
  }
14109
- summarize(parameters, options) {
14549
+ apply(parameters, options) {
14110
14550
  const params = buildClientParams([parameters], [
14111
14551
  {
14112
14552
  args: [
14113
- { in: "path", key: "sessionID" },
14114
14553
  { in: "query", key: "directory" },
14115
14554
  { in: "query", key: "workspace" },
14116
- { in: "body", key: "providerID" },
14117
- { in: "body", key: "modelID" },
14118
- { in: "body", key: "auto" }
14555
+ { in: "body", key: "patch" }
14119
14556
  ]
14120
14557
  }
14121
14558
  ]);
14122
14559
  return (options?.client ?? this.client).post({
14123
- url: "/session/{sessionID}/summarize",
14560
+ url: "/vcs/apply",
14124
14561
  ...options,
14125
14562
  ...params,
14126
14563
  headers: {
@@ -14130,137 +14567,112 @@ class Session2 extends HeyApiClient {
14130
14567
  }
14131
14568
  });
14132
14569
  }
14133
- messages(parameters, options) {
14570
+ _diff;
14571
+ get diff2() {
14572
+ return this._diff ??= new Diff({ client: this.client });
14573
+ }
14574
+ }
14575
+
14576
+ class Command extends HeyApiClient {
14577
+ list(parameters, options) {
14134
14578
  const params = buildClientParams([parameters], [
14135
14579
  {
14136
14580
  args: [
14137
- { in: "path", key: "sessionID" },
14138
14581
  { in: "query", key: "directory" },
14139
- { in: "query", key: "workspace" },
14140
- { in: "query", key: "limit" },
14141
- { in: "query", key: "before" }
14582
+ { in: "query", key: "workspace" }
14142
14583
  ]
14143
14584
  }
14144
14585
  ]);
14145
14586
  return (options?.client ?? this.client).get({
14146
- url: "/session/{sessionID}/message",
14587
+ url: "/command",
14147
14588
  ...options,
14148
14589
  ...params
14149
14590
  });
14150
14591
  }
14151
- prompt(parameters, options) {
14592
+ }
14593
+
14594
+ class Lsp extends HeyApiClient {
14595
+ status(parameters, options) {
14152
14596
  const params = buildClientParams([parameters], [
14153
14597
  {
14154
14598
  args: [
14155
- { in: "path", key: "sessionID" },
14156
14599
  { in: "query", key: "directory" },
14157
- { in: "query", key: "workspace" },
14158
- { in: "body", key: "messageID" },
14159
- { in: "body", key: "model" },
14160
- { in: "body", key: "agent" },
14161
- { in: "body", key: "noReply" },
14162
- { in: "body", key: "tools" },
14163
- { in: "body", key: "format" },
14164
- { in: "body", key: "system" },
14165
- { in: "body", key: "variant" },
14166
- { in: "body", key: "parts" }
14600
+ { in: "query", key: "workspace" }
14167
14601
  ]
14168
14602
  }
14169
14603
  ]);
14170
- return (options?.client ?? this.client).post({
14171
- url: "/session/{sessionID}/message",
14604
+ return (options?.client ?? this.client).get({
14605
+ url: "/lsp",
14172
14606
  ...options,
14173
- ...params,
14174
- headers: {
14175
- "Content-Type": "application/json",
14176
- ...options?.headers,
14177
- ...params.headers
14178
- }
14607
+ ...params
14179
14608
  });
14180
14609
  }
14181
- deleteMessage(parameters, options) {
14610
+ }
14611
+
14612
+ class Formatter extends HeyApiClient {
14613
+ status(parameters, options) {
14182
14614
  const params = buildClientParams([parameters], [
14183
14615
  {
14184
14616
  args: [
14185
- { in: "path", key: "sessionID" },
14186
- { in: "path", key: "messageID" },
14187
14617
  { in: "query", key: "directory" },
14188
14618
  { in: "query", key: "workspace" }
14189
14619
  ]
14190
14620
  }
14191
14621
  ]);
14192
- return (options?.client ?? this.client).delete({
14193
- url: "/session/{sessionID}/message/{messageID}",
14622
+ return (options?.client ?? this.client).get({
14623
+ url: "/formatter",
14194
14624
  ...options,
14195
14625
  ...params
14196
14626
  });
14197
14627
  }
14198
- message(parameters, options) {
14628
+ }
14629
+
14630
+ class Auth2 extends HeyApiClient {
14631
+ remove(parameters, options) {
14199
14632
  const params = buildClientParams([parameters], [
14200
14633
  {
14201
14634
  args: [
14202
- { in: "path", key: "sessionID" },
14203
- { in: "path", key: "messageID" },
14635
+ { in: "path", key: "name" },
14204
14636
  { in: "query", key: "directory" },
14205
14637
  { in: "query", key: "workspace" }
14206
14638
  ]
14207
14639
  }
14208
14640
  ]);
14209
- return (options?.client ?? this.client).get({
14210
- url: "/session/{sessionID}/message/{messageID}",
14641
+ return (options?.client ?? this.client).delete({
14642
+ url: "/mcp/{name}/auth",
14211
14643
  ...options,
14212
14644
  ...params
14213
14645
  });
14214
14646
  }
14215
- promptAsync(parameters, options) {
14647
+ start(parameters, options) {
14216
14648
  const params = buildClientParams([parameters], [
14217
14649
  {
14218
14650
  args: [
14219
- { in: "path", key: "sessionID" },
14651
+ { in: "path", key: "name" },
14220
14652
  { in: "query", key: "directory" },
14221
- { in: "query", key: "workspace" },
14222
- { in: "body", key: "messageID" },
14223
- { in: "body", key: "model" },
14224
- { in: "body", key: "agent" },
14225
- { in: "body", key: "noReply" },
14226
- { in: "body", key: "tools" },
14227
- { in: "body", key: "format" },
14228
- { in: "body", key: "system" },
14229
- { in: "body", key: "variant" },
14230
- { in: "body", key: "parts" }
14653
+ { in: "query", key: "workspace" }
14231
14654
  ]
14232
14655
  }
14233
14656
  ]);
14234
14657
  return (options?.client ?? this.client).post({
14235
- url: "/session/{sessionID}/prompt_async",
14658
+ url: "/mcp/{name}/auth",
14236
14659
  ...options,
14237
- ...params,
14238
- headers: {
14239
- "Content-Type": "application/json",
14240
- ...options?.headers,
14241
- ...params.headers
14242
- }
14660
+ ...params
14243
14661
  });
14244
14662
  }
14245
- command(parameters, options) {
14663
+ callback(parameters, options) {
14246
14664
  const params = buildClientParams([parameters], [
14247
14665
  {
14248
14666
  args: [
14249
- { in: "path", key: "sessionID" },
14667
+ { in: "path", key: "name" },
14250
14668
  { in: "query", key: "directory" },
14251
14669
  { in: "query", key: "workspace" },
14252
- { in: "body", key: "messageID" },
14253
- { in: "body", key: "agent" },
14254
- { in: "body", key: "model" },
14255
- { in: "body", key: "arguments" },
14256
- { in: "body", key: "command" },
14257
- { in: "body", key: "variant" },
14258
- { in: "body", key: "parts" }
14670
+ { in: "body", key: "code" }
14259
14671
  ]
14260
14672
  }
14261
14673
  ]);
14262
14674
  return (options?.client ?? this.client).post({
14263
- url: "/session/{sessionID}/command",
14675
+ url: "/mcp/{name}/auth/callback",
14264
14676
  ...options,
14265
14677
  ...params,
14266
14678
  headers: {
@@ -14270,44 +14682,53 @@ class Session2 extends HeyApiClient {
14270
14682
  }
14271
14683
  });
14272
14684
  }
14273
- shell(parameters, options) {
14685
+ authenticate(parameters, options) {
14274
14686
  const params = buildClientParams([parameters], [
14275
14687
  {
14276
14688
  args: [
14277
- { in: "path", key: "sessionID" },
14689
+ { in: "path", key: "name" },
14278
14690
  { in: "query", key: "directory" },
14279
- { in: "query", key: "workspace" },
14280
- { in: "body", key: "agent" },
14281
- { in: "body", key: "model" },
14282
- { in: "body", key: "command" }
14691
+ { in: "query", key: "workspace" }
14283
14692
  ]
14284
14693
  }
14285
14694
  ]);
14286
14695
  return (options?.client ?? this.client).post({
14287
- url: "/session/{sessionID}/shell",
14696
+ url: "/mcp/{name}/auth/authenticate",
14288
14697
  ...options,
14289
- ...params,
14290
- headers: {
14291
- "Content-Type": "application/json",
14292
- ...options?.headers,
14293
- ...params.headers
14294
- }
14698
+ ...params
14295
14699
  });
14296
14700
  }
14297
- revert(parameters, options) {
14701
+ }
14702
+
14703
+ class Mcp extends HeyApiClient {
14704
+ status(parameters, options) {
14298
14705
  const params = buildClientParams([parameters], [
14299
14706
  {
14300
14707
  args: [
14301
- { in: "path", key: "sessionID" },
14302
14708
  { in: "query", key: "directory" },
14303
- { in: "query", key: "workspace" },
14304
- { in: "body", key: "messageID" },
14305
- { in: "body", key: "partID" }
14709
+ { in: "query", key: "workspace" }
14710
+ ]
14711
+ }
14712
+ ]);
14713
+ return (options?.client ?? this.client).get({
14714
+ url: "/mcp",
14715
+ ...options,
14716
+ ...params
14717
+ });
14718
+ }
14719
+ add(parameters, options) {
14720
+ const params = buildClientParams([parameters], [
14721
+ {
14722
+ args: [
14723
+ { in: "query", key: "directory" },
14724
+ { in: "query", key: "workspace" },
14725
+ { in: "body", key: "name" },
14726
+ { in: "body", key: "config" }
14306
14727
  ]
14307
14728
  }
14308
14729
  ]);
14309
14730
  return (options?.client ?? this.client).post({
14310
- url: "/session/{sessionID}/revert",
14731
+ url: "/mcp",
14311
14732
  ...options,
14312
14733
  ...params,
14313
14734
  headers: {
@@ -14317,107 +14738,105 @@ class Session2 extends HeyApiClient {
14317
14738
  }
14318
14739
  });
14319
14740
  }
14320
- unrevert(parameters, options) {
14741
+ connect(parameters, options) {
14321
14742
  const params = buildClientParams([parameters], [
14322
14743
  {
14323
14744
  args: [
14324
- { in: "path", key: "sessionID" },
14745
+ { in: "path", key: "name" },
14325
14746
  { in: "query", key: "directory" },
14326
14747
  { in: "query", key: "workspace" }
14327
14748
  ]
14328
14749
  }
14329
14750
  ]);
14330
14751
  return (options?.client ?? this.client).post({
14331
- url: "/session/{sessionID}/unrevert",
14752
+ url: "/mcp/{name}/connect",
14753
+ ...options,
14754
+ ...params
14755
+ });
14756
+ }
14757
+ disconnect(parameters, options) {
14758
+ const params = buildClientParams([parameters], [
14759
+ {
14760
+ args: [
14761
+ { in: "path", key: "name" },
14762
+ { in: "query", key: "directory" },
14763
+ { in: "query", key: "workspace" }
14764
+ ]
14765
+ }
14766
+ ]);
14767
+ return (options?.client ?? this.client).post({
14768
+ url: "/mcp/{name}/disconnect",
14332
14769
  ...options,
14333
14770
  ...params
14334
14771
  });
14335
14772
  }
14773
+ _auth;
14774
+ get auth() {
14775
+ return this._auth ??= new Auth2({ client: this.client });
14776
+ }
14336
14777
  }
14337
14778
 
14338
- class Part extends HeyApiClient {
14339
- delete(parameters, options) {
14779
+ class Project extends HeyApiClient {
14780
+ list(parameters, options) {
14340
14781
  const params = buildClientParams([parameters], [
14341
14782
  {
14342
14783
  args: [
14343
- { in: "path", key: "sessionID" },
14344
- { in: "path", key: "messageID" },
14345
- { in: "path", key: "partID" },
14346
14784
  { in: "query", key: "directory" },
14347
14785
  { in: "query", key: "workspace" }
14348
14786
  ]
14349
14787
  }
14350
14788
  ]);
14351
- return (options?.client ?? this.client).delete({
14352
- url: "/session/{sessionID}/message/{messageID}/part/{partID}",
14789
+ return (options?.client ?? this.client).get({
14790
+ url: "/project",
14353
14791
  ...options,
14354
14792
  ...params
14355
14793
  });
14356
14794
  }
14357
- update(parameters, options) {
14795
+ current(parameters, options) {
14358
14796
  const params = buildClientParams([parameters], [
14359
14797
  {
14360
14798
  args: [
14361
- { in: "path", key: "sessionID" },
14362
- { in: "path", key: "messageID" },
14363
- { in: "path", key: "partID" },
14364
14799
  { in: "query", key: "directory" },
14365
- { in: "query", key: "workspace" },
14366
- { key: "part", map: "body" }
14800
+ { in: "query", key: "workspace" }
14367
14801
  ]
14368
14802
  }
14369
14803
  ]);
14370
- return (options?.client ?? this.client).patch({
14371
- url: "/session/{sessionID}/message/{messageID}/part/{partID}",
14804
+ return (options?.client ?? this.client).get({
14805
+ url: "/project/current",
14372
14806
  ...options,
14373
- ...params,
14374
- headers: {
14375
- "Content-Type": "application/json",
14376
- ...options?.headers,
14377
- ...params.headers
14378
- }
14807
+ ...params
14379
14808
  });
14380
14809
  }
14381
- }
14382
-
14383
- class Permission extends HeyApiClient {
14384
- respond(parameters, options) {
14810
+ initGit(parameters, options) {
14385
14811
  const params = buildClientParams([parameters], [
14386
14812
  {
14387
14813
  args: [
14388
- { in: "path", key: "sessionID" },
14389
- { in: "path", key: "permissionID" },
14390
14814
  { in: "query", key: "directory" },
14391
- { in: "query", key: "workspace" },
14392
- { in: "body", key: "response" }
14815
+ { in: "query", key: "workspace" }
14393
14816
  ]
14394
14817
  }
14395
14818
  ]);
14396
14819
  return (options?.client ?? this.client).post({
14397
- url: "/session/{sessionID}/permissions/{permissionID}",
14820
+ url: "/project/git/init",
14398
14821
  ...options,
14399
- ...params,
14400
- headers: {
14401
- "Content-Type": "application/json",
14402
- ...options?.headers,
14403
- ...params.headers
14404
- }
14822
+ ...params
14405
14823
  });
14406
14824
  }
14407
- reply(parameters, options) {
14825
+ update(parameters, options) {
14408
14826
  const params = buildClientParams([parameters], [
14409
14827
  {
14410
14828
  args: [
14411
- { in: "path", key: "requestID" },
14829
+ { in: "path", key: "projectID" },
14412
14830
  { in: "query", key: "directory" },
14413
14831
  { in: "query", key: "workspace" },
14414
- { in: "body", key: "reply" },
14415
- { in: "body", key: "message" }
14832
+ { in: "body", key: "name" },
14833
+ { in: "body", key: "icon" },
14834
+ { in: "body", key: "commands" }
14416
14835
  ]
14417
14836
  }
14418
14837
  ]);
14419
- return (options?.client ?? this.client).post({
14420
- url: "/permission/{requestID}/reply",
14838
+ return (options?.client ?? this.client).patch({
14839
+ url: "/project/{projectID}",
14421
14840
  ...options,
14422
14841
  ...params,
14423
14842
  headers: {
@@ -14427,7 +14846,10 @@ class Permission extends HeyApiClient {
14427
14846
  }
14428
14847
  });
14429
14848
  }
14430
- list(parameters, options) {
14849
+ }
14850
+
14851
+ class Pty extends HeyApiClient {
14852
+ shells(parameters, options) {
14431
14853
  const params = buildClientParams([parameters], [
14432
14854
  {
14433
14855
  args: [
@@ -14437,14 +14859,11 @@ class Permission extends HeyApiClient {
14437
14859
  }
14438
14860
  ]);
14439
14861
  return (options?.client ?? this.client).get({
14440
- url: "/permission",
14862
+ url: "/pty/shells",
14441
14863
  ...options,
14442
14864
  ...params
14443
14865
  });
14444
14866
  }
14445
- }
14446
-
14447
- class Question extends HeyApiClient {
14448
14867
  list(parameters, options) {
14449
14868
  const params = buildClientParams([parameters], [
14450
14869
  {
@@ -14455,24 +14874,27 @@ class Question extends HeyApiClient {
14455
14874
  }
14456
14875
  ]);
14457
14876
  return (options?.client ?? this.client).get({
14458
- url: "/question",
14877
+ url: "/pty",
14459
14878
  ...options,
14460
14879
  ...params
14461
14880
  });
14462
14881
  }
14463
- reply(parameters, options) {
14882
+ create(parameters, options) {
14464
14883
  const params = buildClientParams([parameters], [
14465
14884
  {
14466
14885
  args: [
14467
- { in: "path", key: "requestID" },
14468
14886
  { in: "query", key: "directory" },
14469
14887
  { in: "query", key: "workspace" },
14470
- { in: "body", key: "answers" }
14888
+ { in: "body", key: "command" },
14889
+ { in: "body", key: "args" },
14890
+ { in: "body", key: "cwd" },
14891
+ { in: "body", key: "title" },
14892
+ { in: "body", key: "env" }
14471
14893
  ]
14472
14894
  }
14473
14895
  ]);
14474
14896
  return (options?.client ?? this.client).post({
14475
- url: "/question/{requestID}/reply",
14897
+ url: "/pty",
14476
14898
  ...options,
14477
14899
  ...params,
14478
14900
  headers: {
@@ -14482,62 +14904,52 @@ class Question extends HeyApiClient {
14482
14904
  }
14483
14905
  });
14484
14906
  }
14485
- reject(parameters, options) {
14907
+ remove(parameters, options) {
14486
14908
  const params = buildClientParams([parameters], [
14487
14909
  {
14488
14910
  args: [
14489
- { in: "path", key: "requestID" },
14911
+ { in: "path", key: "ptyID" },
14490
14912
  { in: "query", key: "directory" },
14491
14913
  { in: "query", key: "workspace" }
14492
14914
  ]
14493
14915
  }
14494
14916
  ]);
14495
- return (options?.client ?? this.client).post({
14496
- url: "/question/{requestID}/reject",
14917
+ return (options?.client ?? this.client).delete({
14918
+ url: "/pty/{ptyID}",
14497
14919
  ...options,
14498
14920
  ...params
14499
14921
  });
14500
14922
  }
14501
- }
14502
-
14503
- class Oauth extends HeyApiClient {
14504
- authorize(parameters, options) {
14923
+ get(parameters, options) {
14505
14924
  const params = buildClientParams([parameters], [
14506
14925
  {
14507
14926
  args: [
14508
- { in: "path", key: "providerID" },
14927
+ { in: "path", key: "ptyID" },
14509
14928
  { in: "query", key: "directory" },
14510
- { in: "query", key: "workspace" },
14511
- { in: "body", key: "method" },
14512
- { in: "body", key: "inputs" }
14929
+ { in: "query", key: "workspace" }
14513
14930
  ]
14514
14931
  }
14515
14932
  ]);
14516
- return (options?.client ?? this.client).post({
14517
- url: "/provider/{providerID}/oauth/authorize",
14933
+ return (options?.client ?? this.client).get({
14934
+ url: "/pty/{ptyID}",
14518
14935
  ...options,
14519
- ...params,
14520
- headers: {
14521
- "Content-Type": "application/json",
14522
- ...options?.headers,
14523
- ...params.headers
14524
- }
14936
+ ...params
14525
14937
  });
14526
14938
  }
14527
- callback(parameters, options) {
14939
+ update(parameters, options) {
14528
14940
  const params = buildClientParams([parameters], [
14529
14941
  {
14530
14942
  args: [
14531
- { in: "path", key: "providerID" },
14943
+ { in: "path", key: "ptyID" },
14532
14944
  { in: "query", key: "directory" },
14533
14945
  { in: "query", key: "workspace" },
14534
- { in: "body", key: "method" },
14535
- { in: "body", key: "code" }
14946
+ { in: "body", key: "title" },
14947
+ { in: "body", key: "size" }
14536
14948
  ]
14537
14949
  }
14538
14950
  ]);
14539
- return (options?.client ?? this.client).post({
14540
- url: "/provider/{providerID}/oauth/callback",
14951
+ return (options?.client ?? this.client).put({
14952
+ url: "/pty/{ptyID}",
14541
14953
  ...options,
14542
14954
  ...params,
14543
14955
  headers: {
@@ -14547,151 +14959,211 @@ class Oauth extends HeyApiClient {
14547
14959
  }
14548
14960
  });
14549
14961
  }
14550
- }
14551
-
14552
- class Provider extends HeyApiClient {
14553
- list(parameters, options) {
14962
+ connectToken(parameters, options) {
14554
14963
  const params = buildClientParams([parameters], [
14555
14964
  {
14556
14965
  args: [
14966
+ { in: "path", key: "ptyID" },
14557
14967
  { in: "query", key: "directory" },
14558
14968
  { in: "query", key: "workspace" }
14559
14969
  ]
14560
14970
  }
14561
14971
  ]);
14562
- return (options?.client ?? this.client).get({
14563
- url: "/provider",
14972
+ return (options?.client ?? this.client).post({
14973
+ url: "/pty/{ptyID}/connect-token",
14564
14974
  ...options,
14565
14975
  ...params
14566
14976
  });
14567
14977
  }
14568
- auth(parameters, options) {
14978
+ connect(parameters, options) {
14569
14979
  const params = buildClientParams([parameters], [
14570
14980
  {
14571
14981
  args: [
14982
+ { in: "path", key: "ptyID" },
14572
14983
  { in: "query", key: "directory" },
14573
14984
  { in: "query", key: "workspace" }
14574
14985
  ]
14575
14986
  }
14576
14987
  ]);
14577
14988
  return (options?.client ?? this.client).get({
14578
- url: "/provider/auth",
14989
+ url: "/pty/{ptyID}/connect",
14579
14990
  ...options,
14580
14991
  ...params
14581
14992
  });
14582
14993
  }
14583
- _oauth;
14584
- get oauth() {
14585
- return this._oauth ??= new Oauth({ client: this.client });
14586
- }
14587
14994
  }
14588
14995
 
14589
- class Find extends HeyApiClient {
14590
- text(parameters, options) {
14996
+ class Question extends HeyApiClient {
14997
+ list(parameters, options) {
14591
14998
  const params = buildClientParams([parameters], [
14592
14999
  {
14593
15000
  args: [
14594
15001
  { in: "query", key: "directory" },
14595
- { in: "query", key: "workspace" },
14596
- { in: "query", key: "pattern" }
15002
+ { in: "query", key: "workspace" }
14597
15003
  ]
14598
15004
  }
14599
15005
  ]);
14600
15006
  return (options?.client ?? this.client).get({
14601
- url: "/find",
15007
+ url: "/question",
14602
15008
  ...options,
14603
15009
  ...params
14604
15010
  });
14605
15011
  }
14606
- files(parameters, options) {
15012
+ reply(parameters, options) {
14607
15013
  const params = buildClientParams([parameters], [
14608
15014
  {
14609
15015
  args: [
15016
+ { in: "path", key: "requestID" },
14610
15017
  { in: "query", key: "directory" },
14611
15018
  { in: "query", key: "workspace" },
14612
- { in: "query", key: "query" },
14613
- { in: "query", key: "dirs" },
14614
- { in: "query", key: "type" },
14615
- { in: "query", key: "limit" }
15019
+ { in: "body", key: "answers" }
14616
15020
  ]
14617
15021
  }
14618
15022
  ]);
14619
- return (options?.client ?? this.client).get({
14620
- url: "/find/file",
15023
+ return (options?.client ?? this.client).post({
15024
+ url: "/question/{requestID}/reply",
14621
15025
  ...options,
14622
- ...params
15026
+ ...params,
15027
+ headers: {
15028
+ "Content-Type": "application/json",
15029
+ ...options?.headers,
15030
+ ...params.headers
15031
+ }
14623
15032
  });
14624
15033
  }
14625
- symbols(parameters, options) {
15034
+ reject(parameters, options) {
14626
15035
  const params = buildClientParams([parameters], [
14627
15036
  {
14628
15037
  args: [
15038
+ { in: "path", key: "requestID" },
14629
15039
  { in: "query", key: "directory" },
14630
- { in: "query", key: "workspace" },
14631
- { in: "query", key: "query" }
15040
+ { in: "query", key: "workspace" }
14632
15041
  ]
14633
15042
  }
14634
15043
  ]);
14635
- return (options?.client ?? this.client).get({
14636
- url: "/find/symbol",
15044
+ return (options?.client ?? this.client).post({
15045
+ url: "/question/{requestID}/reject",
14637
15046
  ...options,
14638
15047
  ...params
14639
15048
  });
14640
15049
  }
14641
15050
  }
14642
15051
 
14643
- class File2 extends HeyApiClient {
15052
+ class Permission extends HeyApiClient {
14644
15053
  list(parameters, options) {
14645
15054
  const params = buildClientParams([parameters], [
14646
15055
  {
14647
15056
  args: [
14648
15057
  { in: "query", key: "directory" },
14649
- { in: "query", key: "workspace" },
14650
- { in: "query", key: "path" }
15058
+ { in: "query", key: "workspace" }
14651
15059
  ]
14652
15060
  }
14653
15061
  ]);
14654
15062
  return (options?.client ?? this.client).get({
14655
- url: "/file",
15063
+ url: "/permission",
14656
15064
  ...options,
14657
15065
  ...params
14658
15066
  });
14659
15067
  }
14660
- read(parameters, options) {
15068
+ reply(parameters, options) {
14661
15069
  const params = buildClientParams([parameters], [
14662
15070
  {
14663
15071
  args: [
15072
+ { in: "path", key: "requestID" },
14664
15073
  { in: "query", key: "directory" },
14665
15074
  { in: "query", key: "workspace" },
14666
- { in: "query", key: "path" }
15075
+ { in: "body", key: "reply" },
15076
+ { in: "body", key: "message" }
14667
15077
  ]
14668
15078
  }
14669
15079
  ]);
14670
- return (options?.client ?? this.client).get({
14671
- url: "/file/content",
15080
+ return (options?.client ?? this.client).post({
15081
+ url: "/permission/{requestID}/reply",
14672
15082
  ...options,
14673
- ...params
15083
+ ...params,
15084
+ headers: {
15085
+ "Content-Type": "application/json",
15086
+ ...options?.headers,
15087
+ ...params.headers
15088
+ }
14674
15089
  });
14675
15090
  }
14676
- status(parameters, options) {
15091
+ respond(parameters, options) {
14677
15092
  const params = buildClientParams([parameters], [
14678
15093
  {
14679
15094
  args: [
15095
+ { in: "path", key: "sessionID" },
15096
+ { in: "path", key: "permissionID" },
14680
15097
  { in: "query", key: "directory" },
14681
- { in: "query", key: "workspace" }
15098
+ { in: "query", key: "workspace" },
15099
+ { in: "body", key: "response" }
14682
15100
  ]
14683
15101
  }
14684
15102
  ]);
14685
- return (options?.client ?? this.client).get({
14686
- url: "/file/status",
15103
+ return (options?.client ?? this.client).post({
15104
+ url: "/session/{sessionID}/permissions/{permissionID}",
14687
15105
  ...options,
14688
- ...params
15106
+ ...params,
15107
+ headers: {
15108
+ "Content-Type": "application/json",
15109
+ ...options?.headers,
15110
+ ...params.headers
15111
+ }
14689
15112
  });
14690
15113
  }
14691
15114
  }
14692
15115
 
14693
- class Event extends HeyApiClient {
14694
- subscribe(parameters, options) {
15116
+ class Oauth extends HeyApiClient {
15117
+ authorize(parameters, options) {
15118
+ const params = buildClientParams([parameters], [
15119
+ {
15120
+ args: [
15121
+ { in: "path", key: "providerID" },
15122
+ { in: "query", key: "directory" },
15123
+ { in: "query", key: "workspace" },
15124
+ { in: "body", key: "method" },
15125
+ { in: "body", key: "inputs" }
15126
+ ]
15127
+ }
15128
+ ]);
15129
+ return (options?.client ?? this.client).post({
15130
+ url: "/provider/{providerID}/oauth/authorize",
15131
+ ...options,
15132
+ ...params,
15133
+ headers: {
15134
+ "Content-Type": "application/json",
15135
+ ...options?.headers,
15136
+ ...params.headers
15137
+ }
15138
+ });
15139
+ }
15140
+ callback(parameters, options) {
15141
+ const params = buildClientParams([parameters], [
15142
+ {
15143
+ args: [
15144
+ { in: "path", key: "providerID" },
15145
+ { in: "query", key: "directory" },
15146
+ { in: "query", key: "workspace" },
15147
+ { in: "body", key: "method" },
15148
+ { in: "body", key: "code" }
15149
+ ]
15150
+ }
15151
+ ]);
15152
+ return (options?.client ?? this.client).post({
15153
+ url: "/provider/{providerID}/oauth/callback",
15154
+ ...options,
15155
+ ...params,
15156
+ headers: {
15157
+ "Content-Type": "application/json",
15158
+ ...options?.headers,
15159
+ ...params.headers
15160
+ }
15161
+ });
15162
+ }
15163
+ }
15164
+
15165
+ class Provider extends HeyApiClient {
15166
+ list(parameters, options) {
14695
15167
  const params = buildClientParams([parameters], [
14696
15168
  {
14697
15169
  args: [
@@ -14700,60 +15172,631 @@ class Event extends HeyApiClient {
14700
15172
  ]
14701
15173
  }
14702
15174
  ]);
14703
- return (options?.client ?? this.client).sse.get({
14704
- url: "/event",
15175
+ return (options?.client ?? this.client).get({
15176
+ url: "/provider",
15177
+ ...options,
15178
+ ...params
15179
+ });
15180
+ }
15181
+ auth(parameters, options) {
15182
+ const params = buildClientParams([parameters], [
15183
+ {
15184
+ args: [
15185
+ { in: "query", key: "directory" },
15186
+ { in: "query", key: "workspace" }
15187
+ ]
15188
+ }
15189
+ ]);
15190
+ return (options?.client ?? this.client).get({
15191
+ url: "/provider/auth",
14705
15192
  ...options,
14706
15193
  ...params
14707
15194
  });
14708
15195
  }
15196
+ _oauth;
15197
+ get oauth() {
15198
+ return this._oauth ??= new Oauth({ client: this.client });
15199
+ }
14709
15200
  }
14710
15201
 
14711
- class Auth2 extends HeyApiClient {
14712
- remove(parameters, options) {
15202
+ class Session2 extends HeyApiClient {
15203
+ list(parameters, options) {
14713
15204
  const params = buildClientParams([parameters], [
14714
15205
  {
14715
15206
  args: [
14716
- { in: "path", key: "name" },
15207
+ { in: "query", key: "directory" },
15208
+ { in: "query", key: "workspace" },
15209
+ { in: "query", key: "scope" },
15210
+ { in: "query", key: "path" },
15211
+ { in: "query", key: "roots" },
15212
+ { in: "query", key: "start" },
15213
+ { in: "query", key: "search" },
15214
+ { in: "query", key: "limit" }
15215
+ ]
15216
+ }
15217
+ ]);
15218
+ return (options?.client ?? this.client).get({
15219
+ url: "/session",
15220
+ ...options,
15221
+ ...params
15222
+ });
15223
+ }
15224
+ create(parameters, options) {
15225
+ const params = buildClientParams([parameters], [
15226
+ {
15227
+ args: [
15228
+ { in: "query", key: "directory" },
15229
+ { in: "query", key: "workspace" },
15230
+ { in: "body", key: "parentID" },
15231
+ { in: "body", key: "title" },
15232
+ { in: "body", key: "agent" },
15233
+ { in: "body", key: "model" },
15234
+ { in: "body", key: "permission" },
15235
+ { in: "body", key: "workspaceID" }
15236
+ ]
15237
+ }
15238
+ ]);
15239
+ return (options?.client ?? this.client).post({
15240
+ url: "/session",
15241
+ ...options,
15242
+ ...params,
15243
+ headers: {
15244
+ "Content-Type": "application/json",
15245
+ ...options?.headers,
15246
+ ...params.headers
15247
+ }
15248
+ });
15249
+ }
15250
+ status(parameters, options) {
15251
+ const params = buildClientParams([parameters], [
15252
+ {
15253
+ args: [
15254
+ { in: "query", key: "directory" },
15255
+ { in: "query", key: "workspace" }
15256
+ ]
15257
+ }
15258
+ ]);
15259
+ return (options?.client ?? this.client).get({
15260
+ url: "/session/status",
15261
+ ...options,
15262
+ ...params
15263
+ });
15264
+ }
15265
+ delete(parameters, options) {
15266
+ const params = buildClientParams([parameters], [
15267
+ {
15268
+ args: [
15269
+ { in: "path", key: "sessionID" },
14717
15270
  { in: "query", key: "directory" },
14718
15271
  { in: "query", key: "workspace" }
14719
15272
  ]
14720
15273
  }
14721
15274
  ]);
14722
15275
  return (options?.client ?? this.client).delete({
14723
- url: "/mcp/{name}/auth",
15276
+ url: "/session/{sessionID}",
15277
+ ...options,
15278
+ ...params
15279
+ });
15280
+ }
15281
+ get(parameters, options) {
15282
+ const params = buildClientParams([parameters], [
15283
+ {
15284
+ args: [
15285
+ { in: "path", key: "sessionID" },
15286
+ { in: "query", key: "directory" },
15287
+ { in: "query", key: "workspace" }
15288
+ ]
15289
+ }
15290
+ ]);
15291
+ return (options?.client ?? this.client).get({
15292
+ url: "/session/{sessionID}",
15293
+ ...options,
15294
+ ...params
15295
+ });
15296
+ }
15297
+ update(parameters, options) {
15298
+ const params = buildClientParams([parameters], [
15299
+ {
15300
+ args: [
15301
+ { in: "path", key: "sessionID" },
15302
+ { in: "query", key: "directory" },
15303
+ { in: "query", key: "workspace" },
15304
+ { in: "body", key: "title" },
15305
+ { in: "body", key: "permission" },
15306
+ { in: "body", key: "time" }
15307
+ ]
15308
+ }
15309
+ ]);
15310
+ return (options?.client ?? this.client).patch({
15311
+ url: "/session/{sessionID}",
15312
+ ...options,
15313
+ ...params,
15314
+ headers: {
15315
+ "Content-Type": "application/json",
15316
+ ...options?.headers,
15317
+ ...params.headers
15318
+ }
15319
+ });
15320
+ }
15321
+ children(parameters, options) {
15322
+ const params = buildClientParams([parameters], [
15323
+ {
15324
+ args: [
15325
+ { in: "path", key: "sessionID" },
15326
+ { in: "query", key: "directory" },
15327
+ { in: "query", key: "workspace" }
15328
+ ]
15329
+ }
15330
+ ]);
15331
+ return (options?.client ?? this.client).get({
15332
+ url: "/session/{sessionID}/children",
15333
+ ...options,
15334
+ ...params
15335
+ });
15336
+ }
15337
+ todo(parameters, options) {
15338
+ const params = buildClientParams([parameters], [
15339
+ {
15340
+ args: [
15341
+ { in: "path", key: "sessionID" },
15342
+ { in: "query", key: "directory" },
15343
+ { in: "query", key: "workspace" }
15344
+ ]
15345
+ }
15346
+ ]);
15347
+ return (options?.client ?? this.client).get({
15348
+ url: "/session/{sessionID}/todo",
15349
+ ...options,
15350
+ ...params
15351
+ });
15352
+ }
15353
+ diff(parameters, options) {
15354
+ const params = buildClientParams([parameters], [
15355
+ {
15356
+ args: [
15357
+ { in: "path", key: "sessionID" },
15358
+ { in: "query", key: "directory" },
15359
+ { in: "query", key: "workspace" },
15360
+ { in: "query", key: "messageID" }
15361
+ ]
15362
+ }
15363
+ ]);
15364
+ return (options?.client ?? this.client).get({
15365
+ url: "/session/{sessionID}/diff",
14724
15366
  ...options,
14725
15367
  ...params
14726
15368
  });
14727
15369
  }
15370
+ messages(parameters, options) {
15371
+ const params = buildClientParams([parameters], [
15372
+ {
15373
+ args: [
15374
+ { in: "path", key: "sessionID" },
15375
+ { in: "query", key: "directory" },
15376
+ { in: "query", key: "workspace" },
15377
+ { in: "query", key: "limit" },
15378
+ { in: "query", key: "before" }
15379
+ ]
15380
+ }
15381
+ ]);
15382
+ return (options?.client ?? this.client).get({
15383
+ url: "/session/{sessionID}/message",
15384
+ ...options,
15385
+ ...params
15386
+ });
15387
+ }
15388
+ prompt(parameters, options) {
15389
+ const params = buildClientParams([parameters], [
15390
+ {
15391
+ args: [
15392
+ { in: "path", key: "sessionID" },
15393
+ { in: "query", key: "directory" },
15394
+ { in: "query", key: "workspace" },
15395
+ { in: "body", key: "messageID" },
15396
+ { in: "body", key: "model" },
15397
+ { in: "body", key: "agent" },
15398
+ { in: "body", key: "noReply" },
15399
+ { in: "body", key: "tools" },
15400
+ { in: "body", key: "format" },
15401
+ { in: "body", key: "system" },
15402
+ { in: "body", key: "variant" },
15403
+ { in: "body", key: "parts" }
15404
+ ]
15405
+ }
15406
+ ]);
15407
+ return (options?.client ?? this.client).post({
15408
+ url: "/session/{sessionID}/message",
15409
+ ...options,
15410
+ ...params,
15411
+ headers: {
15412
+ "Content-Type": "application/json",
15413
+ ...options?.headers,
15414
+ ...params.headers
15415
+ }
15416
+ });
15417
+ }
15418
+ deleteMessage(parameters, options) {
15419
+ const params = buildClientParams([parameters], [
15420
+ {
15421
+ args: [
15422
+ { in: "path", key: "sessionID" },
15423
+ { in: "path", key: "messageID" },
15424
+ { in: "query", key: "directory" },
15425
+ { in: "query", key: "workspace" }
15426
+ ]
15427
+ }
15428
+ ]);
15429
+ return (options?.client ?? this.client).delete({
15430
+ url: "/session/{sessionID}/message/{messageID}",
15431
+ ...options,
15432
+ ...params
15433
+ });
15434
+ }
15435
+ message(parameters, options) {
15436
+ const params = buildClientParams([parameters], [
15437
+ {
15438
+ args: [
15439
+ { in: "path", key: "sessionID" },
15440
+ { in: "path", key: "messageID" },
15441
+ { in: "query", key: "directory" },
15442
+ { in: "query", key: "workspace" }
15443
+ ]
15444
+ }
15445
+ ]);
15446
+ return (options?.client ?? this.client).get({
15447
+ url: "/session/{sessionID}/message/{messageID}",
15448
+ ...options,
15449
+ ...params
15450
+ });
15451
+ }
15452
+ fork(parameters, options) {
15453
+ const params = buildClientParams([parameters], [
15454
+ {
15455
+ args: [
15456
+ { in: "path", key: "sessionID" },
15457
+ { in: "query", key: "directory" },
15458
+ { in: "query", key: "workspace" },
15459
+ { in: "body", key: "messageID" }
15460
+ ]
15461
+ }
15462
+ ]);
15463
+ return (options?.client ?? this.client).post({
15464
+ url: "/session/{sessionID}/fork",
15465
+ ...options,
15466
+ ...params,
15467
+ headers: {
15468
+ "Content-Type": "application/json",
15469
+ ...options?.headers,
15470
+ ...params.headers
15471
+ }
15472
+ });
15473
+ }
15474
+ abort(parameters, options) {
15475
+ const params = buildClientParams([parameters], [
15476
+ {
15477
+ args: [
15478
+ { in: "path", key: "sessionID" },
15479
+ { in: "query", key: "directory" },
15480
+ { in: "query", key: "workspace" }
15481
+ ]
15482
+ }
15483
+ ]);
15484
+ return (options?.client ?? this.client).post({
15485
+ url: "/session/{sessionID}/abort",
15486
+ ...options,
15487
+ ...params
15488
+ });
15489
+ }
15490
+ init(parameters, options) {
15491
+ const params = buildClientParams([parameters], [
15492
+ {
15493
+ args: [
15494
+ { in: "path", key: "sessionID" },
15495
+ { in: "query", key: "directory" },
15496
+ { in: "query", key: "workspace" },
15497
+ { in: "body", key: "modelID" },
15498
+ { in: "body", key: "providerID" },
15499
+ { in: "body", key: "messageID" }
15500
+ ]
15501
+ }
15502
+ ]);
15503
+ return (options?.client ?? this.client).post({
15504
+ url: "/session/{sessionID}/init",
15505
+ ...options,
15506
+ ...params,
15507
+ headers: {
15508
+ "Content-Type": "application/json",
15509
+ ...options?.headers,
15510
+ ...params.headers
15511
+ }
15512
+ });
15513
+ }
15514
+ unshare(parameters, options) {
15515
+ const params = buildClientParams([parameters], [
15516
+ {
15517
+ args: [
15518
+ { in: "path", key: "sessionID" },
15519
+ { in: "query", key: "directory" },
15520
+ { in: "query", key: "workspace" }
15521
+ ]
15522
+ }
15523
+ ]);
15524
+ return (options?.client ?? this.client).delete({
15525
+ url: "/session/{sessionID}/share",
15526
+ ...options,
15527
+ ...params
15528
+ });
15529
+ }
15530
+ share(parameters, options) {
15531
+ const params = buildClientParams([parameters], [
15532
+ {
15533
+ args: [
15534
+ { in: "path", key: "sessionID" },
15535
+ { in: "query", key: "directory" },
15536
+ { in: "query", key: "workspace" }
15537
+ ]
15538
+ }
15539
+ ]);
15540
+ return (options?.client ?? this.client).post({
15541
+ url: "/session/{sessionID}/share",
15542
+ ...options,
15543
+ ...params
15544
+ });
15545
+ }
15546
+ summarize(parameters, options) {
15547
+ const params = buildClientParams([parameters], [
15548
+ {
15549
+ args: [
15550
+ { in: "path", key: "sessionID" },
15551
+ { in: "query", key: "directory" },
15552
+ { in: "query", key: "workspace" },
15553
+ { in: "body", key: "providerID" },
15554
+ { in: "body", key: "modelID" },
15555
+ { in: "body", key: "auto" }
15556
+ ]
15557
+ }
15558
+ ]);
15559
+ return (options?.client ?? this.client).post({
15560
+ url: "/session/{sessionID}/summarize",
15561
+ ...options,
15562
+ ...params,
15563
+ headers: {
15564
+ "Content-Type": "application/json",
15565
+ ...options?.headers,
15566
+ ...params.headers
15567
+ }
15568
+ });
15569
+ }
15570
+ promptAsync(parameters, options) {
15571
+ const params = buildClientParams([parameters], [
15572
+ {
15573
+ args: [
15574
+ { in: "path", key: "sessionID" },
15575
+ { in: "query", key: "directory" },
15576
+ { in: "query", key: "workspace" },
15577
+ { in: "body", key: "messageID" },
15578
+ { in: "body", key: "model" },
15579
+ { in: "body", key: "agent" },
15580
+ { in: "body", key: "noReply" },
15581
+ { in: "body", key: "tools" },
15582
+ { in: "body", key: "format" },
15583
+ { in: "body", key: "system" },
15584
+ { in: "body", key: "variant" },
15585
+ { in: "body", key: "parts" }
15586
+ ]
15587
+ }
15588
+ ]);
15589
+ return (options?.client ?? this.client).post({
15590
+ url: "/session/{sessionID}/prompt_async",
15591
+ ...options,
15592
+ ...params,
15593
+ headers: {
15594
+ "Content-Type": "application/json",
15595
+ ...options?.headers,
15596
+ ...params.headers
15597
+ }
15598
+ });
15599
+ }
15600
+ command(parameters, options) {
15601
+ const params = buildClientParams([parameters], [
15602
+ {
15603
+ args: [
15604
+ { in: "path", key: "sessionID" },
15605
+ { in: "query", key: "directory" },
15606
+ { in: "query", key: "workspace" },
15607
+ { in: "body", key: "messageID" },
15608
+ { in: "body", key: "agent" },
15609
+ { in: "body", key: "model" },
15610
+ { in: "body", key: "arguments" },
15611
+ { in: "body", key: "command" },
15612
+ { in: "body", key: "variant" },
15613
+ { in: "body", key: "parts" }
15614
+ ]
15615
+ }
15616
+ ]);
15617
+ return (options?.client ?? this.client).post({
15618
+ url: "/session/{sessionID}/command",
15619
+ ...options,
15620
+ ...params,
15621
+ headers: {
15622
+ "Content-Type": "application/json",
15623
+ ...options?.headers,
15624
+ ...params.headers
15625
+ }
15626
+ });
15627
+ }
15628
+ shell(parameters, options) {
15629
+ const params = buildClientParams([parameters], [
15630
+ {
15631
+ args: [
15632
+ { in: "path", key: "sessionID" },
15633
+ { in: "query", key: "directory" },
15634
+ { in: "query", key: "workspace" },
15635
+ { in: "body", key: "messageID" },
15636
+ { in: "body", key: "agent" },
15637
+ { in: "body", key: "model" },
15638
+ { in: "body", key: "command" }
15639
+ ]
15640
+ }
15641
+ ]);
15642
+ return (options?.client ?? this.client).post({
15643
+ url: "/session/{sessionID}/shell",
15644
+ ...options,
15645
+ ...params,
15646
+ headers: {
15647
+ "Content-Type": "application/json",
15648
+ ...options?.headers,
15649
+ ...params.headers
15650
+ }
15651
+ });
15652
+ }
15653
+ revert(parameters, options) {
15654
+ const params = buildClientParams([parameters], [
15655
+ {
15656
+ args: [
15657
+ { in: "path", key: "sessionID" },
15658
+ { in: "query", key: "directory" },
15659
+ { in: "query", key: "workspace" },
15660
+ { in: "body", key: "messageID" },
15661
+ { in: "body", key: "partID" }
15662
+ ]
15663
+ }
15664
+ ]);
15665
+ return (options?.client ?? this.client).post({
15666
+ url: "/session/{sessionID}/revert",
15667
+ ...options,
15668
+ ...params,
15669
+ headers: {
15670
+ "Content-Type": "application/json",
15671
+ ...options?.headers,
15672
+ ...params.headers
15673
+ }
15674
+ });
15675
+ }
15676
+ unrevert(parameters, options) {
15677
+ const params = buildClientParams([parameters], [
15678
+ {
15679
+ args: [
15680
+ { in: "path", key: "sessionID" },
15681
+ { in: "query", key: "directory" },
15682
+ { in: "query", key: "workspace" }
15683
+ ]
15684
+ }
15685
+ ]);
15686
+ return (options?.client ?? this.client).post({
15687
+ url: "/session/{sessionID}/unrevert",
15688
+ ...options,
15689
+ ...params
15690
+ });
15691
+ }
15692
+ }
15693
+
15694
+ class Part extends HeyApiClient {
15695
+ delete(parameters, options) {
15696
+ const params = buildClientParams([parameters], [
15697
+ {
15698
+ args: [
15699
+ { in: "path", key: "sessionID" },
15700
+ { in: "path", key: "messageID" },
15701
+ { in: "path", key: "partID" },
15702
+ { in: "query", key: "directory" },
15703
+ { in: "query", key: "workspace" }
15704
+ ]
15705
+ }
15706
+ ]);
15707
+ return (options?.client ?? this.client).delete({
15708
+ url: "/session/{sessionID}/message/{messageID}/part/{partID}",
15709
+ ...options,
15710
+ ...params
15711
+ });
15712
+ }
15713
+ update(parameters, options) {
15714
+ const params = buildClientParams([parameters], [
15715
+ {
15716
+ args: [
15717
+ { in: "path", key: "sessionID" },
15718
+ { in: "path", key: "messageID" },
15719
+ { in: "path", key: "partID" },
15720
+ { in: "query", key: "directory" },
15721
+ { in: "query", key: "workspace" },
15722
+ { key: "part", map: "body" }
15723
+ ]
15724
+ }
15725
+ ]);
15726
+ return (options?.client ?? this.client).patch({
15727
+ url: "/session/{sessionID}/message/{messageID}/part/{partID}",
15728
+ ...options,
15729
+ ...params,
15730
+ headers: {
15731
+ "Content-Type": "application/json",
15732
+ ...options?.headers,
15733
+ ...params.headers
15734
+ }
15735
+ });
15736
+ }
15737
+ }
15738
+
15739
+ class History extends HeyApiClient {
15740
+ list(parameters, options) {
15741
+ const params = buildClientParams([parameters], [
15742
+ {
15743
+ args: [
15744
+ { in: "query", key: "directory" },
15745
+ { in: "query", key: "workspace" },
15746
+ { key: "body", map: "body" }
15747
+ ]
15748
+ }
15749
+ ]);
15750
+ return (options?.client ?? this.client).post({
15751
+ url: "/sync/history",
15752
+ ...options,
15753
+ ...params,
15754
+ headers: {
15755
+ "Content-Type": "application/json",
15756
+ ...options?.headers,
15757
+ ...params.headers
15758
+ }
15759
+ });
15760
+ }
15761
+ }
15762
+
15763
+ class Sync extends HeyApiClient {
14728
15764
  start(parameters, options) {
14729
15765
  const params = buildClientParams([parameters], [
14730
15766
  {
14731
15767
  args: [
14732
- { in: "path", key: "name" },
14733
15768
  { in: "query", key: "directory" },
14734
15769
  { in: "query", key: "workspace" }
14735
15770
  ]
14736
15771
  }
14737
15772
  ]);
14738
15773
  return (options?.client ?? this.client).post({
14739
- url: "/mcp/{name}/auth",
15774
+ url: "/sync/start",
14740
15775
  ...options,
14741
15776
  ...params
14742
15777
  });
14743
15778
  }
14744
- callback(parameters, options) {
15779
+ replay(parameters, options) {
14745
15780
  const params = buildClientParams([parameters], [
14746
15781
  {
14747
15782
  args: [
14748
- { in: "path", key: "name" },
14749
- { in: "query", key: "directory" },
15783
+ {
15784
+ in: "query",
15785
+ key: "query_directory",
15786
+ map: "directory"
15787
+ },
14750
15788
  { in: "query", key: "workspace" },
14751
- { in: "body", key: "code" }
15789
+ {
15790
+ in: "body",
15791
+ key: "body_directory",
15792
+ map: "directory"
15793
+ },
15794
+ { in: "body", key: "events" }
14752
15795
  ]
14753
15796
  }
14754
15797
  ]);
14755
15798
  return (options?.client ?? this.client).post({
14756
- url: "/mcp/{name}/auth/callback",
15799
+ url: "/sync/replay",
14757
15800
  ...options,
14758
15801
  ...params,
14759
15802
  headers: {
@@ -14763,26 +15806,35 @@ class Auth2 extends HeyApiClient {
14763
15806
  }
14764
15807
  });
14765
15808
  }
14766
- authenticate(parameters, options) {
15809
+ steal(parameters, options) {
14767
15810
  const params = buildClientParams([parameters], [
14768
15811
  {
14769
15812
  args: [
14770
- { in: "path", key: "name" },
14771
15813
  { in: "query", key: "directory" },
14772
- { in: "query", key: "workspace" }
15814
+ { in: "query", key: "workspace" },
15815
+ { in: "body", key: "sessionID" }
14773
15816
  ]
14774
15817
  }
14775
15818
  ]);
14776
15819
  return (options?.client ?? this.client).post({
14777
- url: "/mcp/{name}/auth/authenticate",
15820
+ url: "/sync/steal",
14778
15821
  ...options,
14779
- ...params
15822
+ ...params,
15823
+ headers: {
15824
+ "Content-Type": "application/json",
15825
+ ...options?.headers,
15826
+ ...params.headers
15827
+ }
14780
15828
  });
14781
15829
  }
15830
+ _history;
15831
+ get history() {
15832
+ return this._history ??= new History({ client: this.client });
15833
+ }
14782
15834
  }
14783
15835
 
14784
- class Mcp extends HeyApiClient {
14785
- status(parameters, options) {
15836
+ class Session3 extends HeyApiClient {
15837
+ list(parameters, options) {
14786
15838
  const params = buildClientParams([parameters], [
14787
15839
  {
14788
15840
  args: [
@@ -14792,24 +15844,25 @@ class Mcp extends HeyApiClient {
14792
15844
  }
14793
15845
  ]);
14794
15846
  return (options?.client ?? this.client).get({
14795
- url: "/mcp",
15847
+ url: "/api/session",
14796
15848
  ...options,
14797
15849
  ...params
14798
15850
  });
14799
15851
  }
14800
- add(parameters, options) {
15852
+ prompt(parameters, options) {
14801
15853
  const params = buildClientParams([parameters], [
14802
15854
  {
14803
15855
  args: [
15856
+ { in: "path", key: "sessionID" },
14804
15857
  { in: "query", key: "directory" },
14805
15858
  { in: "query", key: "workspace" },
14806
- { in: "body", key: "name" },
14807
- { in: "body", key: "config" }
15859
+ { in: "body", key: "prompt" },
15860
+ { in: "body", key: "delivery" }
14808
15861
  ]
14809
15862
  }
14810
15863
  ]);
14811
15864
  return (options?.client ?? this.client).post({
14812
- url: "/mcp",
15865
+ url: "/api/session/{sessionID}/prompt",
14813
15866
  ...options,
14814
15867
  ...params,
14815
15868
  headers: {
@@ -14819,41 +15872,76 @@ class Mcp extends HeyApiClient {
14819
15872
  }
14820
15873
  });
14821
15874
  }
14822
- connect(parameters, options) {
15875
+ compact(parameters, options) {
14823
15876
  const params = buildClientParams([parameters], [
14824
15877
  {
14825
15878
  args: [
14826
- { in: "path", key: "name" },
15879
+ { in: "path", key: "sessionID" },
14827
15880
  { in: "query", key: "directory" },
14828
15881
  { in: "query", key: "workspace" }
14829
15882
  ]
14830
15883
  }
14831
15884
  ]);
14832
15885
  return (options?.client ?? this.client).post({
14833
- url: "/mcp/{name}/connect",
15886
+ url: "/api/session/{sessionID}/compact",
14834
15887
  ...options,
14835
15888
  ...params
14836
15889
  });
14837
15890
  }
14838
- disconnect(parameters, options) {
15891
+ wait(parameters, options) {
14839
15892
  const params = buildClientParams([parameters], [
14840
15893
  {
14841
15894
  args: [
14842
- { in: "path", key: "name" },
15895
+ { in: "path", key: "sessionID" },
14843
15896
  { in: "query", key: "directory" },
14844
15897
  { in: "query", key: "workspace" }
14845
15898
  ]
14846
15899
  }
14847
15900
  ]);
14848
15901
  return (options?.client ?? this.client).post({
14849
- url: "/mcp/{name}/disconnect",
15902
+ url: "/api/session/{sessionID}/wait",
14850
15903
  ...options,
14851
15904
  ...params
14852
15905
  });
14853
15906
  }
14854
- _auth;
14855
- get auth() {
14856
- return this._auth ??= new Auth2({ client: this.client });
15907
+ context(parameters, options) {
15908
+ const params = buildClientParams([parameters], [
15909
+ {
15910
+ args: [
15911
+ { in: "path", key: "sessionID" },
15912
+ { in: "query", key: "directory" },
15913
+ { in: "query", key: "workspace" }
15914
+ ]
15915
+ }
15916
+ ]);
15917
+ return (options?.client ?? this.client).get({
15918
+ url: "/api/session/{sessionID}/context",
15919
+ ...options,
15920
+ ...params
15921
+ });
15922
+ }
15923
+ messages(parameters, options) {
15924
+ const params = buildClientParams([parameters], [
15925
+ {
15926
+ args: [
15927
+ { in: "path", key: "sessionID" },
15928
+ { in: "query", key: "directory" },
15929
+ { in: "query", key: "workspace" }
15930
+ ]
15931
+ }
15932
+ ]);
15933
+ return (options?.client ?? this.client).get({
15934
+ url: "/api/session/{sessionID}/message",
15935
+ ...options,
15936
+ ...params
15937
+ });
15938
+ }
15939
+ }
15940
+
15941
+ class V2 extends HeyApiClient {
15942
+ _session;
15943
+ get session() {
15944
+ return this._session ??= new Session3({ client: this.client });
14857
15945
  }
14858
15946
  }
14859
15947
 
@@ -15050,220 +16138,55 @@ class Tui extends HeyApiClient {
15050
16138
  "Content-Type": "application/json",
15051
16139
  ...options?.headers,
15052
16140
  ...params.headers
15053
- }
15054
- });
15055
- }
15056
- publish(parameters, options) {
15057
- const params = buildClientParams([parameters], [
15058
- {
15059
- args: [
15060
- { in: "query", key: "directory" },
15061
- { in: "query", key: "workspace" },
15062
- { key: "body", map: "body" }
15063
- ]
15064
- }
15065
- ]);
15066
- return (options?.client ?? this.client).post({
15067
- url: "/tui/publish",
15068
- ...options,
15069
- ...params,
15070
- headers: {
15071
- "Content-Type": "application/json",
15072
- ...options?.headers,
15073
- ...params.headers
15074
- }
15075
- });
15076
- }
15077
- selectSession(parameters, options) {
15078
- const params = buildClientParams([parameters], [
15079
- {
15080
- args: [
15081
- { in: "query", key: "directory" },
15082
- { in: "query", key: "workspace" },
15083
- { in: "body", key: "sessionID" }
15084
- ]
15085
- }
15086
- ]);
15087
- return (options?.client ?? this.client).post({
15088
- url: "/tui/select-session",
15089
- ...options,
15090
- ...params,
15091
- headers: {
15092
- "Content-Type": "application/json",
15093
- ...options?.headers,
15094
- ...params.headers
15095
- }
15096
- });
15097
- }
15098
- _control;
15099
- get control() {
15100
- return this._control ??= new Control({ client: this.client });
15101
- }
15102
- }
15103
-
15104
- class Instance extends HeyApiClient {
15105
- dispose(parameters, options) {
15106
- const params = buildClientParams([parameters], [
15107
- {
15108
- args: [
15109
- { in: "query", key: "directory" },
15110
- { in: "query", key: "workspace" }
15111
- ]
15112
- }
15113
- ]);
15114
- return (options?.client ?? this.client).post({
15115
- url: "/instance/dispose",
15116
- ...options,
15117
- ...params
15118
- });
15119
- }
15120
- }
15121
-
15122
- class Path extends HeyApiClient {
15123
- get(parameters, options) {
15124
- const params = buildClientParams([parameters], [
15125
- {
15126
- args: [
15127
- { in: "query", key: "directory" },
15128
- { in: "query", key: "workspace" }
15129
- ]
15130
- }
15131
- ]);
15132
- return (options?.client ?? this.client).get({
15133
- url: "/path",
15134
- ...options,
15135
- ...params
15136
- });
15137
- }
15138
- }
15139
-
15140
- class Vcs extends HeyApiClient {
15141
- get(parameters, options) {
15142
- const params = buildClientParams([parameters], [
15143
- {
15144
- args: [
15145
- { in: "query", key: "directory" },
15146
- { in: "query", key: "workspace" }
15147
- ]
15148
- }
15149
- ]);
15150
- return (options?.client ?? this.client).get({
15151
- url: "/vcs",
15152
- ...options,
15153
- ...params
15154
- });
15155
- }
15156
- }
15157
-
15158
- class Command extends HeyApiClient {
15159
- list(parameters, options) {
15160
- const params = buildClientParams([parameters], [
15161
- {
15162
- args: [
15163
- { in: "query", key: "directory" },
15164
- { in: "query", key: "workspace" }
15165
- ]
15166
- }
15167
- ]);
15168
- return (options?.client ?? this.client).get({
15169
- url: "/command",
15170
- ...options,
15171
- ...params
15172
- });
15173
- }
15174
- }
15175
-
15176
- class App extends HeyApiClient {
15177
- log(parameters, options) {
15178
- const params = buildClientParams([parameters], [
15179
- {
15180
- args: [
15181
- { in: "query", key: "directory" },
15182
- { in: "query", key: "workspace" },
15183
- { in: "body", key: "service" },
15184
- { in: "body", key: "level" },
15185
- { in: "body", key: "message" },
15186
- { in: "body", key: "extra" }
15187
- ]
15188
- }
15189
- ]);
15190
- return (options?.client ?? this.client).post({
15191
- url: "/log",
15192
- ...options,
15193
- ...params,
15194
- headers: {
15195
- "Content-Type": "application/json",
15196
- ...options?.headers,
15197
- ...params.headers
15198
- }
15199
- });
15200
- }
15201
- agents(parameters, options) {
15202
- const params = buildClientParams([parameters], [
15203
- {
15204
- args: [
15205
- { in: "query", key: "directory" },
15206
- { in: "query", key: "workspace" }
15207
- ]
15208
- }
15209
- ]);
15210
- return (options?.client ?? this.client).get({
15211
- url: "/agent",
15212
- ...options,
15213
- ...params
15214
- });
15215
- }
15216
- skills(parameters, options) {
15217
- const params = buildClientParams([parameters], [
15218
- {
15219
- args: [
15220
- { in: "query", key: "directory" },
15221
- { in: "query", key: "workspace" }
15222
- ]
15223
- }
15224
- ]);
15225
- return (options?.client ?? this.client).get({
15226
- url: "/skill",
15227
- ...options,
15228
- ...params
16141
+ }
15229
16142
  });
15230
16143
  }
15231
- }
15232
-
15233
- class Lsp extends HeyApiClient {
15234
- status(parameters, options) {
16144
+ publish(parameters, options) {
15235
16145
  const params = buildClientParams([parameters], [
15236
16146
  {
15237
16147
  args: [
15238
16148
  { in: "query", key: "directory" },
15239
- { in: "query", key: "workspace" }
16149
+ { in: "query", key: "workspace" },
16150
+ { key: "body", map: "body" }
15240
16151
  ]
15241
16152
  }
15242
16153
  ]);
15243
- return (options?.client ?? this.client).get({
15244
- url: "/lsp",
16154
+ return (options?.client ?? this.client).post({
16155
+ url: "/tui/publish",
15245
16156
  ...options,
15246
- ...params
16157
+ ...params,
16158
+ headers: {
16159
+ "Content-Type": "application/json",
16160
+ ...options?.headers,
16161
+ ...params.headers
16162
+ }
15247
16163
  });
15248
16164
  }
15249
- }
15250
-
15251
- class Formatter extends HeyApiClient {
15252
- status(parameters, options) {
16165
+ selectSession(parameters, options) {
15253
16166
  const params = buildClientParams([parameters], [
15254
16167
  {
15255
16168
  args: [
15256
16169
  { in: "query", key: "directory" },
15257
- { in: "query", key: "workspace" }
16170
+ { in: "query", key: "workspace" },
16171
+ { in: "body", key: "sessionID" }
15258
16172
  ]
15259
16173
  }
15260
16174
  ]);
15261
- return (options?.client ?? this.client).get({
15262
- url: "/formatter",
16175
+ return (options?.client ?? this.client).post({
16176
+ url: "/tui/select-session",
15263
16177
  ...options,
15264
- ...params
16178
+ ...params,
16179
+ headers: {
16180
+ "Content-Type": "application/json",
16181
+ ...options?.headers,
16182
+ ...params.headers
16183
+ }
15265
16184
  });
15266
16185
  }
16186
+ _control;
16187
+ get control() {
16188
+ return this._control ??= new Control({ client: this.client });
16189
+ }
15267
16190
  }
15268
16191
 
15269
16192
  class OpencodeClient extends HeyApiClient {
@@ -15272,58 +16195,38 @@ class OpencodeClient extends HeyApiClient {
15272
16195
  super(args);
15273
16196
  OpencodeClient.__registry.set(this, args?.key);
15274
16197
  }
15275
- _global;
15276
- get global() {
15277
- return this._global ??= new Global({ client: this.client });
15278
- }
15279
16198
  _auth;
15280
16199
  get auth() {
15281
16200
  return this._auth ??= new Auth({ client: this.client });
15282
16201
  }
15283
- _project;
15284
- get project() {
15285
- return this._project ??= new Project({ client: this.client });
16202
+ _app;
16203
+ get app() {
16204
+ return this._app ??= new App({ client: this.client });
15286
16205
  }
15287
- _pty;
15288
- get pty() {
15289
- return this._pty ??= new Pty({ client: this.client });
16206
+ _global;
16207
+ get global() {
16208
+ return this._global ??= new Global({ client: this.client });
16209
+ }
16210
+ _event;
16211
+ get event() {
16212
+ return this._event ??= new Event({ client: this.client });
15290
16213
  }
15291
16214
  _config;
15292
16215
  get config() {
15293
16216
  return this._config ??= new Config2({ client: this.client });
15294
16217
  }
15295
- _tool;
15296
- get tool() {
15297
- return this._tool ??= new Tool({ client: this.client });
15298
- }
15299
16218
  _experimental;
15300
16219
  get experimental() {
15301
16220
  return this._experimental ??= new Experimental({ client: this.client });
15302
16221
  }
16222
+ _tool;
16223
+ get tool() {
16224
+ return this._tool ??= new Tool({ client: this.client });
16225
+ }
15303
16226
  _worktree;
15304
16227
  get worktree() {
15305
16228
  return this._worktree ??= new Worktree({ client: this.client });
15306
16229
  }
15307
- _session;
15308
- get session() {
15309
- return this._session ??= new Session2({ client: this.client });
15310
- }
15311
- _part;
15312
- get part() {
15313
- return this._part ??= new Part({ client: this.client });
15314
- }
15315
- _permission;
15316
- get permission() {
15317
- return this._permission ??= new Permission({ client: this.client });
15318
- }
15319
- _question;
15320
- get question() {
15321
- return this._question ??= new Question({ client: this.client });
15322
- }
15323
- _provider;
15324
- get provider() {
15325
- return this._provider ??= new Provider({ client: this.client });
15326
- }
15327
16230
  _find;
15328
16231
  get find() {
15329
16232
  return this._find ??= new Find({ client: this.client });
@@ -15332,18 +16235,6 @@ class OpencodeClient extends HeyApiClient {
15332
16235
  get file() {
15333
16236
  return this._file ??= new File2({ client: this.client });
15334
16237
  }
15335
- _event;
15336
- get event() {
15337
- return this._event ??= new Event({ client: this.client });
15338
- }
15339
- _mcp;
15340
- get mcp() {
15341
- return this._mcp ??= new Mcp({ client: this.client });
15342
- }
15343
- _tui;
15344
- get tui() {
15345
- return this._tui ??= new Tui({ client: this.client });
15346
- }
15347
16238
  _instance;
15348
16239
  get instance() {
15349
16240
  return this._instance ??= new Instance({ client: this.client });
@@ -15360,10 +16251,6 @@ class OpencodeClient extends HeyApiClient {
15360
16251
  get command() {
15361
16252
  return this._command ??= new Command({ client: this.client });
15362
16253
  }
15363
- _app;
15364
- get app() {
15365
- return this._app ??= new App({ client: this.client });
15366
- }
15367
16254
  _lsp;
15368
16255
  get lsp() {
15369
16256
  return this._lsp ??= new Lsp({ client: this.client });
@@ -15372,7 +16259,53 @@ class OpencodeClient extends HeyApiClient {
15372
16259
  get formatter() {
15373
16260
  return this._formatter ??= new Formatter({ client: this.client });
15374
16261
  }
16262
+ _mcp;
16263
+ get mcp() {
16264
+ return this._mcp ??= new Mcp({ client: this.client });
16265
+ }
16266
+ _project;
16267
+ get project() {
16268
+ return this._project ??= new Project({ client: this.client });
16269
+ }
16270
+ _pty;
16271
+ get pty() {
16272
+ return this._pty ??= new Pty({ client: this.client });
16273
+ }
16274
+ _question;
16275
+ get question() {
16276
+ return this._question ??= new Question({ client: this.client });
16277
+ }
16278
+ _permission;
16279
+ get permission() {
16280
+ return this._permission ??= new Permission({ client: this.client });
16281
+ }
16282
+ _provider;
16283
+ get provider() {
16284
+ return this._provider ??= new Provider({ client: this.client });
16285
+ }
16286
+ _session;
16287
+ get session() {
16288
+ return this._session ??= new Session2({ client: this.client });
16289
+ }
16290
+ _part;
16291
+ get part() {
16292
+ return this._part ??= new Part({ client: this.client });
16293
+ }
16294
+ _sync;
16295
+ get sync() {
16296
+ return this._sync ??= new Sync({ client: this.client });
16297
+ }
16298
+ _v2;
16299
+ get v2() {
16300
+ return this._v2 ??= new V2({ client: this.client });
16301
+ }
16302
+ _tui;
16303
+ get tui() {
16304
+ return this._tui ??= new Tui({ client: this.client });
16305
+ }
15375
16306
  }
16307
+ // node_modules/@opencode-ai/sdk/dist/v2/server.js
16308
+ var import_cross_spawn = __toESM(require_cross_spawn(), 1);
15376
16309
  // src/index.ts
15377
16310
  import path3 from "path";
15378
16311
  import { mkdirSync } from "fs";
@@ -15701,6 +16634,8 @@ async function recoverOrphanedBranches(db, cwd) {
15701
16634
  }
15702
16635
 
15703
16636
  // src/state.ts
16637
+ import { randomUUID } from "crypto";
16638
+
15704
16639
  class MemberRegistry {
15705
16640
  bySession = new Map;
15706
16641
  byTeamName = new Map;
@@ -15744,6 +16679,36 @@ class MemberRegistry {
15744
16679
  }
15745
16680
  }
15746
16681
  var DEFAULT_MAX_DEPTH = 10;
16682
+ var DEFAULT_PURGE_APPROVAL_TTL_MS = 10 * 60 * 1000;
16683
+ function canonicalPurgeKey(purge) {
16684
+ if (purge.includes("*"))
16685
+ return JSON.stringify(["*"]);
16686
+ return JSON.stringify([...new Set(purge)].sort());
16687
+ }
16688
+ function outputSelectedAnswer(output, label) {
16689
+ const quoted = JSON.stringify(label);
16690
+ return output.includes(`=${quoted}`) || output.includes(`=[${quoted}]`);
16691
+ }
16692
+ function optionLabels(args) {
16693
+ if (!args || typeof args !== "object")
16694
+ return [];
16695
+ const questions = args.questions;
16696
+ if (!Array.isArray(questions))
16697
+ return [];
16698
+ return questions.flatMap((question) => {
16699
+ if (!question || typeof question !== "object")
16700
+ return [];
16701
+ const options = question.options;
16702
+ if (!Array.isArray(options))
16703
+ return [];
16704
+ return options.flatMap((option) => {
16705
+ if (!option || typeof option !== "object")
16706
+ return [];
16707
+ const label = option.label;
16708
+ return typeof label === "string" ? [label] : [];
16709
+ });
16710
+ });
16711
+ }
15747
16712
 
15748
16713
  class DescendantTracker {
15749
16714
  parents = new Map;
@@ -15770,6 +16735,65 @@ class DescendantTracker {
15770
16735
  }
15771
16736
  }
15772
16737
 
16738
+ class PendingPurgeApprovals {
16739
+ pending = new Map;
16740
+ ttlMs;
16741
+ now;
16742
+ createToken;
16743
+ constructor(ttlMs = DEFAULT_PURGE_APPROVAL_TTL_MS, now = () => Date.now(), createToken = randomUUID) {
16744
+ this.ttlMs = ttlMs;
16745
+ this.now = now;
16746
+ this.createToken = createToken;
16747
+ }
16748
+ create(sessionId, purge) {
16749
+ this.pruneExpired();
16750
+ const token = this.createToken();
16751
+ this.pending.set(token, {
16752
+ sessionId,
16753
+ purgeKey: canonicalPurgeKey(purge),
16754
+ approved: false,
16755
+ timeCreated: this.now()
16756
+ });
16757
+ return token;
16758
+ }
16759
+ approvalLabel(token) {
16760
+ return `Approve purge ${token.slice(0, 8)}`;
16761
+ }
16762
+ denialLabel(token) {
16763
+ return `Deny purge ${token.slice(0, 8)}`;
16764
+ }
16765
+ recordQuestionAnswer(sessionId, output, args) {
16766
+ this.pruneExpired();
16767
+ const labels = new Set(optionLabels(args));
16768
+ for (const [token, approval] of this.pending.entries()) {
16769
+ const approvalLabel = this.approvalLabel(token);
16770
+ const denialLabel = this.denialLabel(token);
16771
+ const hasRequiredOptions = labels.has(approvalLabel) && labels.has(denialLabel);
16772
+ if (approval.sessionId === sessionId && hasRequiredOptions && outputSelectedAnswer(output, approvalLabel)) {
16773
+ approval.approved = true;
16774
+ }
16775
+ }
16776
+ }
16777
+ consume(sessionId, token, purge) {
16778
+ this.pruneExpired();
16779
+ const approval = this.pending.get(token);
16780
+ if (!approval || approval.sessionId !== sessionId || approval.purgeKey !== canonicalPurgeKey(purge)) {
16781
+ throw new Error("Purge confirmation token is invalid or expired.");
16782
+ }
16783
+ if (!approval.approved) {
16784
+ throw new Error("Purge was not approved by the user. Use the question tool with the exact approval option from the preview before confirming.");
16785
+ }
16786
+ this.pending.delete(token);
16787
+ }
16788
+ pruneExpired() {
16789
+ const cutoff = this.now() - this.ttlMs;
16790
+ for (const [token, approval] of this.pending.entries()) {
16791
+ if (approval.timeCreated < cutoff)
16792
+ this.pending.delete(token);
16793
+ }
16794
+ }
16795
+ }
16796
+
15773
16797
  // src/hooks.ts
15774
16798
  var TEAM_TOOL_PREFIX = "team_";
15775
16799
  function handleSessionStatusEvent(db, registry2, sessionId, status) {
@@ -15987,7 +17011,7 @@ function buildLeadSystemPrompt(db, teamId, config2) {
15987
17011
  }
15988
17012
  lines.push(`If user picks "I'll choose per agent", ask for each agent's model individually before each team_spawn call.`, "Pass the chosen model via the model parameter on each team_spawn call.");
15989
17013
  }
15990
- lines.push("", "Spawn teammates ONE AT A TIME. Wait for each tool result before spawning the next.", "This avoids git worktree contention. Once all are spawned, wait for their messages.", "Read-only agents (explore, plan) automatically skip worktree creation.", "For other agents that only need to read, pass worktree: false to avoid unnecessary isolation.", "", "Teammates work asynchronously and message you when done.", "Do NOT poll team_status or team_tasks_list repeatedly \u2014 wait for messages.", "After spawning all teammates, tell the user what you've set up and wait.", "When all teammates finish, summarize results and suggest next steps.", "", "MERGE WORKFLOW:", "After a teammate finishes and you shut them down, use team_merge to merge their branch.", "Do NOT tell teammates to commit \u2014 they handle that themselves.", "Do NOT run git merge manually \u2014 use team_merge which squash-merges and unstages for you.", "team_cleanup will safety-net merge any branches you forgot, but prefer explicit team_merge.", "", "Before calling team_cleanup, verify teammates have committed their work.", "team_shutdown will warn you if a teammate has uncommitted changes.", "team_cleanup will block if any worktree has uncommitted changes \u2014 merge or commit first.");
17014
+ lines.push("", "Spawn teammates ONE AT A TIME. Wait for each tool result before spawning the next.", "This avoids git worktree contention. Once all are spawned, wait for their messages.", "Read-only agents (explore, plan) automatically skip worktree creation.", "For other agents that only need to read, pass worktree: false to avoid unnecessary isolation.", "", "Teammates work asynchronously and message you when done.", "Do NOT poll team_status or team_tasks_list repeatedly \u2014 wait for messages.", "After spawning all teammates, tell the user what you've set up and wait.", "When all teammates finish, summarize results and suggest next steps.", "", "MERGE WORKFLOW:", "After a teammate finishes and you shut them down, use team_merge to merge their branch.", "Do NOT tell teammates to commit \u2014 they handle that themselves.", "Do NOT run git merge manually \u2014 use team_merge which squash-merges and unstages for you.", "team_cleanup will safety-net merge any branches you forgot, but prefer explicit team_merge.", "", "Before calling team_cleanup, verify teammates have committed their work.", "team_shutdown will warn you if a teammate has uncommitted changes.", "team_cleanup will block if any worktree has uncommitted changes \u2014 merge or commit first.", 'To permanently delete archived teams, call team_cleanup with purge: ["team-name"] or purge: ["*"] for all archived teams.', "The first purge call is preview-only and deletes nothing.", "Use the question tool to ask the user for visible human approval before deleting archived team records or preserved Ensemble branches.", "The question must include the exact approval and denial option labels shown in the preview.", "Only if the user selects that exact approval option, call team_cleanup again with the same purge value, confirm_purge: true, and the confirm_token from the preview.");
15991
17015
  return lines.join(`
15992
17016
  `);
15993
17017
  }
@@ -16156,9 +17180,9 @@ function loadConfig(projectDir) {
16156
17180
  const homeDir = process.env.HOME ?? process.env.USERPROFILE ?? "";
16157
17181
  const globalPath = path2.join(homeDir, ".config", "opencode", "ensemble.json");
16158
17182
  const projectPath = path2.join(projectDir, ".opencode", "ensemble.json");
16159
- const global = readConfigFile(globalPath);
17183
+ const global2 = readConfigFile(globalPath);
16160
17184
  const project = readConfigFile(projectPath);
16161
- const merged = { ...DEFAULT_CONFIG, ...global, ...project };
17185
+ const merged = { ...DEFAULT_CONFIG, ...global2, ...project };
16162
17186
  const timeout = process.env.OPENCODE_ENSEMBLE_TIMEOUT;
16163
17187
  if (timeout !== undefined)
16164
17188
  merged.timeoutMs = timeout === "0" ? 0 : parseInt(timeout, 10) || merged.timeoutMs;
@@ -17017,6 +18041,28 @@ function requireTeamMember(deps, sessionId) {
17017
18041
  throw new Error("This session is not in a team.");
17018
18042
  return teamInfo;
17019
18043
  }
18044
+ function requireCanPurgeArchivedTeams(deps, sessionId) {
18045
+ const activeMembers = deps.db.query(`SELECT tm.session_id
18046
+ FROM team_member tm
18047
+ JOIN team t ON tm.team_id = t.id
18048
+ WHERE t.status = 'active'`).all();
18049
+ if (activeMembers.some((member) => member.session_id === sessionId)) {
18050
+ throw new Error("Team members cannot purge archived teams");
18051
+ }
18052
+ const activeLeads = deps.db.query("SELECT lead_session_id FROM team WHERE status = 'active'").all();
18053
+ if (deps.tracker.getParent(sessionId)) {
18054
+ throw new Error("Sub-agents cannot purge archived teams");
18055
+ }
18056
+ if (activeLeads.some((team) => team.lead_session_id === sessionId))
18057
+ return;
18058
+ const activeTeamSessions = new Set([
18059
+ ...activeMembers.map((member) => member.session_id),
18060
+ ...activeLeads.map((team) => team.lead_session_id)
18061
+ ]);
18062
+ if (deps.tracker.isDescendantOf(sessionId, activeTeamSessions)) {
18063
+ throw new Error("Sub-agents cannot purge archived teams");
18064
+ }
18065
+ }
17020
18066
 
17021
18067
  // src/tools/team-spawn.ts
17022
18068
  var spawnFailures = new Map;
@@ -17471,7 +18517,340 @@ ${parts.join(`
17471
18517
 
17472
18518
  // src/tools/team-cleanup.ts
17473
18519
  init_merge_helper();
17474
- async function executeTeamCleanup(deps, args, sessionId, isDirty = checkWorktreeDirty, merge2 = mergeBranch, delBranch = deleteBranch, mergeOnCleanup = true, overlapCheck = getOverlappingFiles) {
18520
+ async function listPreservedBranches(teamName, cwd) {
18521
+ try {
18522
+ const proc = Bun.spawn(["git", "branch", "--list", `ensemble/preserved/${teamName}/*`, "--format", "%(refname:short)"], { cwd, stdout: "pipe", stderr: "pipe" });
18523
+ const out = await new Response(proc.stdout).text();
18524
+ const stderr = await new Response(proc.stderr).text();
18525
+ const exit = await proc.exited;
18526
+ if (exit !== 0)
18527
+ throw new Error(stderr.trim() || `git branch exited with code ${exit}`);
18528
+ return out.split(`
18529
+ `).map((branch) => branch.trim()).filter(Boolean);
18530
+ } catch (err) {
18531
+ const message = err instanceof Error ? err.message : String(err);
18532
+ if (message.includes("not a git repository"))
18533
+ return [];
18534
+ throw new Error(`Failed to list preserved branches for ${teamName}: ${err instanceof Error ? err.message : String(err)}`);
18535
+ }
18536
+ }
18537
+ async function branchExists(branch, cwd) {
18538
+ try {
18539
+ const proc = Bun.spawn(["git", "branch", "--list", branch, "--format", "%(refname:short)"], { cwd, stdout: "pipe", stderr: "pipe" });
18540
+ const out = await new Response(proc.stdout).text();
18541
+ const stderr = await new Response(proc.stderr).text();
18542
+ const exit = await proc.exited;
18543
+ if (exit !== 0) {
18544
+ if (stderr.includes("not a git repository"))
18545
+ return false;
18546
+ throw new Error(stderr.trim() || `git branch exited with code ${exit}`);
18547
+ }
18548
+ return out.split(`
18549
+ `).map((item) => item.trim()).includes(branch);
18550
+ } catch (err) {
18551
+ const message = err instanceof Error ? err.message : String(err);
18552
+ if (message.includes("not a git repository"))
18553
+ return false;
18554
+ throw new Error(`Failed to check stale Ensemble branch ${branch}: ${message}`);
18555
+ }
18556
+ }
18557
+ function normalizeBranchName(branch) {
18558
+ return branch.trim().replace(/^\*\s*/, "");
18559
+ }
18560
+ function resolvePurgeTargets(deps, purge) {
18561
+ if (purge.length === 0)
18562
+ throw new Error("Pass at least one archived team name to purge, or ['*'] for all archived teams.");
18563
+ if (purge.includes("*") && purge.length !== 1) {
18564
+ throw new Error("Wildcard purge cannot be combined with explicit team names. Use purge: ['*'] by itself.");
18565
+ }
18566
+ if (purge.includes("*")) {
18567
+ return deps.db.query("SELECT id, name, time_updated FROM team WHERE status = 'archived' ORDER BY time_updated DESC, name ASC").all();
18568
+ }
18569
+ const uniqueNames = [...new Set(purge)];
18570
+ const rows = uniqueNames.map((name) => ({
18571
+ name,
18572
+ team: deps.db.query("SELECT id, name, status, time_updated FROM team WHERE name = ?").get(name)
18573
+ }));
18574
+ const missing = rows.filter((row) => row.team === null).map((row) => row.name);
18575
+ if (missing.length > 0)
18576
+ throw new Error(`Team not found: ${missing.join(", ")}`);
18577
+ const active = rows.filter((row) => row.team?.status === "active").map((row) => row.name);
18578
+ if (active.length > 0)
18579
+ throw new Error(`Cannot purge active team: ${active.join(", ")}`);
18580
+ return rows.map((row) => row.team).sort((a, b) => b.time_updated - a.time_updated || a.name.localeCompare(b.name));
18581
+ }
18582
+ function deleteArchivedTeams(deps, targets) {
18583
+ const transaction = deps.db.transaction((teams) => {
18584
+ teams.forEach((team) => {
18585
+ const row = deps.db.query("SELECT status FROM team WHERE id = ?").get(team.id);
18586
+ if (!row)
18587
+ throw new Error(`Team not found: ${team.name}`);
18588
+ if (row.status === "active")
18589
+ throw new Error(`Cannot purge active team: ${team.name}`);
18590
+ });
18591
+ validatePurgeResources(deps, teams);
18592
+ teams.forEach((team) => {
18593
+ deps.db.run("DELETE FROM team WHERE id = ? AND status = 'archived'", [team.id]);
18594
+ });
18595
+ });
18596
+ transaction(targets);
18597
+ targets.forEach((team) => {
18598
+ deps.registry.unregisterTeam(team.id);
18599
+ spawnFailures.delete(team.id);
18600
+ });
18601
+ }
18602
+ function getPurgeMemberResources(deps, targets) {
18603
+ return targets.flatMap((target) => deps.db.query(`SELECT t.name as team_name,
18604
+ tm.team_id,
18605
+ tm.name as member_name,
18606
+ tm.worktree_dir,
18607
+ tm.workspace_id,
18608
+ tm.worktree_branch
18609
+ FROM team_member tm
18610
+ JOIN team t ON tm.team_id = t.id
18611
+ WHERE tm.team_id = ?`).all(target.id));
18612
+ }
18613
+ function preservedBranchPrefix(resource) {
18614
+ return `ensemble/preserved/${resource.team_name}/`;
18615
+ }
18616
+ function staleEnsembleBranchNames(resource) {
18617
+ return [
18618
+ `ensemble-${resource.team_name}-${resource.member_name}`,
18619
+ `opencode/ensemble-${resource.team_name}-${resource.member_name}`
18620
+ ];
18621
+ }
18622
+ function isPreservedBranch(resource) {
18623
+ return resource.worktree_branch !== null && resource.worktree_branch.startsWith(preservedBranchPrefix(resource));
18624
+ }
18625
+ function isStaleEnsembleBranch(resource) {
18626
+ return resource.worktree_branch !== null && staleEnsembleBranchNames(resource).includes(resource.worktree_branch);
18627
+ }
18628
+ function validatePurgeResources(deps, targets) {
18629
+ const resources = getPurgeMemberResources(deps, targets);
18630
+ const nonPreserved = resources.filter((resource) => resource.worktree_branch !== null && !isPreservedBranch(resource) && !isStaleEnsembleBranch(resource));
18631
+ if (nonPreserved.length > 0) {
18632
+ const details = nonPreserved.map((resource) => `${resource.team_name}/${resource.member_name} (${resource.worktree_branch})`).join(", ");
18633
+ throw new Error(`Cannot purge archived teams: ${details} has a non-preserved worktree branch or a branch outside its preserved namespace.`);
18634
+ }
18635
+ const activeResourceRefs = resources.flatMap((resource) => {
18636
+ const worktreeRefs = resource.worktree_dir ? deps.db.query(`SELECT t.name as team_name, tm.name as member_name
18637
+ FROM team_member tm
18638
+ JOIN team t ON tm.team_id = t.id
18639
+ WHERE t.status = 'active' AND tm.worktree_dir = ?`).all(resource.worktree_dir) : [];
18640
+ const workspaceRefs = resource.workspace_id ? deps.db.query(`SELECT t.name as team_name, tm.name as member_name
18641
+ FROM team_member tm
18642
+ JOIN team t ON tm.team_id = t.id
18643
+ WHERE t.status = 'active' AND tm.workspace_id = ?`).all(resource.workspace_id) : [];
18644
+ return [
18645
+ ...worktreeRefs.map((ref) => `${resource.team_name}/${resource.member_name} worktree is also referenced by active team ${ref.team_name}/${ref.member_name}`),
18646
+ ...workspaceRefs.map((ref) => `${resource.team_name}/${resource.member_name} workspace is also referenced by active team ${ref.team_name}/${ref.member_name}`)
18647
+ ];
18648
+ });
18649
+ if (activeResourceRefs.length > 0) {
18650
+ throw new Error(`Cannot purge archived teams: ${[...new Set(activeResourceRefs)].join(", ")}.`);
18651
+ }
18652
+ }
18653
+ function collectStaleEnsembleBranches(deps, targets) {
18654
+ return [...new Set(getPurgeMemberResources(deps, targets).filter(isStaleEnsembleBranch).map((resource) => resource.worktree_branch))];
18655
+ }
18656
+ function countStaleResourceRefs(deps, target) {
18657
+ return getPurgeMemberResources(deps, [target]).reduce((count, resource) => count + (resource.worktree_dir ? 1 : 0) + (resource.workspace_id ? 1 : 0), 0);
18658
+ }
18659
+ function countStaleBranchRefs(deps, target) {
18660
+ return collectStaleEnsembleBranches(deps, [target]).length;
18661
+ }
18662
+ async function existingWorktreeDirs(deps, resources) {
18663
+ if (!resources.some((resource) => resource.worktree_dir))
18664
+ return new Set;
18665
+ try {
18666
+ const result = await deps.client.worktree.list();
18667
+ return new Set((result.data ?? []).map((worktree) => worktree.directory));
18668
+ } catch (err) {
18669
+ const message = err instanceof Error ? err.message : String(err);
18670
+ throw new Error(`Cannot purge archived teams: failed to list worktrees before stale resource cleanup: ${message}`);
18671
+ }
18672
+ }
18673
+ async function existingWorkspaceIds(deps, resources) {
18674
+ if (!resources.some((resource) => resource.workspace_id))
18675
+ return new Set;
18676
+ try {
18677
+ const result = await deps.client.workspace.list();
18678
+ return new Set((result.data ?? []).map((workspace) => workspace.id));
18679
+ } catch (err) {
18680
+ const message = err instanceof Error ? err.message : String(err);
18681
+ throw new Error(`Cannot purge archived teams: failed to list workspaces before stale resource cleanup: ${message}`);
18682
+ }
18683
+ }
18684
+ async function cleanupStalePurgeResources(deps, targets, isDirty) {
18685
+ const resources = getPurgeMemberResources(deps, targets).filter((resource) => resource.worktree_dir || resource.workspace_id);
18686
+ if (resources.length === 0)
18687
+ return;
18688
+ const worktreeDirs = await existingWorktreeDirs(deps, resources);
18689
+ const workspaceIds = await existingWorkspaceIds(deps, resources);
18690
+ for (const resource of resources) {
18691
+ if (resource.workspace_id) {
18692
+ if (workspaceIds.has(resource.workspace_id)) {
18693
+ try {
18694
+ await deps.client.workspace.remove({ id: resource.workspace_id });
18695
+ } catch (err) {
18696
+ const message = err instanceof Error ? err.message : String(err);
18697
+ throw new Error(`Failed to remove stale workspace for ${resource.team_name}/${resource.member_name}: ${message}`);
18698
+ }
18699
+ }
18700
+ deps.db.run("UPDATE team_member SET workspace_id = NULL WHERE team_id = ? AND name = ?", [resource.team_id, resource.member_name]);
18701
+ }
18702
+ if (resource.worktree_dir) {
18703
+ if (worktreeDirs.has(resource.worktree_dir)) {
18704
+ let dirty;
18705
+ try {
18706
+ dirty = await isDirty(resource.worktree_dir);
18707
+ } catch (err) {
18708
+ const message = err instanceof Error ? err.message : String(err);
18709
+ throw new Error(`Cannot purge archived teams: failed to check archived worktree for uncommitted changes at ${resource.worktree_dir}: ${message}`);
18710
+ }
18711
+ if (dirty) {
18712
+ throw new Error(`Cannot purge archived teams: ${resource.team_name}/${resource.member_name} has uncommitted changes in archived worktree ${resource.worktree_dir}.`);
18713
+ }
18714
+ try {
18715
+ await deps.client.worktree.remove({ worktreeRemoveInput: { directory: resource.worktree_dir } });
18716
+ } catch (err) {
18717
+ const message = err instanceof Error ? err.message : String(err);
18718
+ throw new Error(`Failed to remove stale worktree for ${resource.team_name}/${resource.member_name}: ${message}`);
18719
+ }
18720
+ }
18721
+ deps.db.run("UPDATE team_member SET worktree_dir = NULL WHERE team_id = ? AND name = ?", [resource.team_id, resource.member_name]);
18722
+ }
18723
+ }
18724
+ }
18725
+ async function deleteStaleEnsembleBranches(branches, cwd, delBranch, exists) {
18726
+ for (const branch of branches) {
18727
+ if (!await exists(branch, cwd))
18728
+ continue;
18729
+ const ok = await delBranch(branch, cwd);
18730
+ if (!ok)
18731
+ throw new Error(`Failed to delete stale Ensemble branch: ${branch}`);
18732
+ }
18733
+ }
18734
+ function validatePurgeTargetsStillArchived(deps, targets) {
18735
+ const missing = [];
18736
+ const active = [];
18737
+ targets.forEach((target) => {
18738
+ const row = deps.db.query("SELECT status FROM team WHERE id = ?").get(target.id);
18739
+ if (!row)
18740
+ missing.push(target.name);
18741
+ else if (row.status === "active")
18742
+ active.push(target.name);
18743
+ });
18744
+ if (missing.length > 0)
18745
+ throw new Error(`Team not found: ${missing.join(", ")}`);
18746
+ if (active.length > 0)
18747
+ throw new Error(`Cannot purge active team: ${active.join(", ")}`);
18748
+ }
18749
+ async function collectPreservedBranches(targets, cwd, listBranches) {
18750
+ const entries = await Promise.all(targets.map(async (target) => {
18751
+ const prefix = `ensemble/preserved/${target.name}/`;
18752
+ let listed;
18753
+ try {
18754
+ listed = await listBranches(target.name, cwd);
18755
+ } catch (err) {
18756
+ const message = err instanceof Error ? err.message : String(err);
18757
+ if (message.includes("not a git repository"))
18758
+ listed = [];
18759
+ else
18760
+ throw new Error(`Failed to list preserved branches for ${target.name}: ${message}`);
18761
+ }
18762
+ const branches = listed.map(normalizeBranchName).filter((branch) => branch.startsWith(prefix));
18763
+ return [target.id, [...new Set(branches)]];
18764
+ }));
18765
+ return new Map(entries);
18766
+ }
18767
+ async function deletePreservedBranches(branchesByTeam, cwd, delBranch) {
18768
+ const branches = [...branchesByTeam.values()].flat();
18769
+ for (const branch of branches) {
18770
+ const ok = await delBranch(branch, cwd);
18771
+ if (!ok)
18772
+ throw new Error(`Failed to delete preserved branch: ${branch}`);
18773
+ }
18774
+ }
18775
+ function formatCount(count, noun, plural = `${noun}s`) {
18776
+ return `${count} ${count === 1 ? noun : plural}`;
18777
+ }
18778
+ function buildPurgePreview(deps, targets, branchesByTeam) {
18779
+ const rows = targets.map((target) => {
18780
+ const members = deps.db.query("SELECT COUNT(*) as c FROM team_member WHERE team_id = ?").get(target.id).c;
18781
+ const tasks = deps.db.query("SELECT COUNT(*) as c FROM team_task WHERE team_id = ?").get(target.id).c;
18782
+ const messages = deps.db.query("SELECT COUNT(*) as c FROM team_message WHERE team_id = ?").get(target.id).c;
18783
+ const branches = branchesByTeam.get(target.id)?.length ?? 0;
18784
+ const staleResources = countStaleResourceRefs(deps, target);
18785
+ const staleBranches = countStaleBranchRefs(deps, target);
18786
+ return { ...target, members, tasks, messages, branches, staleResources, staleBranches };
18787
+ });
18788
+ const totals = rows.reduce((acc, row) => ({
18789
+ members: acc.members + row.members,
18790
+ tasks: acc.tasks + row.tasks,
18791
+ messages: acc.messages + row.messages,
18792
+ branches: acc.branches + row.branches,
18793
+ staleResources: acc.staleResources + row.staleResources,
18794
+ staleBranches: acc.staleBranches + row.staleBranches
18795
+ }), { members: 0, tasks: 0, messages: 0, branches: 0, staleResources: 0, staleBranches: 0 });
18796
+ const details = rows.slice(0, 10).map((row) => `- ${row.name}: ${formatCount(row.members, "member")}, ${formatCount(row.tasks, "task")}, ${formatCount(row.messages, "message")}, ${formatCount(row.branches, "preserved branch", "preserved branches")}, ${formatCount(row.staleResources, "stale resource")}, ${formatCount(row.staleBranches, "stale branch", "stale branches")}`);
18797
+ const hidden = rows.length > 10 ? [`...and ${rows.length - 10} more archived team${rows.length - 10 === 1 ? "" : "s"}`] : [];
18798
+ return [
18799
+ "Permanently delete archived teams?",
18800
+ "This will delete archived team records and cascade-delete their members, tasks, and messages.",
18801
+ "",
18802
+ ...details,
18803
+ ...hidden,
18804
+ "",
18805
+ `Total: ${formatCount(rows.length, "team")}, ${formatCount(totals.members, "member")}, ${formatCount(totals.tasks, "task")}, ${formatCount(totals.messages, "message")}, ${formatCount(totals.branches, "preserved branch", "preserved branches")}, ${formatCount(totals.staleResources, "stale resource")}, ${formatCount(totals.staleBranches, "stale branch", "stale branches")}`
18806
+ ].join(`
18807
+ `);
18808
+ }
18809
+ function buildPurgeConfirmationInstructions(preview, confirmToken) {
18810
+ const approvalLabel = `Approve purge ${confirmToken.slice(0, 8)}`;
18811
+ const denialLabel = `Deny purge ${confirmToken.slice(0, 8)}`;
18812
+ return [
18813
+ "Purge preview only \u2014 no teams were deleted.",
18814
+ "",
18815
+ preview,
18816
+ "",
18817
+ "Use the question tool to ask the user whether to permanently delete these archived teams.",
18818
+ `The approval option label must be exactly: ${approvalLabel}`,
18819
+ `The denial option label must be exactly: ${denialLabel}`,
18820
+ `Confirmation token: ${confirmToken}`,
18821
+ `Only if the user selects "${approvalLabel}", call team_cleanup again with the same purge value, confirm_purge: true, and confirm_token set to this token.`
18822
+ ].join(`
18823
+ `);
18824
+ }
18825
+ async function executeTeamCleanup(deps, args, sessionId, isDirty = checkWorktreeDirty, merge2 = mergeBranch, delBranch = deleteBranch, mergeOnCleanup = true, overlapCheck = getOverlappingFiles, _approvePurge, _listBranches, _branchExists) {
18826
+ if (args.purge && args.purge.length > 0) {
18827
+ requireCanPurgeArchivedTeams(deps, sessionId);
18828
+ const targets = resolvePurgeTargets(deps, args.purge);
18829
+ if (targets.length === 0)
18830
+ return "No archived teams to purge.";
18831
+ validatePurgeTargetsStillArchived(deps, targets);
18832
+ validatePurgeResources(deps, targets);
18833
+ const branchesByTeam = await collectPreservedBranches(targets, deps.directory, _listBranches ?? listPreservedBranches);
18834
+ const preview = buildPurgePreview(deps, targets, branchesByTeam);
18835
+ if (!args.confirm_purge) {
18836
+ const confirmToken = deps.purgeApprovals.create(sessionId, targets.map((target) => target.id));
18837
+ return buildPurgeConfirmationInstructions(preview, confirmToken);
18838
+ }
18839
+ if (!args.confirm_token) {
18840
+ throw new Error("A purge confirmation token is required. First call team_cleanup without confirm_purge, then use the question tool before confirming.");
18841
+ }
18842
+ deps.purgeApprovals.consume(sessionId, args.confirm_token, targets.map((target) => target.id));
18843
+ validatePurgeTargetsStillArchived(deps, targets);
18844
+ validatePurgeResources(deps, targets);
18845
+ await cleanupStalePurgeResources(deps, targets, isDirty);
18846
+ validatePurgeResources(deps, targets);
18847
+ await deleteStaleEnsembleBranches(collectStaleEnsembleBranches(deps, targets), deps.directory, delBranch, _branchExists ?? branchExists);
18848
+ const finalBranchesByTeam = await collectPreservedBranches(targets, deps.directory, _listBranches ?? listPreservedBranches);
18849
+ await deletePreservedBranches(finalBranchesByTeam, deps.directory, delBranch);
18850
+ deleteArchivedTeams(deps, targets);
18851
+ const noun = targets.length === 1 ? "archived team" : "archived teams";
18852
+ return `Permanently deleted ${targets.length} ${noun}: ${targets.map((target) => target.name).join(", ")}.`;
18853
+ }
17475
18854
  const teamInfo = requireLead(deps, sessionId);
17476
18855
  const members = deps.db.query("SELECT name, session_id, status, worktree_dir, worktree_branch, workspace_id FROM team_member WHERE team_id = ?").all(teamInfo.teamId);
17477
18856
  const active = members.filter((m) => m.status !== "shutdown" && m.status !== "shutdown_requested" && m.status !== "error");
@@ -18071,6 +19450,7 @@ var plugin = async (input) => {
18071
19450
  const config2 = loadConfig(input.directory);
18072
19451
  const registry2 = new MemberRegistry;
18073
19452
  const tracker = new DescendantTracker;
19453
+ const purgeApprovals = new PendingPurgeApprovals;
18074
19454
  const nudgedMembers = new Set;
18075
19455
  const progressTracker = new ProgressTracker;
18076
19456
  const wakeLeadTimestamps = new Map;
@@ -18079,7 +19459,7 @@ var plugin = async (input) => {
18079
19459
  const rawClient = new OpencodeClient({ client: pluginTransport });
18080
19460
  initLog(rawClient);
18081
19461
  const client3 = wrapThrowingClient(rawClient);
18082
- const deps = { db, registry: registry2, tracker, client: client3, directory: input.directory, config: config2 };
19462
+ const deps = { db, registry: registry2, tracker, purgeApprovals, client: client3, directory: input.directory, config: config2 };
18083
19463
  if (!isWorktreeInstance(input.directory)) {
18084
19464
  log("init:recovery:start (main instance)");
18085
19465
  const recovery = await recoverStaleMembers(db, client3, input.directory);
@@ -18262,6 +19642,11 @@ var plugin = async (input) => {
18262
19642
  }
18263
19643
  }
18264
19644
  },
19645
+ "tool.execute.after": async (input2, output) => {
19646
+ if (input2.tool === "question") {
19647
+ purgeApprovals.recordQuestionAnswer(input2.sessionID, output.output, input2.args);
19648
+ }
19649
+ },
18265
19650
  "experimental.chat.system.transform": async (input2, output) => {
18266
19651
  if (!input2.sessionID)
18267
19652
  return;
@@ -18434,15 +19819,30 @@ var plugin = async (input) => {
18434
19819
  }
18435
19820
  }),
18436
19821
  team_cleanup: tool({
18437
- description: "Clean up the team. All teammates must be shut down first. Removes team data and frees resources.",
19822
+ description: "Clean up the current team, or purge archived teams after human approval. Omit purge for normal cleanup. Pass purge with archived team names, or ['*'] for all archived teams. First purge call returns a preview, exact approval and denial options, and confirmation token only. Archived worktree/workspace references and stale Ensemble-owned branches are shown in the preview and cleaned during confirmed purge. Use the question tool with those exact options, then call again with confirm_purge: true and confirm_token only if the user selected the exact approval option.",
18438
19823
  args: {
18439
19824
  force: tool.schema.boolean().default(false).describe("Force cleanup even if members are active (will abort them)"),
18440
- acknowledge_uncommitted: tool.schema.boolean().default(false)
19825
+ acknowledge_uncommitted: tool.schema.boolean().default(false),
19826
+ purge: tool.schema.array(tool.schema.string()).optional().describe("Archived team names to permanently delete, or ['*'] for all archived teams. Requires human approval."),
19827
+ confirm_purge: tool.schema.boolean().default(false).describe("Set true only after the user explicitly selects the exact approval option from the purge preview via the question tool."),
19828
+ confirm_token: tool.schema.string().optional().describe("Confirmation token from the purge preview. Valid only after the matching exact approval answer is selected in this session.")
18441
19829
  },
18442
19830
  async execute(args, ctx) {
18443
- const result = await executeTeamCleanup(deps, args, ctx.sessionID, undefined, undefined, undefined, config2.mergeOnCleanup);
19831
+ const approvePurge = args.purge && args.purge.length > 0 && args.confirm_purge ? async (preview) => {
19832
+ await ctx.ask({
19833
+ permission: "team_cleanup.purge",
19834
+ patterns: args.purge ?? [],
19835
+ always: [],
19836
+ metadata: {
19837
+ title: "Purge archived teams",
19838
+ preview
19839
+ }
19840
+ });
19841
+ } : undefined;
19842
+ const result = await executeTeamCleanup(deps, args, ctx.sessionID, undefined, undefined, undefined, config2.mergeOnCleanup, undefined, approvePurge);
18444
19843
  const blocked = result.includes("uncommitted");
18445
- ctx.metadata({ title: blocked ? "Cleanup blocked \u2014 uncommitted changes" : "Team cleaned up" });
19844
+ const title = args.purge ? result.startsWith("No archived teams") ? "No archived teams to purge" : result.startsWith("Purge preview") ? "Purge confirmation required" : "Archived teams purged" : blocked ? "Cleanup blocked \u2014 uncommitted changes" : "Team cleaned up";
19845
+ ctx.metadata({ title });
18446
19846
  return result;
18447
19847
  }
18448
19848
  }),