@hueyexe/opencode-ensemble 0.14.2 → 0.15.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,18 +1,488 @@
1
+ import { createRequire } from "node:module";
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
1
4
  var __defProp = Object.defineProperty;
2
- var __returnValue = (v) => v;
3
- function __exportSetter(name, newValue) {
4
- this[name] = __returnValue.bind(null, newValue);
5
- }
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);
6
19
  var __export = (target, all) => {
7
20
  for (var name in all)
8
21
  __defProp(target, name, {
9
22
  get: all[name],
10
23
  enumerable: true,
11
24
  configurable: true,
12
- set: __exportSetter.bind(all, name)
25
+ set: (newValue) => all[name] = () => newValue
13
26
  });
14
27
  };
15
28
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
29
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
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
+ });
16
486
 
17
487
  // src/log.ts
18
488
  function initLog(client3) {
@@ -26,11 +496,11 @@ function log(msg) {
26
496
  var _client = null;
27
497
 
28
498
  // src/process.ts
29
- import { Buffer } from "node:buffer";
499
+ import { Buffer as Buffer2 } from "node:buffer";
30
500
  import { spawn } from "node:child_process";
31
501
  function collect(stream, chunks) {
32
502
  stream?.on("data", (chunk) => {
33
- chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
503
+ chunks.push(Buffer2.isBuffer(chunk) ? chunk : Buffer2.from(chunk));
34
504
  });
35
505
  }
36
506
  function runCommand(args, options = {}) {
@@ -54,13 +524,13 @@ function runCommand(args, options = {}) {
54
524
  collect(child.stdout, stdout);
55
525
  collect(child.stderr, stderr);
56
526
  child.on("error", (error45) => {
57
- finish({ exitCode: 1, stdout: Buffer.concat(stdout).toString("utf8"), stderr: error45.message });
527
+ finish({ exitCode: 1, stdout: Buffer2.concat(stdout).toString("utf8"), stderr: error45.message });
58
528
  });
59
529
  child.on("close", (code) => {
60
530
  finish({
61
531
  exitCode: code ?? 1,
62
- stdout: Buffer.concat(stdout).toString("utf8"),
63
- stderr: Buffer.concat(stderr).toString("utf8")
532
+ stdout: Buffer2.concat(stdout).toString("utf8"),
533
+ stderr: Buffer2.concat(stderr).toString("utf8")
64
534
  });
65
535
  });
66
536
  });
@@ -70,14 +540,43 @@ var init_process = () => {};
70
540
  // src/tools/merge-helper.ts
71
541
  var exports_merge_helper = {};
72
542
  __export(exports_merge_helper, {
543
+ teamWorktreeName: () => teamWorktreeName,
544
+ teamResourceSlug: () => teamResourceSlug,
545
+ teamResourceSegment: () => teamResourceSegment,
73
546
  preservedBranchName: () => preservedBranchName,
74
547
  preserveBranch: () => preserveBranch,
75
548
  mergeBranchRaw: () => mergeBranchRaw,
76
549
  mergeBranch: () => mergeBranch,
77
550
  gitReset: () => gitReset,
551
+ getTeamResourceParts: () => getTeamResourceParts,
78
552
  getOverlappingFiles: () => getOverlappingFiles,
79
553
  deleteBranch: () => deleteBranch
80
554
  });
555
+ function shortTeamId(teamId) {
556
+ return (teamId.split("_").at(-1) || teamId).slice(0, 6);
557
+ }
558
+ function resourcePart(value) {
559
+ const part = value.toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "");
560
+ return part || "unnamed";
561
+ }
562
+ function getTeamResourceParts(db, teamId) {
563
+ const row = db.query(`SELECT t.id as team_id, t.name as team_name, p.name as project_name
564
+ FROM team t
565
+ JOIN project p ON t.project_id = p.id
566
+ WHERE t.id = ?`).get(teamId);
567
+ if (!row)
568
+ throw new Error(`Team not found: ${teamId}`);
569
+ return { projectName: row.project_name, teamName: row.team_name, teamId: row.team_id };
570
+ }
571
+ function teamResourceSlug(projectName, teamName, teamId) {
572
+ return `${resourcePart(projectName)}-${resourcePart(teamName)}#${shortTeamId(teamId)}`;
573
+ }
574
+ function teamResourceSegment(teamName, teamId) {
575
+ return `${resourcePart(teamName)}#${shortTeamId(teamId)}`;
576
+ }
577
+ function teamWorktreeName(projectName, teamName, teamId, memberName) {
578
+ return `ensemble-${teamResourceSlug(projectName, teamName, teamId)}-${memberName}`;
579
+ }
81
580
  async function preserveBranch(sourceBranch, targetBranch, cwd) {
82
581
  const result = await runCommand(["git", "branch", targetBranch, sourceBranch], { cwd });
83
582
  if (result.exitCode !== 0) {
@@ -128,8 +627,8 @@ async function getOverlappingFiles(branch, cwd) {
128
627
  const localFiles = [...new Set([...localChanged, ...localUntracked])];
129
628
  return localFiles.filter((f) => agentFiles.has(f));
130
629
  }
131
- function preservedBranchName(teamName, memberName) {
132
- return `ensemble/preserved/${teamName}/${memberName}`;
630
+ function preservedBranchName(projectName, teamName, teamId, memberName) {
631
+ return `ensemble/preserved/${resourcePart(projectName)}/${teamResourceSegment(teamName, teamId)}/${resourcePart(memberName)}`;
133
632
  }
134
633
  var init_merge_helper = __esm(() => {
135
634
  init_process();
@@ -13321,6 +13820,94 @@ class HeyApiRegistry {
13321
13820
  }
13322
13821
  }
13323
13822
 
13823
+ class Auth extends HeyApiClient {
13824
+ remove(parameters, options) {
13825
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "providerID" }] }]);
13826
+ return (options?.client ?? this.client).delete({
13827
+ url: "/auth/{providerID}",
13828
+ ...options,
13829
+ ...params
13830
+ });
13831
+ }
13832
+ set(parameters, options) {
13833
+ const params = buildClientParams([parameters], [
13834
+ {
13835
+ args: [
13836
+ { in: "path", key: "providerID" },
13837
+ { key: "auth", map: "body" }
13838
+ ]
13839
+ }
13840
+ ]);
13841
+ return (options?.client ?? this.client).put({
13842
+ url: "/auth/{providerID}",
13843
+ ...options,
13844
+ ...params,
13845
+ headers: {
13846
+ "Content-Type": "application/json",
13847
+ ...options?.headers,
13848
+ ...params.headers
13849
+ }
13850
+ });
13851
+ }
13852
+ }
13853
+
13854
+ class App extends HeyApiClient {
13855
+ log(parameters, options) {
13856
+ const params = buildClientParams([parameters], [
13857
+ {
13858
+ args: [
13859
+ { in: "query", key: "directory" },
13860
+ { in: "query", key: "workspace" },
13861
+ { in: "body", key: "service" },
13862
+ { in: "body", key: "level" },
13863
+ { in: "body", key: "message" },
13864
+ { in: "body", key: "extra" }
13865
+ ]
13866
+ }
13867
+ ]);
13868
+ return (options?.client ?? this.client).post({
13869
+ url: "/log",
13870
+ ...options,
13871
+ ...params,
13872
+ headers: {
13873
+ "Content-Type": "application/json",
13874
+ ...options?.headers,
13875
+ ...params.headers
13876
+ }
13877
+ });
13878
+ }
13879
+ agents(parameters, options) {
13880
+ const params = buildClientParams([parameters], [
13881
+ {
13882
+ args: [
13883
+ { in: "query", key: "directory" },
13884
+ { in: "query", key: "workspace" }
13885
+ ]
13886
+ }
13887
+ ]);
13888
+ return (options?.client ?? this.client).get({
13889
+ url: "/agent",
13890
+ ...options,
13891
+ ...params
13892
+ });
13893
+ }
13894
+ skills(parameters, options) {
13895
+ const params = buildClientParams([parameters], [
13896
+ {
13897
+ args: [
13898
+ { in: "query", key: "directory" },
13899
+ { in: "query", key: "workspace" }
13900
+ ]
13901
+ }
13902
+ ]);
13903
+ return (options?.client ?? this.client).get({
13904
+ url: "/skill",
13905
+ ...options,
13906
+ ...params
13907
+ });
13908
+ }
13909
+ }
13910
+
13324
13911
  class Config extends HeyApiClient {
13325
13912
  get(options) {
13326
13913
  return (options?.client ?? this.client).get({
@@ -13381,39 +13968,26 @@ class Global extends HeyApiClient {
13381
13968
  }
13382
13969
  }
13383
13970
 
13384
- class Auth extends HeyApiClient {
13385
- remove(parameters, options) {
13386
- const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "providerID" }] }]);
13387
- return (options?.client ?? this.client).delete({
13388
- url: "/auth/{providerID}",
13389
- ...options,
13390
- ...params
13391
- });
13392
- }
13393
- set(parameters, options) {
13971
+ class Event extends HeyApiClient {
13972
+ subscribe(parameters, options) {
13394
13973
  const params = buildClientParams([parameters], [
13395
13974
  {
13396
13975
  args: [
13397
- { in: "path", key: "providerID" },
13398
- { key: "auth", map: "body" }
13976
+ { in: "query", key: "directory" },
13977
+ { in: "query", key: "workspace" }
13399
13978
  ]
13400
13979
  }
13401
13980
  ]);
13402
- return (options?.client ?? this.client).put({
13403
- url: "/auth/{providerID}",
13981
+ return (options?.client ?? this.client).sse.get({
13982
+ url: "/event",
13404
13983
  ...options,
13405
- ...params,
13406
- headers: {
13407
- "Content-Type": "application/json",
13408
- ...options?.headers,
13409
- ...params.headers
13410
- }
13984
+ ...params
13411
13985
  });
13412
13986
  }
13413
13987
  }
13414
13988
 
13415
- class Project extends HeyApiClient {
13416
- list(parameters, options) {
13989
+ class Config2 extends HeyApiClient {
13990
+ get(parameters, options) {
13417
13991
  const params = buildClientParams([parameters], [
13418
13992
  {
13419
13993
  args: [
@@ -13423,27 +13997,33 @@ class Project extends HeyApiClient {
13423
13997
  }
13424
13998
  ]);
13425
13999
  return (options?.client ?? this.client).get({
13426
- url: "/project",
14000
+ url: "/config",
13427
14001
  ...options,
13428
14002
  ...params
13429
14003
  });
13430
14004
  }
13431
- current(parameters, options) {
14005
+ update(parameters, options) {
13432
14006
  const params = buildClientParams([parameters], [
13433
14007
  {
13434
14008
  args: [
13435
14009
  { in: "query", key: "directory" },
13436
- { in: "query", key: "workspace" }
14010
+ { in: "query", key: "workspace" },
14011
+ { key: "config", map: "body" }
13437
14012
  ]
13438
14013
  }
13439
14014
  ]);
13440
- return (options?.client ?? this.client).get({
13441
- url: "/project/current",
14015
+ return (options?.client ?? this.client).patch({
14016
+ url: "/config",
13442
14017
  ...options,
13443
- ...params
14018
+ ...params,
14019
+ headers: {
14020
+ "Content-Type": "application/json",
14021
+ ...options?.headers,
14022
+ ...params.headers
14023
+ }
13444
14024
  });
13445
14025
  }
13446
- initGit(parameters, options) {
14026
+ providers(parameters, options) {
13447
14027
  const params = buildClientParams([parameters], [
13448
14028
  {
13449
14029
  args: [
@@ -13452,40 +14032,31 @@ class Project extends HeyApiClient {
13452
14032
  ]
13453
14033
  }
13454
14034
  ]);
13455
- return (options?.client ?? this.client).post({
13456
- url: "/project/git/init",
14035
+ return (options?.client ?? this.client).get({
14036
+ url: "/config/providers",
13457
14037
  ...options,
13458
14038
  ...params
13459
14039
  });
13460
14040
  }
13461
- update(parameters, options) {
14041
+ }
14042
+
14043
+ class Console extends HeyApiClient {
14044
+ get(parameters, options) {
13462
14045
  const params = buildClientParams([parameters], [
13463
14046
  {
13464
14047
  args: [
13465
- { in: "path", key: "projectID" },
13466
14048
  { in: "query", key: "directory" },
13467
- { in: "query", key: "workspace" },
13468
- { in: "body", key: "name" },
13469
- { in: "body", key: "icon" },
13470
- { in: "body", key: "commands" }
14049
+ { in: "query", key: "workspace" }
13471
14050
  ]
13472
14051
  }
13473
14052
  ]);
13474
- return (options?.client ?? this.client).patch({
13475
- url: "/project/{projectID}",
14053
+ return (options?.client ?? this.client).get({
14054
+ url: "/experimental/console",
13476
14055
  ...options,
13477
- ...params,
13478
- headers: {
13479
- "Content-Type": "application/json",
13480
- ...options?.headers,
13481
- ...params.headers
13482
- }
14056
+ ...params
13483
14057
  });
13484
14058
  }
13485
- }
13486
-
13487
- class Pty extends HeyApiClient {
13488
- list(parameters, options) {
14059
+ listOrgs(parameters, options) {
13489
14060
  const params = buildClientParams([parameters], [
13490
14061
  {
13491
14062
  args: [
@@ -13495,27 +14066,24 @@ class Pty extends HeyApiClient {
13495
14066
  }
13496
14067
  ]);
13497
14068
  return (options?.client ?? this.client).get({
13498
- url: "/pty",
14069
+ url: "/experimental/console/orgs",
13499
14070
  ...options,
13500
14071
  ...params
13501
14072
  });
13502
14073
  }
13503
- create(parameters, options) {
14074
+ switchOrg(parameters, options) {
13504
14075
  const params = buildClientParams([parameters], [
13505
14076
  {
13506
14077
  args: [
13507
14078
  { in: "query", key: "directory" },
13508
14079
  { in: "query", key: "workspace" },
13509
- { in: "body", key: "command" },
13510
- { in: "body", key: "args" },
13511
- { in: "body", key: "cwd" },
13512
- { in: "body", key: "title" },
13513
- { in: "body", key: "env" }
14080
+ { in: "body", key: "accountID" },
14081
+ { in: "body", key: "orgID" }
13514
14082
  ]
13515
14083
  }
13516
14084
  ]);
13517
14085
  return (options?.client ?? this.client).post({
13518
- url: "/pty",
14086
+ url: "/experimental/console/switch",
13519
14087
  ...options,
13520
14088
  ...params,
13521
14089
  headers: {
@@ -13525,81 +14093,70 @@ class Pty extends HeyApiClient {
13525
14093
  }
13526
14094
  });
13527
14095
  }
13528
- remove(parameters, options) {
14096
+ }
14097
+
14098
+ class Session extends HeyApiClient {
14099
+ list(parameters, options) {
13529
14100
  const params = buildClientParams([parameters], [
13530
14101
  {
13531
14102
  args: [
13532
- { in: "path", key: "ptyID" },
13533
14103
  { in: "query", key: "directory" },
13534
- { in: "query", key: "workspace" }
14104
+ { in: "query", key: "workspace" },
14105
+ { in: "query", key: "roots" },
14106
+ { in: "query", key: "start" },
14107
+ { in: "query", key: "cursor" },
14108
+ { in: "query", key: "search" },
14109
+ { in: "query", key: "limit" },
14110
+ { in: "query", key: "archived" }
13535
14111
  ]
13536
14112
  }
13537
14113
  ]);
13538
- return (options?.client ?? this.client).delete({
13539
- url: "/pty/{ptyID}",
14114
+ return (options?.client ?? this.client).get({
14115
+ url: "/experimental/session",
13540
14116
  ...options,
13541
14117
  ...params
13542
14118
  });
13543
14119
  }
13544
- get(parameters, options) {
14120
+ }
14121
+
14122
+ class Resource extends HeyApiClient {
14123
+ list(parameters, options) {
13545
14124
  const params = buildClientParams([parameters], [
13546
14125
  {
13547
14126
  args: [
13548
- { in: "path", key: "ptyID" },
13549
14127
  { in: "query", key: "directory" },
13550
14128
  { in: "query", key: "workspace" }
13551
14129
  ]
13552
14130
  }
13553
14131
  ]);
13554
14132
  return (options?.client ?? this.client).get({
13555
- url: "/pty/{ptyID}",
14133
+ url: "/experimental/resource",
13556
14134
  ...options,
13557
14135
  ...params
13558
14136
  });
13559
14137
  }
13560
- update(parameters, options) {
13561
- const params = buildClientParams([parameters], [
13562
- {
13563
- args: [
13564
- { in: "path", key: "ptyID" },
13565
- { in: "query", key: "directory" },
13566
- { in: "query", key: "workspace" },
13567
- { in: "body", key: "title" },
13568
- { in: "body", key: "size" }
13569
- ]
13570
- }
13571
- ]);
13572
- return (options?.client ?? this.client).put({
13573
- url: "/pty/{ptyID}",
13574
- ...options,
13575
- ...params,
13576
- headers: {
13577
- "Content-Type": "application/json",
13578
- ...options?.headers,
13579
- ...params.headers
13580
- }
13581
- });
13582
- }
13583
- connect(parameters, options) {
14138
+ }
14139
+
14140
+ class Adapter extends HeyApiClient {
14141
+ list(parameters, options) {
13584
14142
  const params = buildClientParams([parameters], [
13585
14143
  {
13586
14144
  args: [
13587
- { in: "path", key: "ptyID" },
13588
14145
  { in: "query", key: "directory" },
13589
14146
  { in: "query", key: "workspace" }
13590
14147
  ]
13591
14148
  }
13592
14149
  ]);
13593
14150
  return (options?.client ?? this.client).get({
13594
- url: "/pty/{ptyID}/connect",
14151
+ url: "/experimental/workspace/adapter",
13595
14152
  ...options,
13596
14153
  ...params
13597
14154
  });
13598
14155
  }
13599
14156
  }
13600
14157
 
13601
- class Config2 extends HeyApiClient {
13602
- get(parameters, options) {
14158
+ class Workspace extends HeyApiClient {
14159
+ list(parameters, options) {
13603
14160
  const params = buildClientParams([parameters], [
13604
14161
  {
13605
14162
  args: [
@@ -13609,23 +14166,26 @@ class Config2 extends HeyApiClient {
13609
14166
  }
13610
14167
  ]);
13611
14168
  return (options?.client ?? this.client).get({
13612
- url: "/config",
14169
+ url: "/experimental/workspace",
13613
14170
  ...options,
13614
14171
  ...params
13615
14172
  });
13616
14173
  }
13617
- update(parameters, options) {
14174
+ create(parameters, options) {
13618
14175
  const params = buildClientParams([parameters], [
13619
14176
  {
13620
14177
  args: [
13621
14178
  { in: "query", key: "directory" },
13622
14179
  { in: "query", key: "workspace" },
13623
- { key: "config", map: "body" }
14180
+ { in: "body", key: "id" },
14181
+ { in: "body", key: "type" },
14182
+ { in: "body", key: "branch" },
14183
+ { in: "body", key: "extra" }
13624
14184
  ]
13625
14185
  }
13626
14186
  ]);
13627
- return (options?.client ?? this.client).patch({
13628
- url: "/config",
14187
+ return (options?.client ?? this.client).post({
14188
+ url: "/experimental/workspace",
13629
14189
  ...options,
13630
14190
  ...params,
13631
14191
  headers: {
@@ -13635,7 +14195,7 @@ class Config2 extends HeyApiClient {
13635
14195
  }
13636
14196
  });
13637
14197
  }
13638
- providers(parameters, options) {
14198
+ syncList(parameters, options) {
13639
14199
  const params = buildClientParams([parameters], [
13640
14200
  {
13641
14201
  args: [
@@ -13644,16 +14204,13 @@ class Config2 extends HeyApiClient {
13644
14204
  ]
13645
14205
  }
13646
14206
  ]);
13647
- return (options?.client ?? this.client).get({
13648
- url: "/config/providers",
14207
+ return (options?.client ?? this.client).post({
14208
+ url: "/experimental/workspace/sync-list",
13649
14209
  ...options,
13650
14210
  ...params
13651
14211
  });
13652
14212
  }
13653
- }
13654
-
13655
- class Tool extends HeyApiClient {
13656
- ids(parameters, options) {
14213
+ status(parameters, options) {
13657
14214
  const params = buildClientParams([parameters], [
13658
14215
  {
13659
14216
  args: [
@@ -13663,61 +14220,41 @@ class Tool extends HeyApiClient {
13663
14220
  }
13664
14221
  ]);
13665
14222
  return (options?.client ?? this.client).get({
13666
- url: "/experimental/tool/ids",
13667
- ...options,
13668
- ...params
13669
- });
13670
- }
13671
- list(parameters, options) {
13672
- const params = buildClientParams([parameters], [
13673
- {
13674
- args: [
13675
- { in: "query", key: "directory" },
13676
- { in: "query", key: "workspace" },
13677
- { in: "query", key: "provider" },
13678
- { in: "query", key: "model" }
13679
- ]
13680
- }
13681
- ]);
13682
- return (options?.client ?? this.client).get({
13683
- url: "/experimental/tool",
14223
+ url: "/experimental/workspace/status",
13684
14224
  ...options,
13685
14225
  ...params
13686
14226
  });
13687
14227
  }
13688
- }
13689
-
13690
- class Workspace extends HeyApiClient {
13691
- list(parameters, options) {
14228
+ remove(parameters, options) {
13692
14229
  const params = buildClientParams([parameters], [
13693
14230
  {
13694
14231
  args: [
14232
+ { in: "path", key: "id" },
13695
14233
  { in: "query", key: "directory" },
13696
14234
  { in: "query", key: "workspace" }
13697
14235
  ]
13698
14236
  }
13699
14237
  ]);
13700
- return (options?.client ?? this.client).get({
13701
- url: "/experimental/workspace",
14238
+ return (options?.client ?? this.client).delete({
14239
+ url: "/experimental/workspace/{id}",
13702
14240
  ...options,
13703
14241
  ...params
13704
14242
  });
13705
14243
  }
13706
- create(parameters, options) {
14244
+ warp(parameters, options) {
13707
14245
  const params = buildClientParams([parameters], [
13708
14246
  {
13709
14247
  args: [
13710
14248
  { in: "query", key: "directory" },
13711
14249
  { in: "query", key: "workspace" },
13712
14250
  { in: "body", key: "id" },
13713
- { in: "body", key: "type" },
13714
- { in: "body", key: "branch" },
13715
- { in: "body", key: "extra" }
14251
+ { in: "body", key: "sessionID" },
14252
+ { in: "body", key: "copyChanges" }
13716
14253
  ]
13717
14254
  }
13718
14255
  ]);
13719
14256
  return (options?.client ?? this.client).post({
13720
- url: "/experimental/workspace",
14257
+ url: "/experimental/workspace/warp",
13721
14258
  ...options,
13722
14259
  ...params,
13723
14260
  headers: {
@@ -13727,50 +14264,50 @@ class Workspace extends HeyApiClient {
13727
14264
  }
13728
14265
  });
13729
14266
  }
13730
- remove(parameters, options) {
13731
- const params = buildClientParams([parameters], [
13732
- {
13733
- args: [
13734
- { in: "path", key: "id" },
13735
- { in: "query", key: "directory" },
13736
- { in: "query", key: "workspace" }
13737
- ]
13738
- }
13739
- ]);
13740
- return (options?.client ?? this.client).delete({
13741
- url: "/experimental/workspace/{id}",
13742
- ...options,
13743
- ...params
13744
- });
14267
+ _adapter;
14268
+ get adapter() {
14269
+ return this._adapter ??= new Adapter({ client: this.client });
13745
14270
  }
13746
14271
  }
13747
14272
 
13748
- class Session extends HeyApiClient {
14273
+ class Experimental extends HeyApiClient {
14274
+ _console;
14275
+ get console() {
14276
+ return this._console ??= new Console({ client: this.client });
14277
+ }
14278
+ _session;
14279
+ get session() {
14280
+ return this._session ??= new Session({ client: this.client });
14281
+ }
14282
+ _resource;
14283
+ get resource() {
14284
+ return this._resource ??= new Resource({ client: this.client });
14285
+ }
14286
+ _workspace;
14287
+ get workspace() {
14288
+ return this._workspace ??= new Workspace({ client: this.client });
14289
+ }
14290
+ }
14291
+
14292
+ class Tool extends HeyApiClient {
13749
14293
  list(parameters, options) {
13750
14294
  const params = buildClientParams([parameters], [
13751
14295
  {
13752
14296
  args: [
13753
14297
  { in: "query", key: "directory" },
13754
14298
  { in: "query", key: "workspace" },
13755
- { in: "query", key: "roots" },
13756
- { in: "query", key: "start" },
13757
- { in: "query", key: "cursor" },
13758
- { in: "query", key: "search" },
13759
- { in: "query", key: "limit" },
13760
- { in: "query", key: "archived" }
14299
+ { in: "query", key: "provider" },
14300
+ { in: "query", key: "model" }
13761
14301
  ]
13762
14302
  }
13763
14303
  ]);
13764
14304
  return (options?.client ?? this.client).get({
13765
- url: "/experimental/session",
14305
+ url: "/experimental/tool",
13766
14306
  ...options,
13767
14307
  ...params
13768
14308
  });
13769
14309
  }
13770
- }
13771
-
13772
- class Resource extends HeyApiClient {
13773
- list(parameters, options) {
14310
+ ids(parameters, options) {
13774
14311
  const params = buildClientParams([parameters], [
13775
14312
  {
13776
14313
  args: [
@@ -13780,28 +14317,13 @@ class Resource extends HeyApiClient {
13780
14317
  }
13781
14318
  ]);
13782
14319
  return (options?.client ?? this.client).get({
13783
- url: "/experimental/resource",
14320
+ url: "/experimental/tool/ids",
13784
14321
  ...options,
13785
14322
  ...params
13786
14323
  });
13787
14324
  }
13788
14325
  }
13789
14326
 
13790
- class Experimental extends HeyApiClient {
13791
- _workspace;
13792
- get workspace() {
13793
- return this._workspace ??= new Workspace({ client: this.client });
13794
- }
13795
- _session;
13796
- get session() {
13797
- return this._session ??= new Session({ client: this.client });
13798
- }
13799
- _resource;
13800
- get resource() {
13801
- return this._resource ??= new Resource({ client: this.client });
13802
- }
13803
- }
13804
-
13805
14327
  class Worktree extends HeyApiClient {
13806
14328
  remove(parameters, options) {
13807
14329
  const params = buildClientParams([parameters], [
@@ -13883,326 +14405,338 @@ class Worktree extends HeyApiClient {
13883
14405
  }
13884
14406
  }
13885
14407
 
13886
- class Session2 extends HeyApiClient {
13887
- list(parameters, options) {
14408
+ class Find extends HeyApiClient {
14409
+ text(parameters, options) {
13888
14410
  const params = buildClientParams([parameters], [
13889
14411
  {
13890
14412
  args: [
13891
14413
  { in: "query", key: "directory" },
13892
14414
  { in: "query", key: "workspace" },
13893
- { in: "query", key: "roots" },
13894
- { in: "query", key: "start" },
13895
- { in: "query", key: "search" },
13896
- { in: "query", key: "limit" }
14415
+ { in: "query", key: "pattern" }
13897
14416
  ]
13898
14417
  }
13899
14418
  ]);
13900
14419
  return (options?.client ?? this.client).get({
13901
- url: "/session",
14420
+ url: "/find",
13902
14421
  ...options,
13903
14422
  ...params
13904
14423
  });
13905
14424
  }
13906
- create(parameters, options) {
14425
+ files(parameters, options) {
13907
14426
  const params = buildClientParams([parameters], [
13908
14427
  {
13909
14428
  args: [
13910
14429
  { in: "query", key: "directory" },
13911
14430
  { in: "query", key: "workspace" },
13912
- { in: "body", key: "parentID" },
13913
- { in: "body", key: "title" },
13914
- { in: "body", key: "permission" },
13915
- { in: "body", key: "workspaceID" }
14431
+ { in: "query", key: "query" },
14432
+ { in: "query", key: "dirs" },
14433
+ { in: "query", key: "type" },
14434
+ { in: "query", key: "limit" }
13916
14435
  ]
13917
14436
  }
13918
14437
  ]);
13919
- return (options?.client ?? this.client).post({
13920
- url: "/session",
14438
+ return (options?.client ?? this.client).get({
14439
+ url: "/find/file",
13921
14440
  ...options,
13922
- ...params,
13923
- headers: {
13924
- "Content-Type": "application/json",
13925
- ...options?.headers,
13926
- ...params.headers
13927
- }
14441
+ ...params
13928
14442
  });
13929
14443
  }
13930
- status(parameters, options) {
14444
+ symbols(parameters, options) {
13931
14445
  const params = buildClientParams([parameters], [
13932
14446
  {
13933
14447
  args: [
13934
14448
  { in: "query", key: "directory" },
13935
- { in: "query", key: "workspace" }
14449
+ { in: "query", key: "workspace" },
14450
+ { in: "query", key: "query" }
13936
14451
  ]
13937
14452
  }
13938
14453
  ]);
13939
14454
  return (options?.client ?? this.client).get({
13940
- url: "/session/status",
14455
+ url: "/find/symbol",
13941
14456
  ...options,
13942
14457
  ...params
13943
14458
  });
13944
14459
  }
13945
- delete(parameters, options) {
14460
+ }
14461
+
14462
+ class File2 extends HeyApiClient {
14463
+ list(parameters, options) {
13946
14464
  const params = buildClientParams([parameters], [
13947
14465
  {
13948
14466
  args: [
13949
- { in: "path", key: "sessionID" },
13950
14467
  { in: "query", key: "directory" },
13951
- { in: "query", key: "workspace" }
14468
+ { in: "query", key: "workspace" },
14469
+ { in: "query", key: "path" }
13952
14470
  ]
13953
14471
  }
13954
14472
  ]);
13955
- return (options?.client ?? this.client).delete({
13956
- url: "/session/{sessionID}",
14473
+ return (options?.client ?? this.client).get({
14474
+ url: "/file",
13957
14475
  ...options,
13958
14476
  ...params
13959
14477
  });
13960
14478
  }
13961
- get(parameters, options) {
14479
+ read(parameters, options) {
13962
14480
  const params = buildClientParams([parameters], [
13963
14481
  {
13964
14482
  args: [
13965
- { in: "path", key: "sessionID" },
13966
14483
  { in: "query", key: "directory" },
13967
- { in: "query", key: "workspace" }
14484
+ { in: "query", key: "workspace" },
14485
+ { in: "query", key: "path" }
13968
14486
  ]
13969
14487
  }
13970
14488
  ]);
13971
14489
  return (options?.client ?? this.client).get({
13972
- url: "/session/{sessionID}",
14490
+ url: "/file/content",
13973
14491
  ...options,
13974
14492
  ...params
13975
14493
  });
13976
14494
  }
13977
- update(parameters, options) {
14495
+ status(parameters, options) {
13978
14496
  const params = buildClientParams([parameters], [
13979
14497
  {
13980
14498
  args: [
13981
- { in: "path", key: "sessionID" },
13982
14499
  { in: "query", key: "directory" },
13983
- { in: "query", key: "workspace" },
13984
- { in: "body", key: "title" },
13985
- { in: "body", key: "time" }
14500
+ { in: "query", key: "workspace" }
13986
14501
  ]
13987
14502
  }
13988
14503
  ]);
13989
- return (options?.client ?? this.client).patch({
13990
- url: "/session/{sessionID}",
14504
+ return (options?.client ?? this.client).get({
14505
+ url: "/file/status",
13991
14506
  ...options,
13992
- ...params,
13993
- headers: {
13994
- "Content-Type": "application/json",
13995
- ...options?.headers,
13996
- ...params.headers
14507
+ ...params
14508
+ });
14509
+ }
14510
+ }
14511
+
14512
+ class Instance extends HeyApiClient {
14513
+ dispose(parameters, options) {
14514
+ const params = buildClientParams([parameters], [
14515
+ {
14516
+ args: [
14517
+ { in: "query", key: "directory" },
14518
+ { in: "query", key: "workspace" }
14519
+ ]
13997
14520
  }
14521
+ ]);
14522
+ return (options?.client ?? this.client).post({
14523
+ url: "/instance/dispose",
14524
+ ...options,
14525
+ ...params
13998
14526
  });
13999
14527
  }
14000
- children(parameters, options) {
14528
+ }
14529
+
14530
+ class Path extends HeyApiClient {
14531
+ get(parameters, options) {
14001
14532
  const params = buildClientParams([parameters], [
14002
14533
  {
14003
14534
  args: [
14004
- { in: "path", key: "sessionID" },
14005
14535
  { in: "query", key: "directory" },
14006
14536
  { in: "query", key: "workspace" }
14007
14537
  ]
14008
14538
  }
14009
14539
  ]);
14010
14540
  return (options?.client ?? this.client).get({
14011
- url: "/session/{sessionID}/children",
14541
+ url: "/path",
14012
14542
  ...options,
14013
14543
  ...params
14014
14544
  });
14015
14545
  }
14016
- todo(parameters, options) {
14546
+ }
14547
+
14548
+ class Diff extends HeyApiClient {
14549
+ raw(parameters, options) {
14017
14550
  const params = buildClientParams([parameters], [
14018
14551
  {
14019
14552
  args: [
14020
- { in: "path", key: "sessionID" },
14021
14553
  { in: "query", key: "directory" },
14022
14554
  { in: "query", key: "workspace" }
14023
14555
  ]
14024
14556
  }
14025
14557
  ]);
14026
14558
  return (options?.client ?? this.client).get({
14027
- url: "/session/{sessionID}/todo",
14559
+ url: "/vcs/diff/raw",
14028
14560
  ...options,
14029
14561
  ...params
14030
14562
  });
14031
14563
  }
14032
- init(parameters, options) {
14564
+ }
14565
+
14566
+ class Vcs extends HeyApiClient {
14567
+ get(parameters, options) {
14033
14568
  const params = buildClientParams([parameters], [
14034
14569
  {
14035
14570
  args: [
14036
- { in: "path", key: "sessionID" },
14037
14571
  { in: "query", key: "directory" },
14038
- { in: "query", key: "workspace" },
14039
- { in: "body", key: "modelID" },
14040
- { in: "body", key: "providerID" },
14041
- { in: "body", key: "messageID" }
14572
+ { in: "query", key: "workspace" }
14042
14573
  ]
14043
14574
  }
14044
14575
  ]);
14045
- return (options?.client ?? this.client).post({
14046
- url: "/session/{sessionID}/init",
14576
+ return (options?.client ?? this.client).get({
14577
+ url: "/vcs",
14047
14578
  ...options,
14048
- ...params,
14049
- headers: {
14050
- "Content-Type": "application/json",
14051
- ...options?.headers,
14052
- ...params.headers
14579
+ ...params
14580
+ });
14581
+ }
14582
+ status(parameters, options) {
14583
+ const params = buildClientParams([parameters], [
14584
+ {
14585
+ args: [
14586
+ { in: "query", key: "directory" },
14587
+ { in: "query", key: "workspace" }
14588
+ ]
14053
14589
  }
14590
+ ]);
14591
+ return (options?.client ?? this.client).get({
14592
+ url: "/vcs/status",
14593
+ ...options,
14594
+ ...params
14054
14595
  });
14055
14596
  }
14056
- fork(parameters, options) {
14597
+ diff(parameters, options) {
14057
14598
  const params = buildClientParams([parameters], [
14058
14599
  {
14059
14600
  args: [
14060
- { in: "path", key: "sessionID" },
14061
14601
  { in: "query", key: "directory" },
14062
14602
  { in: "query", key: "workspace" },
14063
- { in: "body", key: "messageID" }
14603
+ { in: "query", key: "mode" }
14064
14604
  ]
14065
14605
  }
14066
14606
  ]);
14067
- return (options?.client ?? this.client).post({
14068
- url: "/session/{sessionID}/fork",
14607
+ return (options?.client ?? this.client).get({
14608
+ url: "/vcs/diff",
14069
14609
  ...options,
14070
- ...params,
14071
- headers: {
14072
- "Content-Type": "application/json",
14073
- ...options?.headers,
14074
- ...params.headers
14075
- }
14610
+ ...params
14076
14611
  });
14077
14612
  }
14078
- abort(parameters, options) {
14613
+ apply(parameters, options) {
14079
14614
  const params = buildClientParams([parameters], [
14080
14615
  {
14081
14616
  args: [
14082
- { in: "path", key: "sessionID" },
14083
14617
  { in: "query", key: "directory" },
14084
- { in: "query", key: "workspace" }
14618
+ { in: "query", key: "workspace" },
14619
+ { in: "body", key: "patch" }
14085
14620
  ]
14086
14621
  }
14087
14622
  ]);
14088
14623
  return (options?.client ?? this.client).post({
14089
- url: "/session/{sessionID}/abort",
14624
+ url: "/vcs/apply",
14090
14625
  ...options,
14091
- ...params
14626
+ ...params,
14627
+ headers: {
14628
+ "Content-Type": "application/json",
14629
+ ...options?.headers,
14630
+ ...params.headers
14631
+ }
14092
14632
  });
14093
14633
  }
14094
- unshare(parameters, options) {
14634
+ _diff;
14635
+ get diff2() {
14636
+ return this._diff ??= new Diff({ client: this.client });
14637
+ }
14638
+ }
14639
+
14640
+ class Command extends HeyApiClient {
14641
+ list(parameters, options) {
14095
14642
  const params = buildClientParams([parameters], [
14096
14643
  {
14097
14644
  args: [
14098
- { in: "path", key: "sessionID" },
14099
14645
  { in: "query", key: "directory" },
14100
14646
  { in: "query", key: "workspace" }
14101
14647
  ]
14102
14648
  }
14103
14649
  ]);
14104
- return (options?.client ?? this.client).delete({
14105
- url: "/session/{sessionID}/share",
14650
+ return (options?.client ?? this.client).get({
14651
+ url: "/command",
14106
14652
  ...options,
14107
14653
  ...params
14108
14654
  });
14109
14655
  }
14110
- share(parameters, options) {
14656
+ }
14657
+
14658
+ class Lsp extends HeyApiClient {
14659
+ status(parameters, options) {
14111
14660
  const params = buildClientParams([parameters], [
14112
14661
  {
14113
14662
  args: [
14114
- { in: "path", key: "sessionID" },
14115
14663
  { in: "query", key: "directory" },
14116
14664
  { in: "query", key: "workspace" }
14117
14665
  ]
14118
14666
  }
14119
14667
  ]);
14120
- return (options?.client ?? this.client).post({
14121
- url: "/session/{sessionID}/share",
14668
+ return (options?.client ?? this.client).get({
14669
+ url: "/lsp",
14122
14670
  ...options,
14123
14671
  ...params
14124
14672
  });
14125
14673
  }
14126
- diff(parameters, options) {
14674
+ }
14675
+
14676
+ class Formatter extends HeyApiClient {
14677
+ status(parameters, options) {
14127
14678
  const params = buildClientParams([parameters], [
14128
14679
  {
14129
14680
  args: [
14130
- { in: "path", key: "sessionID" },
14131
14681
  { in: "query", key: "directory" },
14132
- { in: "query", key: "workspace" },
14133
- { in: "query", key: "messageID" }
14682
+ { in: "query", key: "workspace" }
14134
14683
  ]
14135
14684
  }
14136
14685
  ]);
14137
14686
  return (options?.client ?? this.client).get({
14138
- url: "/session/{sessionID}/diff",
14687
+ url: "/formatter",
14139
14688
  ...options,
14140
14689
  ...params
14141
14690
  });
14142
14691
  }
14143
- summarize(parameters, options) {
14692
+ }
14693
+
14694
+ class Auth2 extends HeyApiClient {
14695
+ remove(parameters, options) {
14144
14696
  const params = buildClientParams([parameters], [
14145
14697
  {
14146
14698
  args: [
14147
- { in: "path", key: "sessionID" },
14699
+ { in: "path", key: "name" },
14148
14700
  { in: "query", key: "directory" },
14149
- { in: "query", key: "workspace" },
14150
- { in: "body", key: "providerID" },
14151
- { in: "body", key: "modelID" },
14152
- { in: "body", key: "auto" }
14701
+ { in: "query", key: "workspace" }
14153
14702
  ]
14154
14703
  }
14155
14704
  ]);
14156
- return (options?.client ?? this.client).post({
14157
- url: "/session/{sessionID}/summarize",
14705
+ return (options?.client ?? this.client).delete({
14706
+ url: "/mcp/{name}/auth",
14158
14707
  ...options,
14159
- ...params,
14160
- headers: {
14161
- "Content-Type": "application/json",
14162
- ...options?.headers,
14163
- ...params.headers
14164
- }
14708
+ ...params
14165
14709
  });
14166
14710
  }
14167
- messages(parameters, options) {
14711
+ start(parameters, options) {
14168
14712
  const params = buildClientParams([parameters], [
14169
14713
  {
14170
14714
  args: [
14171
- { in: "path", key: "sessionID" },
14715
+ { in: "path", key: "name" },
14172
14716
  { in: "query", key: "directory" },
14173
- { in: "query", key: "workspace" },
14174
- { in: "query", key: "limit" },
14175
- { in: "query", key: "before" }
14717
+ { in: "query", key: "workspace" }
14176
14718
  ]
14177
14719
  }
14178
14720
  ]);
14179
- return (options?.client ?? this.client).get({
14180
- url: "/session/{sessionID}/message",
14721
+ return (options?.client ?? this.client).post({
14722
+ url: "/mcp/{name}/auth",
14181
14723
  ...options,
14182
14724
  ...params
14183
14725
  });
14184
14726
  }
14185
- prompt(parameters, options) {
14727
+ callback(parameters, options) {
14186
14728
  const params = buildClientParams([parameters], [
14187
14729
  {
14188
14730
  args: [
14189
- { in: "path", key: "sessionID" },
14731
+ { in: "path", key: "name" },
14190
14732
  { in: "query", key: "directory" },
14191
14733
  { in: "query", key: "workspace" },
14192
- { in: "body", key: "messageID" },
14193
- { in: "body", key: "model" },
14194
- { in: "body", key: "agent" },
14195
- { in: "body", key: "noReply" },
14196
- { in: "body", key: "tools" },
14197
- { in: "body", key: "format" },
14198
- { in: "body", key: "system" },
14199
- { in: "body", key: "variant" },
14200
- { in: "body", key: "parts" }
14734
+ { in: "body", key: "code" }
14201
14735
  ]
14202
14736
  }
14203
14737
  ]);
14204
14738
  return (options?.client ?? this.client).post({
14205
- url: "/session/{sessionID}/message",
14739
+ url: "/mcp/{name}/auth/callback",
14206
14740
  ...options,
14207
14741
  ...params,
14208
14742
  headers: {
@@ -14212,61 +14746,53 @@ class Session2 extends HeyApiClient {
14212
14746
  }
14213
14747
  });
14214
14748
  }
14215
- deleteMessage(parameters, options) {
14749
+ authenticate(parameters, options) {
14216
14750
  const params = buildClientParams([parameters], [
14217
14751
  {
14218
14752
  args: [
14219
- { in: "path", key: "sessionID" },
14220
- { in: "path", key: "messageID" },
14753
+ { in: "path", key: "name" },
14221
14754
  { in: "query", key: "directory" },
14222
14755
  { in: "query", key: "workspace" }
14223
14756
  ]
14224
14757
  }
14225
14758
  ]);
14226
- return (options?.client ?? this.client).delete({
14227
- url: "/session/{sessionID}/message/{messageID}",
14759
+ return (options?.client ?? this.client).post({
14760
+ url: "/mcp/{name}/auth/authenticate",
14228
14761
  ...options,
14229
14762
  ...params
14230
14763
  });
14231
14764
  }
14232
- message(parameters, options) {
14765
+ }
14766
+
14767
+ class Mcp extends HeyApiClient {
14768
+ status(parameters, options) {
14233
14769
  const params = buildClientParams([parameters], [
14234
14770
  {
14235
14771
  args: [
14236
- { in: "path", key: "sessionID" },
14237
- { in: "path", key: "messageID" },
14238
14772
  { in: "query", key: "directory" },
14239
14773
  { in: "query", key: "workspace" }
14240
14774
  ]
14241
14775
  }
14242
14776
  ]);
14243
14777
  return (options?.client ?? this.client).get({
14244
- url: "/session/{sessionID}/message/{messageID}",
14778
+ url: "/mcp",
14245
14779
  ...options,
14246
14780
  ...params
14247
14781
  });
14248
14782
  }
14249
- promptAsync(parameters, options) {
14783
+ add(parameters, options) {
14250
14784
  const params = buildClientParams([parameters], [
14251
14785
  {
14252
14786
  args: [
14253
- { in: "path", key: "sessionID" },
14254
14787
  { in: "query", key: "directory" },
14255
14788
  { in: "query", key: "workspace" },
14256
- { in: "body", key: "messageID" },
14257
- { in: "body", key: "model" },
14258
- { in: "body", key: "agent" },
14259
- { in: "body", key: "noReply" },
14260
- { in: "body", key: "tools" },
14261
- { in: "body", key: "format" },
14262
- { in: "body", key: "system" },
14263
- { in: "body", key: "variant" },
14264
- { in: "body", key: "parts" }
14789
+ { in: "body", key: "name" },
14790
+ { in: "body", key: "config" }
14265
14791
  ]
14266
14792
  }
14267
14793
  ]);
14268
14794
  return (options?.client ?? this.client).post({
14269
- url: "/session/{sessionID}/prompt_async",
14795
+ url: "/mcp",
14270
14796
  ...options,
14271
14797
  ...params,
14272
14798
  headers: {
@@ -14276,114 +14802,86 @@ class Session2 extends HeyApiClient {
14276
14802
  }
14277
14803
  });
14278
14804
  }
14279
- command(parameters, options) {
14805
+ connect(parameters, options) {
14280
14806
  const params = buildClientParams([parameters], [
14281
14807
  {
14282
14808
  args: [
14283
- { in: "path", key: "sessionID" },
14809
+ { in: "path", key: "name" },
14284
14810
  { in: "query", key: "directory" },
14285
- { in: "query", key: "workspace" },
14286
- { in: "body", key: "messageID" },
14287
- { in: "body", key: "agent" },
14288
- { in: "body", key: "model" },
14289
- { in: "body", key: "arguments" },
14290
- { in: "body", key: "command" },
14291
- { in: "body", key: "variant" },
14292
- { in: "body", key: "parts" }
14811
+ { in: "query", key: "workspace" }
14293
14812
  ]
14294
14813
  }
14295
14814
  ]);
14296
14815
  return (options?.client ?? this.client).post({
14297
- url: "/session/{sessionID}/command",
14816
+ url: "/mcp/{name}/connect",
14298
14817
  ...options,
14299
- ...params,
14300
- headers: {
14301
- "Content-Type": "application/json",
14302
- ...options?.headers,
14303
- ...params.headers
14304
- }
14818
+ ...params
14305
14819
  });
14306
14820
  }
14307
- shell(parameters, options) {
14821
+ disconnect(parameters, options) {
14308
14822
  const params = buildClientParams([parameters], [
14309
14823
  {
14310
14824
  args: [
14311
- { in: "path", key: "sessionID" },
14825
+ { in: "path", key: "name" },
14312
14826
  { in: "query", key: "directory" },
14313
- { in: "query", key: "workspace" },
14314
- { in: "body", key: "agent" },
14315
- { in: "body", key: "model" },
14316
- { in: "body", key: "command" }
14827
+ { in: "query", key: "workspace" }
14317
14828
  ]
14318
14829
  }
14319
14830
  ]);
14320
14831
  return (options?.client ?? this.client).post({
14321
- url: "/session/{sessionID}/shell",
14832
+ url: "/mcp/{name}/disconnect",
14322
14833
  ...options,
14323
- ...params,
14324
- headers: {
14325
- "Content-Type": "application/json",
14326
- ...options?.headers,
14327
- ...params.headers
14328
- }
14834
+ ...params
14329
14835
  });
14330
14836
  }
14331
- revert(parameters, options) {
14837
+ _auth;
14838
+ get auth() {
14839
+ return this._auth ??= new Auth2({ client: this.client });
14840
+ }
14841
+ }
14842
+
14843
+ class Project extends HeyApiClient {
14844
+ list(parameters, options) {
14332
14845
  const params = buildClientParams([parameters], [
14333
14846
  {
14334
14847
  args: [
14335
- { in: "path", key: "sessionID" },
14336
14848
  { in: "query", key: "directory" },
14337
- { in: "query", key: "workspace" },
14338
- { in: "body", key: "messageID" },
14339
- { in: "body", key: "partID" }
14849
+ { in: "query", key: "workspace" }
14340
14850
  ]
14341
14851
  }
14342
14852
  ]);
14343
- return (options?.client ?? this.client).post({
14344
- url: "/session/{sessionID}/revert",
14853
+ return (options?.client ?? this.client).get({
14854
+ url: "/project",
14345
14855
  ...options,
14346
- ...params,
14347
- headers: {
14348
- "Content-Type": "application/json",
14349
- ...options?.headers,
14350
- ...params.headers
14351
- }
14856
+ ...params
14352
14857
  });
14353
14858
  }
14354
- unrevert(parameters, options) {
14859
+ current(parameters, options) {
14355
14860
  const params = buildClientParams([parameters], [
14356
14861
  {
14357
14862
  args: [
14358
- { in: "path", key: "sessionID" },
14359
14863
  { in: "query", key: "directory" },
14360
14864
  { in: "query", key: "workspace" }
14361
14865
  ]
14362
14866
  }
14363
14867
  ]);
14364
- return (options?.client ?? this.client).post({
14365
- url: "/session/{sessionID}/unrevert",
14868
+ return (options?.client ?? this.client).get({
14869
+ url: "/project/current",
14366
14870
  ...options,
14367
14871
  ...params
14368
14872
  });
14369
14873
  }
14370
- }
14371
-
14372
- class Part extends HeyApiClient {
14373
- delete(parameters, options) {
14874
+ initGit(parameters, options) {
14374
14875
  const params = buildClientParams([parameters], [
14375
14876
  {
14376
14877
  args: [
14377
- { in: "path", key: "sessionID" },
14378
- { in: "path", key: "messageID" },
14379
- { in: "path", key: "partID" },
14380
14878
  { in: "query", key: "directory" },
14381
14879
  { in: "query", key: "workspace" }
14382
14880
  ]
14383
14881
  }
14384
14882
  ]);
14385
- return (options?.client ?? this.client).delete({
14386
- url: "/session/{sessionID}/message/{messageID}/part/{partID}",
14883
+ return (options?.client ?? this.client).post({
14884
+ url: "/project/git/init",
14387
14885
  ...options,
14388
14886
  ...params
14389
14887
  });
@@ -14392,17 +14890,17 @@ class Part extends HeyApiClient {
14392
14890
  const params = buildClientParams([parameters], [
14393
14891
  {
14394
14892
  args: [
14395
- { in: "path", key: "sessionID" },
14396
- { in: "path", key: "messageID" },
14397
- { in: "path", key: "partID" },
14893
+ { in: "path", key: "projectID" },
14398
14894
  { in: "query", key: "directory" },
14399
14895
  { in: "query", key: "workspace" },
14400
- { key: "part", map: "body" }
14896
+ { in: "body", key: "name" },
14897
+ { in: "body", key: "icon" },
14898
+ { in: "body", key: "commands" }
14401
14899
  ]
14402
14900
  }
14403
14901
  ]);
14404
14902
  return (options?.client ?? this.client).patch({
14405
- url: "/session/{sessionID}/message/{messageID}/part/{partID}",
14903
+ url: "/project/{projectID}",
14406
14904
  ...options,
14407
14905
  ...params,
14408
14906
  headers: {
@@ -14414,21 +14912,53 @@ class Part extends HeyApiClient {
14414
14912
  }
14415
14913
  }
14416
14914
 
14417
- class Permission extends HeyApiClient {
14418
- respond(parameters, options) {
14915
+ class Pty extends HeyApiClient {
14916
+ shells(parameters, options) {
14917
+ const params = buildClientParams([parameters], [
14918
+ {
14919
+ args: [
14920
+ { in: "query", key: "directory" },
14921
+ { in: "query", key: "workspace" }
14922
+ ]
14923
+ }
14924
+ ]);
14925
+ return (options?.client ?? this.client).get({
14926
+ url: "/pty/shells",
14927
+ ...options,
14928
+ ...params
14929
+ });
14930
+ }
14931
+ list(parameters, options) {
14932
+ const params = buildClientParams([parameters], [
14933
+ {
14934
+ args: [
14935
+ { in: "query", key: "directory" },
14936
+ { in: "query", key: "workspace" }
14937
+ ]
14938
+ }
14939
+ ]);
14940
+ return (options?.client ?? this.client).get({
14941
+ url: "/pty",
14942
+ ...options,
14943
+ ...params
14944
+ });
14945
+ }
14946
+ create(parameters, options) {
14419
14947
  const params = buildClientParams([parameters], [
14420
14948
  {
14421
14949
  args: [
14422
- { in: "path", key: "sessionID" },
14423
- { in: "path", key: "permissionID" },
14424
14950
  { in: "query", key: "directory" },
14425
14951
  { in: "query", key: "workspace" },
14426
- { in: "body", key: "response" }
14952
+ { in: "body", key: "command" },
14953
+ { in: "body", key: "args" },
14954
+ { in: "body", key: "cwd" },
14955
+ { in: "body", key: "title" },
14956
+ { in: "body", key: "env" }
14427
14957
  ]
14428
14958
  }
14429
14959
  ]);
14430
14960
  return (options?.client ?? this.client).post({
14431
- url: "/session/{sessionID}/permissions/{permissionID}",
14961
+ url: "/pty",
14432
14962
  ...options,
14433
14963
  ...params,
14434
14964
  headers: {
@@ -14438,20 +14968,52 @@ class Permission extends HeyApiClient {
14438
14968
  }
14439
14969
  });
14440
14970
  }
14441
- reply(parameters, options) {
14971
+ remove(parameters, options) {
14442
14972
  const params = buildClientParams([parameters], [
14443
14973
  {
14444
14974
  args: [
14445
- { in: "path", key: "requestID" },
14975
+ { in: "path", key: "ptyID" },
14976
+ { in: "query", key: "directory" },
14977
+ { in: "query", key: "workspace" }
14978
+ ]
14979
+ }
14980
+ ]);
14981
+ return (options?.client ?? this.client).delete({
14982
+ url: "/pty/{ptyID}",
14983
+ ...options,
14984
+ ...params
14985
+ });
14986
+ }
14987
+ get(parameters, options) {
14988
+ const params = buildClientParams([parameters], [
14989
+ {
14990
+ args: [
14991
+ { in: "path", key: "ptyID" },
14992
+ { in: "query", key: "directory" },
14993
+ { in: "query", key: "workspace" }
14994
+ ]
14995
+ }
14996
+ ]);
14997
+ return (options?.client ?? this.client).get({
14998
+ url: "/pty/{ptyID}",
14999
+ ...options,
15000
+ ...params
15001
+ });
15002
+ }
15003
+ update(parameters, options) {
15004
+ const params = buildClientParams([parameters], [
15005
+ {
15006
+ args: [
15007
+ { in: "path", key: "ptyID" },
14446
15008
  { in: "query", key: "directory" },
14447
15009
  { in: "query", key: "workspace" },
14448
- { in: "body", key: "reply" },
14449
- { in: "body", key: "message" }
15010
+ { in: "body", key: "title" },
15011
+ { in: "body", key: "size" }
14450
15012
  ]
14451
15013
  }
14452
15014
  ]);
14453
- return (options?.client ?? this.client).post({
14454
- url: "/permission/{requestID}/reply",
15015
+ return (options?.client ?? this.client).put({
15016
+ url: "/pty/{ptyID}",
14455
15017
  ...options,
14456
15018
  ...params,
14457
15019
  headers: {
@@ -14461,17 +15023,34 @@ class Permission extends HeyApiClient {
14461
15023
  }
14462
15024
  });
14463
15025
  }
14464
- list(parameters, options) {
15026
+ connectToken(parameters, options) {
15027
+ const params = buildClientParams([parameters], [
15028
+ {
15029
+ args: [
15030
+ { in: "path", key: "ptyID" },
15031
+ { in: "query", key: "directory" },
15032
+ { in: "query", key: "workspace" }
15033
+ ]
15034
+ }
15035
+ ]);
15036
+ return (options?.client ?? this.client).post({
15037
+ url: "/pty/{ptyID}/connect-token",
15038
+ ...options,
15039
+ ...params
15040
+ });
15041
+ }
15042
+ connect(parameters, options) {
14465
15043
  const params = buildClientParams([parameters], [
14466
15044
  {
14467
15045
  args: [
15046
+ { in: "path", key: "ptyID" },
14468
15047
  { in: "query", key: "directory" },
14469
15048
  { in: "query", key: "workspace" }
14470
15049
  ]
14471
15050
  }
14472
15051
  ]);
14473
15052
  return (options?.client ?? this.client).get({
14474
- url: "/permission",
15053
+ url: "/pty/{ptyID}/connect",
14475
15054
  ...options,
14476
15055
  ...params
14477
15056
  });
@@ -14534,6 +15113,70 @@ class Question extends HeyApiClient {
14534
15113
  }
14535
15114
  }
14536
15115
 
15116
+ class Permission extends HeyApiClient {
15117
+ list(parameters, options) {
15118
+ const params = buildClientParams([parameters], [
15119
+ {
15120
+ args: [
15121
+ { in: "query", key: "directory" },
15122
+ { in: "query", key: "workspace" }
15123
+ ]
15124
+ }
15125
+ ]);
15126
+ return (options?.client ?? this.client).get({
15127
+ url: "/permission",
15128
+ ...options,
15129
+ ...params
15130
+ });
15131
+ }
15132
+ reply(parameters, options) {
15133
+ const params = buildClientParams([parameters], [
15134
+ {
15135
+ args: [
15136
+ { in: "path", key: "requestID" },
15137
+ { in: "query", key: "directory" },
15138
+ { in: "query", key: "workspace" },
15139
+ { in: "body", key: "reply" },
15140
+ { in: "body", key: "message" }
15141
+ ]
15142
+ }
15143
+ ]);
15144
+ return (options?.client ?? this.client).post({
15145
+ url: "/permission/{requestID}/reply",
15146
+ ...options,
15147
+ ...params,
15148
+ headers: {
15149
+ "Content-Type": "application/json",
15150
+ ...options?.headers,
15151
+ ...params.headers
15152
+ }
15153
+ });
15154
+ }
15155
+ respond(parameters, options) {
15156
+ const params = buildClientParams([parameters], [
15157
+ {
15158
+ args: [
15159
+ { in: "path", key: "sessionID" },
15160
+ { in: "path", key: "permissionID" },
15161
+ { in: "query", key: "directory" },
15162
+ { in: "query", key: "workspace" },
15163
+ { in: "body", key: "response" }
15164
+ ]
15165
+ }
15166
+ ]);
15167
+ return (options?.client ?? this.client).post({
15168
+ url: "/session/{sessionID}/permissions/{permissionID}",
15169
+ ...options,
15170
+ ...params,
15171
+ headers: {
15172
+ "Content-Type": "application/json",
15173
+ ...options?.headers,
15174
+ ...params.headers
15175
+ }
15176
+ });
15177
+ }
15178
+ }
15179
+
14537
15180
  class Oauth extends HeyApiClient {
14538
15181
  authorize(parameters, options) {
14539
15182
  const params = buildClientParams([parameters], [
@@ -14620,174 +15263,213 @@ class Provider extends HeyApiClient {
14620
15263
  }
14621
15264
  }
14622
15265
 
14623
- class Find extends HeyApiClient {
14624
- text(parameters, options) {
15266
+ class Session2 extends HeyApiClient {
15267
+ list(parameters, options) {
14625
15268
  const params = buildClientParams([parameters], [
14626
15269
  {
14627
15270
  args: [
14628
15271
  { in: "query", key: "directory" },
14629
15272
  { in: "query", key: "workspace" },
14630
- { in: "query", key: "pattern" }
15273
+ { in: "query", key: "scope" },
15274
+ { in: "query", key: "path" },
15275
+ { in: "query", key: "roots" },
15276
+ { in: "query", key: "start" },
15277
+ { in: "query", key: "search" },
15278
+ { in: "query", key: "limit" }
14631
15279
  ]
14632
15280
  }
14633
15281
  ]);
14634
15282
  return (options?.client ?? this.client).get({
14635
- url: "/find",
15283
+ url: "/session",
14636
15284
  ...options,
14637
15285
  ...params
14638
15286
  });
14639
15287
  }
14640
- files(parameters, options) {
15288
+ create(parameters, options) {
14641
15289
  const params = buildClientParams([parameters], [
14642
15290
  {
14643
15291
  args: [
14644
15292
  { in: "query", key: "directory" },
14645
15293
  { in: "query", key: "workspace" },
14646
- { in: "query", key: "query" },
14647
- { in: "query", key: "dirs" },
14648
- { in: "query", key: "type" },
14649
- { in: "query", key: "limit" }
15294
+ { in: "body", key: "parentID" },
15295
+ { in: "body", key: "title" },
15296
+ { in: "body", key: "agent" },
15297
+ { in: "body", key: "model" },
15298
+ { in: "body", key: "permission" },
15299
+ { in: "body", key: "workspaceID" }
15300
+ ]
15301
+ }
15302
+ ]);
15303
+ return (options?.client ?? this.client).post({
15304
+ url: "/session",
15305
+ ...options,
15306
+ ...params,
15307
+ headers: {
15308
+ "Content-Type": "application/json",
15309
+ ...options?.headers,
15310
+ ...params.headers
15311
+ }
15312
+ });
15313
+ }
15314
+ status(parameters, options) {
15315
+ const params = buildClientParams([parameters], [
15316
+ {
15317
+ args: [
15318
+ { in: "query", key: "directory" },
15319
+ { in: "query", key: "workspace" }
14650
15320
  ]
14651
15321
  }
14652
15322
  ]);
14653
15323
  return (options?.client ?? this.client).get({
14654
- url: "/find/file",
15324
+ url: "/session/status",
14655
15325
  ...options,
14656
15326
  ...params
14657
15327
  });
14658
15328
  }
14659
- symbols(parameters, options) {
15329
+ delete(parameters, options) {
14660
15330
  const params = buildClientParams([parameters], [
14661
15331
  {
14662
15332
  args: [
15333
+ { in: "path", key: "sessionID" },
14663
15334
  { in: "query", key: "directory" },
14664
- { in: "query", key: "workspace" },
14665
- { in: "query", key: "query" }
15335
+ { in: "query", key: "workspace" }
14666
15336
  ]
14667
15337
  }
14668
15338
  ]);
14669
- return (options?.client ?? this.client).get({
14670
- url: "/find/symbol",
15339
+ return (options?.client ?? this.client).delete({
15340
+ url: "/session/{sessionID}",
14671
15341
  ...options,
14672
15342
  ...params
14673
15343
  });
14674
15344
  }
14675
- }
14676
-
14677
- class File2 extends HeyApiClient {
14678
- list(parameters, options) {
15345
+ get(parameters, options) {
14679
15346
  const params = buildClientParams([parameters], [
14680
15347
  {
14681
15348
  args: [
15349
+ { in: "path", key: "sessionID" },
14682
15350
  { in: "query", key: "directory" },
14683
- { in: "query", key: "workspace" },
14684
- { in: "query", key: "path" }
15351
+ { in: "query", key: "workspace" }
14685
15352
  ]
14686
15353
  }
14687
15354
  ]);
14688
15355
  return (options?.client ?? this.client).get({
14689
- url: "/file",
15356
+ url: "/session/{sessionID}",
14690
15357
  ...options,
14691
15358
  ...params
14692
15359
  });
14693
15360
  }
14694
- read(parameters, options) {
15361
+ update(parameters, options) {
14695
15362
  const params = buildClientParams([parameters], [
14696
15363
  {
14697
15364
  args: [
15365
+ { in: "path", key: "sessionID" },
14698
15366
  { in: "query", key: "directory" },
14699
15367
  { in: "query", key: "workspace" },
14700
- { in: "query", key: "path" }
15368
+ { in: "body", key: "title" },
15369
+ { in: "body", key: "permission" },
15370
+ { in: "body", key: "time" }
14701
15371
  ]
14702
15372
  }
14703
15373
  ]);
14704
- return (options?.client ?? this.client).get({
14705
- url: "/file/content",
15374
+ return (options?.client ?? this.client).patch({
15375
+ url: "/session/{sessionID}",
14706
15376
  ...options,
14707
- ...params
15377
+ ...params,
15378
+ headers: {
15379
+ "Content-Type": "application/json",
15380
+ ...options?.headers,
15381
+ ...params.headers
15382
+ }
14708
15383
  });
14709
15384
  }
14710
- status(parameters, options) {
15385
+ children(parameters, options) {
14711
15386
  const params = buildClientParams([parameters], [
14712
15387
  {
14713
15388
  args: [
15389
+ { in: "path", key: "sessionID" },
14714
15390
  { in: "query", key: "directory" },
14715
15391
  { in: "query", key: "workspace" }
14716
15392
  ]
14717
15393
  }
14718
15394
  ]);
14719
15395
  return (options?.client ?? this.client).get({
14720
- url: "/file/status",
15396
+ url: "/session/{sessionID}/children",
14721
15397
  ...options,
14722
15398
  ...params
14723
15399
  });
14724
15400
  }
14725
- }
14726
-
14727
- class Event extends HeyApiClient {
14728
- subscribe(parameters, options) {
15401
+ todo(parameters, options) {
14729
15402
  const params = buildClientParams([parameters], [
14730
15403
  {
14731
15404
  args: [
15405
+ { in: "path", key: "sessionID" },
14732
15406
  { in: "query", key: "directory" },
14733
15407
  { in: "query", key: "workspace" }
14734
15408
  ]
14735
15409
  }
14736
15410
  ]);
14737
- return (options?.client ?? this.client).sse.get({
14738
- url: "/event",
15411
+ return (options?.client ?? this.client).get({
15412
+ url: "/session/{sessionID}/todo",
14739
15413
  ...options,
14740
15414
  ...params
14741
15415
  });
14742
15416
  }
14743
- }
14744
-
14745
- class Auth2 extends HeyApiClient {
14746
- remove(parameters, options) {
15417
+ diff(parameters, options) {
14747
15418
  const params = buildClientParams([parameters], [
14748
15419
  {
14749
15420
  args: [
14750
- { in: "path", key: "name" },
15421
+ { in: "path", key: "sessionID" },
14751
15422
  { in: "query", key: "directory" },
14752
- { in: "query", key: "workspace" }
15423
+ { in: "query", key: "workspace" },
15424
+ { in: "query", key: "messageID" }
14753
15425
  ]
14754
15426
  }
14755
15427
  ]);
14756
- return (options?.client ?? this.client).delete({
14757
- url: "/mcp/{name}/auth",
15428
+ return (options?.client ?? this.client).get({
15429
+ url: "/session/{sessionID}/diff",
14758
15430
  ...options,
14759
15431
  ...params
14760
15432
  });
14761
15433
  }
14762
- start(parameters, options) {
15434
+ messages(parameters, options) {
14763
15435
  const params = buildClientParams([parameters], [
14764
15436
  {
14765
15437
  args: [
14766
- { in: "path", key: "name" },
15438
+ { in: "path", key: "sessionID" },
14767
15439
  { in: "query", key: "directory" },
14768
- { in: "query", key: "workspace" }
15440
+ { in: "query", key: "workspace" },
15441
+ { in: "query", key: "limit" },
15442
+ { in: "query", key: "before" }
14769
15443
  ]
14770
15444
  }
14771
15445
  ]);
14772
- return (options?.client ?? this.client).post({
14773
- url: "/mcp/{name}/auth",
15446
+ return (options?.client ?? this.client).get({
15447
+ url: "/session/{sessionID}/message",
14774
15448
  ...options,
14775
15449
  ...params
14776
15450
  });
14777
15451
  }
14778
- callback(parameters, options) {
15452
+ prompt(parameters, options) {
14779
15453
  const params = buildClientParams([parameters], [
14780
15454
  {
14781
15455
  args: [
14782
- { in: "path", key: "name" },
15456
+ { in: "path", key: "sessionID" },
14783
15457
  { in: "query", key: "directory" },
14784
15458
  { in: "query", key: "workspace" },
14785
- { in: "body", key: "code" }
15459
+ { in: "body", key: "messageID" },
15460
+ { in: "body", key: "model" },
15461
+ { in: "body", key: "agent" },
15462
+ { in: "body", key: "noReply" },
15463
+ { in: "body", key: "tools" },
15464
+ { in: "body", key: "format" },
15465
+ { in: "body", key: "system" },
15466
+ { in: "body", key: "variant" },
15467
+ { in: "body", key: "parts" }
14786
15468
  ]
14787
15469
  }
14788
15470
  ]);
14789
15471
  return (options?.client ?? this.client).post({
14790
- url: "/mcp/{name}/auth/callback",
15472
+ url: "/session/{sessionID}/message",
14791
15473
  ...options,
14792
15474
  ...params,
14793
15475
  headers: {
@@ -14797,53 +15479,53 @@ class Auth2 extends HeyApiClient {
14797
15479
  }
14798
15480
  });
14799
15481
  }
14800
- authenticate(parameters, options) {
15482
+ deleteMessage(parameters, options) {
14801
15483
  const params = buildClientParams([parameters], [
14802
15484
  {
14803
15485
  args: [
14804
- { in: "path", key: "name" },
15486
+ { in: "path", key: "sessionID" },
15487
+ { in: "path", key: "messageID" },
14805
15488
  { in: "query", key: "directory" },
14806
15489
  { in: "query", key: "workspace" }
14807
15490
  ]
14808
15491
  }
14809
15492
  ]);
14810
- return (options?.client ?? this.client).post({
14811
- url: "/mcp/{name}/auth/authenticate",
15493
+ return (options?.client ?? this.client).delete({
15494
+ url: "/session/{sessionID}/message/{messageID}",
14812
15495
  ...options,
14813
15496
  ...params
14814
15497
  });
14815
15498
  }
14816
- }
14817
-
14818
- class Mcp extends HeyApiClient {
14819
- status(parameters, options) {
15499
+ message(parameters, options) {
14820
15500
  const params = buildClientParams([parameters], [
14821
15501
  {
14822
15502
  args: [
15503
+ { in: "path", key: "sessionID" },
15504
+ { in: "path", key: "messageID" },
14823
15505
  { in: "query", key: "directory" },
14824
15506
  { in: "query", key: "workspace" }
14825
15507
  ]
14826
15508
  }
14827
15509
  ]);
14828
15510
  return (options?.client ?? this.client).get({
14829
- url: "/mcp",
15511
+ url: "/session/{sessionID}/message/{messageID}",
14830
15512
  ...options,
14831
15513
  ...params
14832
15514
  });
14833
15515
  }
14834
- add(parameters, options) {
15516
+ fork(parameters, options) {
14835
15517
  const params = buildClientParams([parameters], [
14836
15518
  {
14837
15519
  args: [
15520
+ { in: "path", key: "sessionID" },
14838
15521
  { in: "query", key: "directory" },
14839
15522
  { in: "query", key: "workspace" },
14840
- { in: "body", key: "name" },
14841
- { in: "body", key: "config" }
15523
+ { in: "body", key: "messageID" }
14842
15524
  ]
14843
15525
  }
14844
15526
  ]);
14845
15527
  return (options?.client ?? this.client).post({
14846
- url: "/mcp",
15528
+ url: "/session/{sessionID}/fork",
14847
15529
  ...options,
14848
15530
  ...params,
14849
15531
  headers: {
@@ -14853,41 +15535,532 @@ class Mcp extends HeyApiClient {
14853
15535
  }
14854
15536
  });
14855
15537
  }
14856
- connect(parameters, options) {
15538
+ abort(parameters, options) {
14857
15539
  const params = buildClientParams([parameters], [
14858
15540
  {
14859
15541
  args: [
14860
- { in: "path", key: "name" },
15542
+ { in: "path", key: "sessionID" },
14861
15543
  { in: "query", key: "directory" },
14862
15544
  { in: "query", key: "workspace" }
14863
15545
  ]
14864
15546
  }
14865
15547
  ]);
14866
15548
  return (options?.client ?? this.client).post({
14867
- url: "/mcp/{name}/connect",
15549
+ url: "/session/{sessionID}/abort",
15550
+ ...options,
15551
+ ...params
15552
+ });
15553
+ }
15554
+ init(parameters, options) {
15555
+ const params = buildClientParams([parameters], [
15556
+ {
15557
+ args: [
15558
+ { in: "path", key: "sessionID" },
15559
+ { in: "query", key: "directory" },
15560
+ { in: "query", key: "workspace" },
15561
+ { in: "body", key: "modelID" },
15562
+ { in: "body", key: "providerID" },
15563
+ { in: "body", key: "messageID" }
15564
+ ]
15565
+ }
15566
+ ]);
15567
+ return (options?.client ?? this.client).post({
15568
+ url: "/session/{sessionID}/init",
15569
+ ...options,
15570
+ ...params,
15571
+ headers: {
15572
+ "Content-Type": "application/json",
15573
+ ...options?.headers,
15574
+ ...params.headers
15575
+ }
15576
+ });
15577
+ }
15578
+ unshare(parameters, options) {
15579
+ const params = buildClientParams([parameters], [
15580
+ {
15581
+ args: [
15582
+ { in: "path", key: "sessionID" },
15583
+ { in: "query", key: "directory" },
15584
+ { in: "query", key: "workspace" }
15585
+ ]
15586
+ }
15587
+ ]);
15588
+ return (options?.client ?? this.client).delete({
15589
+ url: "/session/{sessionID}/share",
15590
+ ...options,
15591
+ ...params
15592
+ });
15593
+ }
15594
+ share(parameters, options) {
15595
+ const params = buildClientParams([parameters], [
15596
+ {
15597
+ args: [
15598
+ { in: "path", key: "sessionID" },
15599
+ { in: "query", key: "directory" },
15600
+ { in: "query", key: "workspace" }
15601
+ ]
15602
+ }
15603
+ ]);
15604
+ return (options?.client ?? this.client).post({
15605
+ url: "/session/{sessionID}/share",
15606
+ ...options,
15607
+ ...params
15608
+ });
15609
+ }
15610
+ summarize(parameters, options) {
15611
+ const params = buildClientParams([parameters], [
15612
+ {
15613
+ args: [
15614
+ { in: "path", key: "sessionID" },
15615
+ { in: "query", key: "directory" },
15616
+ { in: "query", key: "workspace" },
15617
+ { in: "body", key: "providerID" },
15618
+ { in: "body", key: "modelID" },
15619
+ { in: "body", key: "auto" }
15620
+ ]
15621
+ }
15622
+ ]);
15623
+ return (options?.client ?? this.client).post({
15624
+ url: "/session/{sessionID}/summarize",
15625
+ ...options,
15626
+ ...params,
15627
+ headers: {
15628
+ "Content-Type": "application/json",
15629
+ ...options?.headers,
15630
+ ...params.headers
15631
+ }
15632
+ });
15633
+ }
15634
+ promptAsync(parameters, options) {
15635
+ const params = buildClientParams([parameters], [
15636
+ {
15637
+ args: [
15638
+ { in: "path", key: "sessionID" },
15639
+ { in: "query", key: "directory" },
15640
+ { in: "query", key: "workspace" },
15641
+ { in: "body", key: "messageID" },
15642
+ { in: "body", key: "model" },
15643
+ { in: "body", key: "agent" },
15644
+ { in: "body", key: "noReply" },
15645
+ { in: "body", key: "tools" },
15646
+ { in: "body", key: "format" },
15647
+ { in: "body", key: "system" },
15648
+ { in: "body", key: "variant" },
15649
+ { in: "body", key: "parts" }
15650
+ ]
15651
+ }
15652
+ ]);
15653
+ return (options?.client ?? this.client).post({
15654
+ url: "/session/{sessionID}/prompt_async",
15655
+ ...options,
15656
+ ...params,
15657
+ headers: {
15658
+ "Content-Type": "application/json",
15659
+ ...options?.headers,
15660
+ ...params.headers
15661
+ }
15662
+ });
15663
+ }
15664
+ command(parameters, options) {
15665
+ const params = buildClientParams([parameters], [
15666
+ {
15667
+ args: [
15668
+ { in: "path", key: "sessionID" },
15669
+ { in: "query", key: "directory" },
15670
+ { in: "query", key: "workspace" },
15671
+ { in: "body", key: "messageID" },
15672
+ { in: "body", key: "agent" },
15673
+ { in: "body", key: "model" },
15674
+ { in: "body", key: "arguments" },
15675
+ { in: "body", key: "command" },
15676
+ { in: "body", key: "variant" },
15677
+ { in: "body", key: "parts" }
15678
+ ]
15679
+ }
15680
+ ]);
15681
+ return (options?.client ?? this.client).post({
15682
+ url: "/session/{sessionID}/command",
15683
+ ...options,
15684
+ ...params,
15685
+ headers: {
15686
+ "Content-Type": "application/json",
15687
+ ...options?.headers,
15688
+ ...params.headers
15689
+ }
15690
+ });
15691
+ }
15692
+ shell(parameters, options) {
15693
+ const params = buildClientParams([parameters], [
15694
+ {
15695
+ args: [
15696
+ { in: "path", key: "sessionID" },
15697
+ { in: "query", key: "directory" },
15698
+ { in: "query", key: "workspace" },
15699
+ { in: "body", key: "messageID" },
15700
+ { in: "body", key: "agent" },
15701
+ { in: "body", key: "model" },
15702
+ { in: "body", key: "command" }
15703
+ ]
15704
+ }
15705
+ ]);
15706
+ return (options?.client ?? this.client).post({
15707
+ url: "/session/{sessionID}/shell",
15708
+ ...options,
15709
+ ...params,
15710
+ headers: {
15711
+ "Content-Type": "application/json",
15712
+ ...options?.headers,
15713
+ ...params.headers
15714
+ }
15715
+ });
15716
+ }
15717
+ revert(parameters, options) {
15718
+ const params = buildClientParams([parameters], [
15719
+ {
15720
+ args: [
15721
+ { in: "path", key: "sessionID" },
15722
+ { in: "query", key: "directory" },
15723
+ { in: "query", key: "workspace" },
15724
+ { in: "body", key: "messageID" },
15725
+ { in: "body", key: "partID" }
15726
+ ]
15727
+ }
15728
+ ]);
15729
+ return (options?.client ?? this.client).post({
15730
+ url: "/session/{sessionID}/revert",
15731
+ ...options,
15732
+ ...params,
15733
+ headers: {
15734
+ "Content-Type": "application/json",
15735
+ ...options?.headers,
15736
+ ...params.headers
15737
+ }
15738
+ });
15739
+ }
15740
+ unrevert(parameters, options) {
15741
+ const params = buildClientParams([parameters], [
15742
+ {
15743
+ args: [
15744
+ { in: "path", key: "sessionID" },
15745
+ { in: "query", key: "directory" },
15746
+ { in: "query", key: "workspace" }
15747
+ ]
15748
+ }
15749
+ ]);
15750
+ return (options?.client ?? this.client).post({
15751
+ url: "/session/{sessionID}/unrevert",
15752
+ ...options,
15753
+ ...params
15754
+ });
15755
+ }
15756
+ }
15757
+
15758
+ class Part extends HeyApiClient {
15759
+ delete(parameters, options) {
15760
+ const params = buildClientParams([parameters], [
15761
+ {
15762
+ args: [
15763
+ { in: "path", key: "sessionID" },
15764
+ { in: "path", key: "messageID" },
15765
+ { in: "path", key: "partID" },
15766
+ { in: "query", key: "directory" },
15767
+ { in: "query", key: "workspace" }
15768
+ ]
15769
+ }
15770
+ ]);
15771
+ return (options?.client ?? this.client).delete({
15772
+ url: "/session/{sessionID}/message/{messageID}/part/{partID}",
15773
+ ...options,
15774
+ ...params
15775
+ });
15776
+ }
15777
+ update(parameters, options) {
15778
+ const params = buildClientParams([parameters], [
15779
+ {
15780
+ args: [
15781
+ { in: "path", key: "sessionID" },
15782
+ { in: "path", key: "messageID" },
15783
+ { in: "path", key: "partID" },
15784
+ { in: "query", key: "directory" },
15785
+ { in: "query", key: "workspace" },
15786
+ { key: "part", map: "body" }
15787
+ ]
15788
+ }
15789
+ ]);
15790
+ return (options?.client ?? this.client).patch({
15791
+ url: "/session/{sessionID}/message/{messageID}/part/{partID}",
15792
+ ...options,
15793
+ ...params,
15794
+ headers: {
15795
+ "Content-Type": "application/json",
15796
+ ...options?.headers,
15797
+ ...params.headers
15798
+ }
15799
+ });
15800
+ }
15801
+ }
15802
+
15803
+ class History extends HeyApiClient {
15804
+ list(parameters, options) {
15805
+ const params = buildClientParams([parameters], [
15806
+ {
15807
+ args: [
15808
+ { in: "query", key: "directory" },
15809
+ { in: "query", key: "workspace" },
15810
+ { key: "body", map: "body" }
15811
+ ]
15812
+ }
15813
+ ]);
15814
+ return (options?.client ?? this.client).post({
15815
+ url: "/sync/history",
15816
+ ...options,
15817
+ ...params,
15818
+ headers: {
15819
+ "Content-Type": "application/json",
15820
+ ...options?.headers,
15821
+ ...params.headers
15822
+ }
15823
+ });
15824
+ }
15825
+ }
15826
+
15827
+ class Sync extends HeyApiClient {
15828
+ start(parameters, options) {
15829
+ const params = buildClientParams([parameters], [
15830
+ {
15831
+ args: [
15832
+ { in: "query", key: "directory" },
15833
+ { in: "query", key: "workspace" }
15834
+ ]
15835
+ }
15836
+ ]);
15837
+ return (options?.client ?? this.client).post({
15838
+ url: "/sync/start",
15839
+ ...options,
15840
+ ...params
15841
+ });
15842
+ }
15843
+ replay(parameters, options) {
15844
+ const params = buildClientParams([parameters], [
15845
+ {
15846
+ args: [
15847
+ {
15848
+ in: "query",
15849
+ key: "query_directory",
15850
+ map: "directory"
15851
+ },
15852
+ { in: "query", key: "workspace" },
15853
+ {
15854
+ in: "body",
15855
+ key: "body_directory",
15856
+ map: "directory"
15857
+ },
15858
+ { in: "body", key: "events" }
15859
+ ]
15860
+ }
15861
+ ]);
15862
+ return (options?.client ?? this.client).post({
15863
+ url: "/sync/replay",
15864
+ ...options,
15865
+ ...params,
15866
+ headers: {
15867
+ "Content-Type": "application/json",
15868
+ ...options?.headers,
15869
+ ...params.headers
15870
+ }
15871
+ });
15872
+ }
15873
+ steal(parameters, options) {
15874
+ const params = buildClientParams([parameters], [
15875
+ {
15876
+ args: [
15877
+ { in: "query", key: "directory" },
15878
+ { in: "query", key: "workspace" },
15879
+ { in: "body", key: "sessionID" }
15880
+ ]
15881
+ }
15882
+ ]);
15883
+ return (options?.client ?? this.client).post({
15884
+ url: "/sync/steal",
15885
+ ...options,
15886
+ ...params,
15887
+ headers: {
15888
+ "Content-Type": "application/json",
15889
+ ...options?.headers,
15890
+ ...params.headers
15891
+ }
15892
+ });
15893
+ }
15894
+ _history;
15895
+ get history() {
15896
+ return this._history ??= new History({ client: this.client });
15897
+ }
15898
+ }
15899
+
15900
+ class Session3 extends HeyApiClient {
15901
+ list(parameters, options) {
15902
+ const params = buildClientParams([parameters], [
15903
+ {
15904
+ args: [
15905
+ { in: "query", key: "directory" },
15906
+ { in: "query", key: "workspace" },
15907
+ { in: "query", key: "limit" },
15908
+ { in: "query", key: "order" },
15909
+ { in: "query", key: "path" },
15910
+ { in: "query", key: "roots" },
15911
+ { in: "query", key: "start" },
15912
+ { in: "query", key: "search" },
15913
+ { in: "query", key: "cursor" }
15914
+ ]
15915
+ }
15916
+ ]);
15917
+ return (options?.client ?? this.client).get({
15918
+ url: "/api/session",
15919
+ ...options,
15920
+ ...params
15921
+ });
15922
+ }
15923
+ prompt(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
+ { in: "body", key: "prompt" },
15931
+ { in: "body", key: "delivery" }
15932
+ ]
15933
+ }
15934
+ ]);
15935
+ return (options?.client ?? this.client).post({
15936
+ url: "/api/session/{sessionID}/prompt",
15937
+ ...options,
15938
+ ...params,
15939
+ headers: {
15940
+ "Content-Type": "application/json",
15941
+ ...options?.headers,
15942
+ ...params.headers
15943
+ }
15944
+ });
15945
+ }
15946
+ compact(parameters, options) {
15947
+ const params = buildClientParams([parameters], [
15948
+ {
15949
+ args: [
15950
+ { in: "path", key: "sessionID" },
15951
+ { in: "query", key: "directory" },
15952
+ { in: "query", key: "workspace" }
15953
+ ]
15954
+ }
15955
+ ]);
15956
+ return (options?.client ?? this.client).post({
15957
+ url: "/api/session/{sessionID}/compact",
15958
+ ...options,
15959
+ ...params
15960
+ });
15961
+ }
15962
+ wait(parameters, options) {
15963
+ const params = buildClientParams([parameters], [
15964
+ {
15965
+ args: [
15966
+ { in: "path", key: "sessionID" },
15967
+ { in: "query", key: "directory" },
15968
+ { in: "query", key: "workspace" }
15969
+ ]
15970
+ }
15971
+ ]);
15972
+ return (options?.client ?? this.client).post({
15973
+ url: "/api/session/{sessionID}/wait",
15974
+ ...options,
15975
+ ...params
15976
+ });
15977
+ }
15978
+ context(parameters, options) {
15979
+ const params = buildClientParams([parameters], [
15980
+ {
15981
+ args: [
15982
+ { in: "path", key: "sessionID" },
15983
+ { in: "query", key: "directory" },
15984
+ { in: "query", key: "workspace" }
15985
+ ]
15986
+ }
15987
+ ]);
15988
+ return (options?.client ?? this.client).get({
15989
+ url: "/api/session/{sessionID}/context",
15990
+ ...options,
15991
+ ...params
15992
+ });
15993
+ }
15994
+ messages(parameters, options) {
15995
+ const params = buildClientParams([parameters], [
15996
+ {
15997
+ args: [
15998
+ { in: "path", key: "sessionID" },
15999
+ { in: "query", key: "directory" },
16000
+ { in: "query", key: "workspace" },
16001
+ { in: "query", key: "limit" },
16002
+ { in: "query", key: "order" },
16003
+ { in: "query", key: "cursor" }
16004
+ ]
16005
+ }
16006
+ ]);
16007
+ return (options?.client ?? this.client).get({
16008
+ url: "/api/session/{sessionID}/message",
16009
+ ...options,
16010
+ ...params
16011
+ });
16012
+ }
16013
+ }
16014
+
16015
+ class Model extends HeyApiClient {
16016
+ list(parameters, options) {
16017
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
16018
+ return (options?.client ?? this.client).get({
16019
+ url: "/api/model",
14868
16020
  ...options,
14869
16021
  ...params
14870
16022
  });
14871
16023
  }
14872
- disconnect(parameters, options) {
16024
+ }
16025
+
16026
+ class Provider2 extends HeyApiClient {
16027
+ list(parameters, options) {
16028
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
16029
+ return (options?.client ?? this.client).get({
16030
+ url: "/api/provider",
16031
+ ...options,
16032
+ ...params
16033
+ });
16034
+ }
16035
+ get(parameters, options) {
14873
16036
  const params = buildClientParams([parameters], [
14874
16037
  {
14875
16038
  args: [
14876
- { in: "path", key: "name" },
14877
- { in: "query", key: "directory" },
14878
- { in: "query", key: "workspace" }
16039
+ { in: "path", key: "providerID" },
16040
+ { in: "query", key: "location" }
14879
16041
  ]
14880
16042
  }
14881
16043
  ]);
14882
- return (options?.client ?? this.client).post({
14883
- url: "/mcp/{name}/disconnect",
16044
+ return (options?.client ?? this.client).get({
16045
+ url: "/api/provider/{providerID}",
14884
16046
  ...options,
14885
16047
  ...params
14886
16048
  });
14887
16049
  }
14888
- _auth;
14889
- get auth() {
14890
- return this._auth ??= new Auth2({ client: this.client });
16050
+ }
16051
+
16052
+ class V2 extends HeyApiClient {
16053
+ _session;
16054
+ get session() {
16055
+ return this._session ??= new Session3({ client: this.client });
16056
+ }
16057
+ _model;
16058
+ get model() {
16059
+ return this._model ??= new Model({ client: this.client });
16060
+ }
16061
+ _provider;
16062
+ get provider() {
16063
+ return this._provider ??= new Provider2({ client: this.client });
14891
16064
  }
14892
16065
  }
14893
16066
 
@@ -15135,248 +16308,51 @@ class Tui extends HeyApiClient {
15135
16308
  }
15136
16309
  }
15137
16310
 
15138
- class Instance extends HeyApiClient {
15139
- dispose(parameters, options) {
15140
- const params = buildClientParams([parameters], [
15141
- {
15142
- args: [
15143
- { in: "query", key: "directory" },
15144
- { in: "query", key: "workspace" }
15145
- ]
15146
- }
15147
- ]);
15148
- return (options?.client ?? this.client).post({
15149
- url: "/instance/dispose",
15150
- ...options,
15151
- ...params
15152
- });
15153
- }
15154
- }
15155
-
15156
- class Path extends HeyApiClient {
15157
- get(parameters, options) {
15158
- const params = buildClientParams([parameters], [
15159
- {
15160
- args: [
15161
- { in: "query", key: "directory" },
15162
- { in: "query", key: "workspace" }
15163
- ]
15164
- }
15165
- ]);
15166
- return (options?.client ?? this.client).get({
15167
- url: "/path",
15168
- ...options,
15169
- ...params
15170
- });
15171
- }
15172
- }
15173
-
15174
- class Vcs extends HeyApiClient {
15175
- get(parameters, options) {
15176
- const params = buildClientParams([parameters], [
15177
- {
15178
- args: [
15179
- { in: "query", key: "directory" },
15180
- { in: "query", key: "workspace" }
15181
- ]
15182
- }
15183
- ]);
15184
- return (options?.client ?? this.client).get({
15185
- url: "/vcs",
15186
- ...options,
15187
- ...params
15188
- });
15189
- }
15190
- }
15191
-
15192
- class Command extends HeyApiClient {
15193
- list(parameters, options) {
15194
- const params = buildClientParams([parameters], [
15195
- {
15196
- args: [
15197
- { in: "query", key: "directory" },
15198
- { in: "query", key: "workspace" }
15199
- ]
15200
- }
15201
- ]);
15202
- return (options?.client ?? this.client).get({
15203
- url: "/command",
15204
- ...options,
15205
- ...params
15206
- });
15207
- }
15208
- }
15209
-
15210
- class App extends HeyApiClient {
15211
- log(parameters, options) {
15212
- const params = buildClientParams([parameters], [
15213
- {
15214
- args: [
15215
- { in: "query", key: "directory" },
15216
- { in: "query", key: "workspace" },
15217
- { in: "body", key: "service" },
15218
- { in: "body", key: "level" },
15219
- { in: "body", key: "message" },
15220
- { in: "body", key: "extra" }
15221
- ]
15222
- }
15223
- ]);
15224
- return (options?.client ?? this.client).post({
15225
- url: "/log",
15226
- ...options,
15227
- ...params,
15228
- headers: {
15229
- "Content-Type": "application/json",
15230
- ...options?.headers,
15231
- ...params.headers
15232
- }
15233
- });
15234
- }
15235
- agents(parameters, options) {
15236
- const params = buildClientParams([parameters], [
15237
- {
15238
- args: [
15239
- { in: "query", key: "directory" },
15240
- { in: "query", key: "workspace" }
15241
- ]
15242
- }
15243
- ]);
15244
- return (options?.client ?? this.client).get({
15245
- url: "/agent",
15246
- ...options,
15247
- ...params
15248
- });
15249
- }
15250
- skills(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: "/skill",
15261
- ...options,
15262
- ...params
15263
- });
15264
- }
15265
- }
15266
-
15267
- class Lsp extends HeyApiClient {
15268
- status(parameters, options) {
15269
- const params = buildClientParams([parameters], [
15270
- {
15271
- args: [
15272
- { in: "query", key: "directory" },
15273
- { in: "query", key: "workspace" }
15274
- ]
15275
- }
15276
- ]);
15277
- return (options?.client ?? this.client).get({
15278
- url: "/lsp",
15279
- ...options,
15280
- ...params
15281
- });
15282
- }
15283
- }
15284
-
15285
- class Formatter extends HeyApiClient {
15286
- status(parameters, options) {
15287
- const params = buildClientParams([parameters], [
15288
- {
15289
- args: [
15290
- { in: "query", key: "directory" },
15291
- { in: "query", key: "workspace" }
15292
- ]
15293
- }
15294
- ]);
15295
- return (options?.client ?? this.client).get({
15296
- url: "/formatter",
15297
- ...options,
15298
- ...params
15299
- });
15300
- }
15301
- }
15302
-
15303
16311
  class OpencodeClient extends HeyApiClient {
15304
16312
  static __registry = new HeyApiRegistry;
15305
16313
  constructor(args) {
15306
16314
  super(args);
15307
16315
  OpencodeClient.__registry.set(this, args?.key);
15308
16316
  }
15309
- _global;
15310
- get global() {
15311
- return this._global ??= new Global({ client: this.client });
15312
- }
15313
16317
  _auth;
15314
16318
  get auth() {
15315
16319
  return this._auth ??= new Auth({ client: this.client });
15316
16320
  }
15317
- _project;
15318
- get project() {
15319
- return this._project ??= new Project({ client: this.client });
16321
+ _app;
16322
+ get app() {
16323
+ return this._app ??= new App({ client: this.client });
15320
16324
  }
15321
- _pty;
15322
- get pty() {
15323
- return this._pty ??= new Pty({ client: this.client });
16325
+ _global;
16326
+ get global() {
16327
+ return this._global ??= new Global({ client: this.client });
16328
+ }
16329
+ _event;
16330
+ get event() {
16331
+ return this._event ??= new Event({ client: this.client });
15324
16332
  }
15325
16333
  _config;
15326
16334
  get config() {
15327
16335
  return this._config ??= new Config2({ client: this.client });
15328
16336
  }
15329
- _tool;
15330
- get tool() {
15331
- return this._tool ??= new Tool({ client: this.client });
15332
- }
15333
16337
  _experimental;
15334
16338
  get experimental() {
15335
16339
  return this._experimental ??= new Experimental({ client: this.client });
15336
16340
  }
16341
+ _tool;
16342
+ get tool() {
16343
+ return this._tool ??= new Tool({ client: this.client });
16344
+ }
15337
16345
  _worktree;
15338
16346
  get worktree() {
15339
16347
  return this._worktree ??= new Worktree({ client: this.client });
15340
16348
  }
15341
- _session;
15342
- get session() {
15343
- return this._session ??= new Session2({ client: this.client });
15344
- }
15345
- _part;
15346
- get part() {
15347
- return this._part ??= new Part({ client: this.client });
15348
- }
15349
- _permission;
15350
- get permission() {
15351
- return this._permission ??= new Permission({ client: this.client });
15352
- }
15353
- _question;
15354
- get question() {
15355
- return this._question ??= new Question({ client: this.client });
15356
- }
15357
- _provider;
15358
- get provider() {
15359
- return this._provider ??= new Provider({ client: this.client });
15360
- }
15361
16349
  _find;
15362
16350
  get find() {
15363
16351
  return this._find ??= new Find({ client: this.client });
15364
16352
  }
15365
16353
  _file;
15366
- get file() {
15367
- return this._file ??= new File2({ client: this.client });
15368
- }
15369
- _event;
15370
- get event() {
15371
- return this._event ??= new Event({ client: this.client });
15372
- }
15373
- _mcp;
15374
- get mcp() {
15375
- return this._mcp ??= new Mcp({ client: this.client });
15376
- }
15377
- _tui;
15378
- get tui() {
15379
- return this._tui ??= new Tui({ client: this.client });
16354
+ get file() {
16355
+ return this._file ??= new File2({ client: this.client });
15380
16356
  }
15381
16357
  _instance;
15382
16358
  get instance() {
@@ -15394,10 +16370,6 @@ class OpencodeClient extends HeyApiClient {
15394
16370
  get command() {
15395
16371
  return this._command ??= new Command({ client: this.client });
15396
16372
  }
15397
- _app;
15398
- get app() {
15399
- return this._app ??= new App({ client: this.client });
15400
- }
15401
16373
  _lsp;
15402
16374
  get lsp() {
15403
16375
  return this._lsp ??= new Lsp({ client: this.client });
@@ -15406,13 +16378,59 @@ class OpencodeClient extends HeyApiClient {
15406
16378
  get formatter() {
15407
16379
  return this._formatter ??= new Formatter({ client: this.client });
15408
16380
  }
16381
+ _mcp;
16382
+ get mcp() {
16383
+ return this._mcp ??= new Mcp({ client: this.client });
16384
+ }
16385
+ _project;
16386
+ get project() {
16387
+ return this._project ??= new Project({ client: this.client });
16388
+ }
16389
+ _pty;
16390
+ get pty() {
16391
+ return this._pty ??= new Pty({ client: this.client });
16392
+ }
16393
+ _question;
16394
+ get question() {
16395
+ return this._question ??= new Question({ client: this.client });
16396
+ }
16397
+ _permission;
16398
+ get permission() {
16399
+ return this._permission ??= new Permission({ client: this.client });
16400
+ }
16401
+ _provider;
16402
+ get provider() {
16403
+ return this._provider ??= new Provider({ client: this.client });
16404
+ }
16405
+ _session;
16406
+ get session() {
16407
+ return this._session ??= new Session2({ client: this.client });
16408
+ }
16409
+ _part;
16410
+ get part() {
16411
+ return this._part ??= new Part({ client: this.client });
16412
+ }
16413
+ _sync;
16414
+ get sync() {
16415
+ return this._sync ??= new Sync({ client: this.client });
16416
+ }
16417
+ _v2;
16418
+ get v2() {
16419
+ return this._v2 ??= new V2({ client: this.client });
16420
+ }
16421
+ _tui;
16422
+ get tui() {
16423
+ return this._tui ??= new Tui({ client: this.client });
16424
+ }
15409
16425
  }
16426
+ // node_modules/@opencode-ai/sdk/dist/v2/server.js
16427
+ var import_cross_spawn = __toESM(require_cross_spawn(), 1);
15410
16428
  // src/index.ts
15411
16429
  import path3 from "node:path";
15412
16430
  import { mkdirSync } from "node:fs";
15413
16431
 
15414
16432
  // src/db.ts
15415
- import { createRequire } from "node:module";
16433
+ import { createRequire as createRequire2 } from "node:module";
15416
16434
  import path from "node:path";
15417
16435
 
15418
16436
  // src/schema.ts
@@ -15489,26 +16507,142 @@ var MIGRATIONS = [
15489
16507
  CHECK(plan_approval IN ('none', 'pending', 'approved', 'rejected'));`,
15490
16508
  `ALTER TABLE team ADD COLUMN lead_agent TEXT;`,
15491
16509
  `ALTER TABLE team_member ADD COLUMN workspace_id TEXT;`,
15492
- `ALTER TABLE team_member ADD COLUMN reported_to_lead INTEGER NOT NULL DEFAULT 0;`
16510
+ `ALTER TABLE team_member ADD COLUMN reported_to_lead INTEGER NOT NULL DEFAULT 0;`,
16511
+ `PRAGMA foreign_keys=OFF;
16512
+ ALTER TABLE team RENAME TO team_old_m8;
16513
+ CREATE TABLE IF NOT EXISTS project (
16514
+ id TEXT PRIMARY KEY,
16515
+ name TEXT NOT NULL,
16516
+ path TEXT NOT NULL,
16517
+ status TEXT NOT NULL DEFAULT 'active' CHECK(status IN ('active', 'archived')),
16518
+ time_created INTEGER NOT NULL,
16519
+ time_updated INTEGER NOT NULL
16520
+ );
16521
+ INSERT OR IGNORE INTO project (id, name, path, status, time_created, time_updated)
16522
+ VALUES ('default', 'Default Project', '', 'active', strftime('%s','now') * 1000, strftime('%s','now') * 1000);
16523
+ CREATE TABLE team (
16524
+ id TEXT PRIMARY KEY,
16525
+ name TEXT NOT NULL,
16526
+ project_id TEXT NOT NULL DEFAULT 'default' REFERENCES project(id) ON DELETE CASCADE,
16527
+ lead_session_id TEXT NOT NULL,
16528
+ status TEXT NOT NULL DEFAULT 'active' CHECK(status IN ('active', 'archived')),
16529
+ delegate INTEGER NOT NULL DEFAULT 0,
16530
+ time_created INTEGER NOT NULL,
16531
+ time_updated INTEGER NOT NULL,
16532
+ lead_agent TEXT
16533
+ );
16534
+ INSERT INTO team (id, name, project_id, lead_session_id, status, delegate, time_created, time_updated, lead_agent)
16535
+ SELECT id, name, 'default', lead_session_id, status, delegate, time_created, time_updated, lead_agent FROM team_old_m8;
16536
+ DROP TABLE team_old_m8;
16537
+
16538
+ ALTER TABLE team_member RENAME TO team_member_old_m8;
16539
+ CREATE TABLE team_member (
16540
+ team_id TEXT NOT NULL REFERENCES team(id) ON DELETE CASCADE,
16541
+ name TEXT NOT NULL,
16542
+ session_id TEXT NOT NULL,
16543
+ agent TEXT NOT NULL,
16544
+ status TEXT NOT NULL DEFAULT 'ready'
16545
+ CHECK(status IN ('ready', 'busy', 'shutdown_requested', 'shutdown', 'error')),
16546
+ execution_status TEXT NOT NULL DEFAULT 'idle'
16547
+ CHECK(execution_status IN ('idle', 'starting', 'running',
16548
+ 'cancel_requested', 'cancelling', 'cancelled',
16549
+ 'completing', 'completed', 'failed', 'timed_out')),
16550
+ model TEXT,
16551
+ prompt TEXT,
16552
+ time_created INTEGER NOT NULL,
16553
+ time_updated INTEGER NOT NULL,
16554
+ worktree_dir TEXT,
16555
+ worktree_branch TEXT,
16556
+ plan_approval TEXT NOT NULL DEFAULT 'none'
16557
+ CHECK(plan_approval IN ('none', 'pending', 'approved', 'rejected')),
16558
+ workspace_id TEXT,
16559
+ reported_to_lead INTEGER NOT NULL DEFAULT 0,
16560
+ PRIMARY KEY (team_id, name)
16561
+ );
16562
+ INSERT INTO team_member (team_id, name, session_id, agent, status, execution_status, model, prompt, time_created, time_updated, worktree_dir, worktree_branch, plan_approval, workspace_id, reported_to_lead)
16563
+ SELECT team_id, name, session_id, agent, status, execution_status, model, prompt, time_created, time_updated, worktree_dir, worktree_branch, plan_approval, workspace_id, reported_to_lead FROM team_member_old_m8;
16564
+ DROP TABLE team_member_old_m8;
16565
+
16566
+ ALTER TABLE team_task RENAME TO team_task_old_m8;
16567
+ CREATE TABLE team_task (
16568
+ id TEXT PRIMARY KEY,
16569
+ team_id TEXT NOT NULL REFERENCES team(id) ON DELETE CASCADE,
16570
+ content TEXT NOT NULL,
16571
+ status TEXT NOT NULL DEFAULT 'pending'
16572
+ CHECK(status IN ('pending', 'in_progress', 'completed', 'cancelled', 'blocked')),
16573
+ priority TEXT NOT NULL DEFAULT 'medium'
16574
+ CHECK(priority IN ('high', 'medium', 'low')),
16575
+ assignee TEXT,
16576
+ depends_on TEXT,
16577
+ time_created INTEGER NOT NULL,
16578
+ time_updated INTEGER NOT NULL
16579
+ );
16580
+ INSERT INTO team_task (id, team_id, content, status, priority, assignee, depends_on, time_created, time_updated)
16581
+ SELECT id, team_id, content, status, priority, assignee, depends_on, time_created, time_updated FROM team_task_old_m8;
16582
+ DROP TABLE team_task_old_m8;
16583
+
16584
+ ALTER TABLE team_message RENAME TO team_message_old_m8;
16585
+ CREATE TABLE team_message (
16586
+ id TEXT PRIMARY KEY,
16587
+ team_id TEXT NOT NULL REFERENCES team(id) ON DELETE CASCADE,
16588
+ from_name TEXT NOT NULL,
16589
+ to_name TEXT,
16590
+ content TEXT NOT NULL,
16591
+ delivered INTEGER NOT NULL DEFAULT 0,
16592
+ time_created INTEGER NOT NULL,
16593
+ read INTEGER NOT NULL DEFAULT 0
16594
+ );
16595
+ INSERT INTO team_message (id, team_id, from_name, to_name, content, delivered, time_created, read)
16596
+ SELECT id, team_id, from_name, to_name, content, delivered, time_created, read FROM team_message_old_m8;
16597
+ DROP TABLE team_message_old_m8;
16598
+
16599
+ CREATE INDEX IF NOT EXISTS team_lead_idx ON team(lead_session_id);
16600
+ CREATE INDEX IF NOT EXISTS team_status_idx ON team(status);
16601
+ CREATE INDEX IF NOT EXISTS team_project_idx ON team(project_id, status);
16602
+ CREATE UNIQUE INDEX IF NOT EXISTS team_active_project_name_idx ON team(project_id, name) WHERE status = 'active';
16603
+ CREATE INDEX IF NOT EXISTS team_member_session_idx ON team_member(session_id);
16604
+ CREATE INDEX IF NOT EXISTS team_member_status_idx ON team_member(team_id, status);
16605
+ CREATE INDEX IF NOT EXISTS team_task_team_idx ON team_task(team_id);
16606
+ CREATE INDEX IF NOT EXISTS team_task_assignee_idx ON team_task(assignee);
16607
+ CREATE INDEX IF NOT EXISTS team_task_status_idx ON team_task(team_id, status);
16608
+ CREATE INDEX IF NOT EXISTS team_message_team_idx ON team_message(team_id);
16609
+ CREATE INDEX IF NOT EXISTS team_message_to_idx ON team_message(to_name);
16610
+ CREATE INDEX IF NOT EXISTS team_message_undelivered_idx ON team_message(team_id, delivered) WHERE delivered = 0;
16611
+ CREATE INDEX IF NOT EXISTS team_message_unread_idx ON team_message(team_id, read) WHERE read = 0;
16612
+ PRAGMA foreign_keys=ON;`
15493
16613
  ];
15494
16614
  function applyMigrations(db) {
15495
16615
  const { user_version: current } = db.query("PRAGMA user_version").get();
16616
+ if (current > MIGRATIONS.length) {
16617
+ throw new Error(`Database schema version ${current} is newer than this plugin supports (${MIGRATIONS.length}). Upgrade opencode-ensemble before continuing.`);
16618
+ }
15496
16619
  for (let i = current;i < MIGRATIONS.length; i++) {
15497
16620
  const migration = MIGRATIONS[i];
15498
- if (migration)
15499
- db.exec(migration);
15500
- db.exec(`PRAGMA user_version = ${i + 1}`);
16621
+ const { foreign_keys: foreignKeys } = db.query("PRAGMA foreign_keys").get();
16622
+ db.exec("PRAGMA foreign_keys = OFF");
16623
+ db.exec("BEGIN IMMEDIATE");
16624
+ try {
16625
+ if (migration)
16626
+ db.exec(migration);
16627
+ db.exec(`PRAGMA user_version = ${i + 1}`);
16628
+ db.exec("COMMIT");
16629
+ } catch (err) {
16630
+ db.exec("ROLLBACK");
16631
+ throw err;
16632
+ } finally {
16633
+ db.exec(`PRAGMA foreign_keys = ${foreignKeys ? "ON" : "OFF"}`);
16634
+ }
15501
16635
  }
15502
16636
  }
15503
16637
 
15504
16638
  // src/db.ts
15505
- var requireRuntimeModule = createRequire(import.meta.url);
16639
+ var requireRuntimeModule = createRequire2(import.meta.url);
15506
16640
  var instance;
15507
16641
 
15508
16642
  class NodeSqliteAdapter {
15509
16643
  db;
15510
16644
  constructor(filename) {
15511
- const sqlite = requireRuntimeModule("node:sqlite");
16645
+ const sqlite = requireRuntimeModule(["node", "sqlite"].join(":"));
15512
16646
  this.db = new sqlite.DatabaseSync(filename);
15513
16647
  }
15514
16648
  exec(sql) {
@@ -15616,6 +16750,20 @@ function validateTeamName(name) {
15616
16750
  return "Team name must be lowercase alphanumeric with hyphens only";
15617
16751
  return;
15618
16752
  }
16753
+ var PROJECT_ADJECTIVES = ["amber", "brave", "calm", "copper", "crisp", "dark", "ember", "frost", "quiet", "silver", "steady", "swift"];
16754
+ var PROJECT_NOUNS = ["atlas", "beacon", "comet", "harbor", "lab", "orbit", "river", "signal", "sparrow", "summit", "vector", "voyage"];
16755
+ function generateProjectName() {
16756
+ const adjective = PROJECT_ADJECTIVES[Math.floor(Math.random() * PROJECT_ADJECTIVES.length)] ?? "quiet";
16757
+ const noun = PROJECT_NOUNS[Math.floor(Math.random() * PROJECT_NOUNS.length)] ?? "project";
16758
+ return `${adjective}-${noun}`;
16759
+ }
16760
+ function validateProjectName(name) {
16761
+ if (name.length < 1 || name.length > 64)
16762
+ return "Project name must be 1-64 characters";
16763
+ if (!NAME_PATTERN.test(name))
16764
+ return "Project name must be lowercase alphanumeric with hyphens only";
16765
+ return;
16766
+ }
15619
16767
  function isWorktreeInstance(directory) {
15620
16768
  return directory.includes("/worktree/") && directory.includes("/ensemble-");
15621
16769
  }
@@ -15662,17 +16810,19 @@ function hasReportedCompletion(db, teamId, memberName) {
15662
16810
  init_merge_helper();
15663
16811
  init_process();
15664
16812
  async function recoverStaleMembers(db, client3, cwd) {
15665
- const stale = db.query(`SELECT tm.session_id, tm.worktree_branch, tm.name, tm.team_id, t.name as team_name
15666
- FROM team_member tm
15667
- JOIN team t ON tm.team_id = t.id
15668
- WHERE tm.status = 'busy' AND t.status = 'active'`).all();
16813
+ const stale = db.query(`SELECT tm.session_id, tm.worktree_branch, tm.name, tm.team_id, t.name as team_name, p.name as project_name
16814
+ FROM team_member tm
16815
+ JOIN team t ON tm.team_id = t.id
16816
+ JOIN project p ON t.project_id = p.id
16817
+ WHERE tm.status = 'busy' AND t.status = 'active'
16818
+ AND (? IS NULL OR t.project_id = ? OR t.project_id = 'default')`).all(cwd ?? null, cwd ?? null);
15669
16819
  const result = db.run(`UPDATE team_member SET status = 'error', execution_status = 'idle', time_updated = ?
15670
- WHERE status = 'busy'
15671
- AND team_id IN (SELECT id FROM team WHERE status = 'active')`, [Date.now()]);
16820
+ WHERE status = 'busy'
16821
+ AND team_id IN (SELECT id FROM team WHERE status = 'active' AND (? IS NULL OR project_id = ? OR project_id = 'default'))`, [Date.now(), cwd ?? null, cwd ?? null]);
15672
16822
  if (client3) {
15673
16823
  for (const member of stale) {
15674
16824
  if (cwd && member.worktree_branch && !member.worktree_branch.startsWith("ensemble/preserved/")) {
15675
- const safeBranch = preservedBranchName(member.team_name, member.name);
16825
+ const safeBranch = preservedBranchName(member.project_name, member.team_name, member.team_id, member.name);
15676
16826
  const ok = await preserveBranch(member.worktree_branch, safeBranch, cwd);
15677
16827
  if (ok) {
15678
16828
  db.run("UPDATE team_member SET worktree_branch = ? WHERE team_id = ? AND name = ?", [safeBranch, member.team_id, member.name]);
@@ -15753,24 +16903,25 @@ function rehydrateRegistry(db, registry2) {
15753
16903
  }
15754
16904
  async function recoverOrphanedBranches(db, cwd) {
15755
16905
  let removed = 0;
15756
- const archivedTeams = db.query(`SELECT t.name FROM team t
16906
+ const archivedTeams = db.query(`SELECT t.id, t.name, p.name as project_name FROM team t
16907
+ JOIN project p ON t.project_id = p.id
15757
16908
  WHERE t.status = 'archived'
16909
+ AND t.project_id = ?
15758
16910
  AND NOT EXISTS (
15759
- SELECT 1 FROM team_member tm
15760
- WHERE tm.team_id = t.id AND tm.status NOT IN ('shutdown', 'error')
15761
- )`).all();
16911
+ SELECT 1 FROM team_member tm
16912
+ WHERE tm.team_id = t.id AND tm.status NOT IN ('shutdown', 'error')
16913
+ )`).all(cwd);
15762
16914
  if (archivedTeams.length === 0)
15763
16915
  return { removed: 0 };
15764
- const archivedNames = new Set(archivedTeams.map((t) => t.name));
16916
+ const archivedPrefixes = archivedTeams.flatMap((t) => [
16917
+ `ensemble/preserved/${t.project_name}/${teamResourceSegment(t.name, t.id)}/`,
16918
+ `ensemble/preserved/${t.name}/`
16919
+ ]);
15765
16920
  const result = await runCommand(["git", "branch", "--list", "ensemble/preserved/*"], { cwd });
15766
16921
  const branches = result.stdout.split(`
15767
16922
  `).map((b) => b.trim().replace(/^\* /, "")).filter(Boolean);
15768
16923
  for (const branch of branches) {
15769
- const parts = branch.split("/");
15770
- if (parts.length < 4)
15771
- continue;
15772
- const teamName = parts[2];
15773
- if (!teamName || !archivedNames.has(teamName))
16924
+ if (!archivedPrefixes.some((prefix) => branch.startsWith(prefix)))
15774
16925
  continue;
15775
16926
  try {
15776
16927
  const deleteResult = await runCommand(["git", "branch", "-D", branch], { cwd });
@@ -16372,9 +17523,9 @@ function loadConfig(projectDir) {
16372
17523
  const homeDir = process.env.HOME ?? process.env.USERPROFILE ?? "";
16373
17524
  const globalPath = path2.join(homeDir, ".config", "opencode", "ensemble.json");
16374
17525
  const projectPath = path2.join(projectDir, ".opencode", "ensemble.json");
16375
- const global = readConfigFile(globalPath);
17526
+ const global2 = readConfigFile(globalPath);
16376
17527
  const project = readConfigFile(projectPath);
16377
- const merged = { ...DEFAULT_CONFIG, ...global, ...project };
17528
+ const merged = { ...DEFAULT_CONFIG, ...global2, ...project };
16378
17529
  const timeout = process.env.OPENCODE_ENSEMBLE_TIMEOUT;
16379
17530
  if (timeout !== undefined)
16380
17531
  merged.timeoutMs = timeout === "0" ? 0 : parseInt(timeout, 10) || merged.timeoutMs;
@@ -16507,6 +17658,11 @@ var DASHBOARD_HEAD = `<!DOCTYPE html>
16507
17658
  details summary::-webkit-details-marker{display:none}details summary{list-style:none}
16508
17659
  :focus-visible{outline:2px solid rgba(96,165,250,.85);outline-offset:2px}
16509
17660
  select{-webkit-appearance:none;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%235e6a82' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 8px center;padding-right:22px}
17661
+ .project-link[aria-current="true"]{color:#e2e8f0}
17662
+ .team-link[aria-current="true"]{color:#e2e8f0;border-left-color:#22c55e;background:rgba(34,197,94,.06)}
17663
+ #content.nav-collapsed{grid-template-columns:2rem minmax(0,1fr)}
17664
+ #projects[hidden]{display:none!important}
17665
+ #project-rail[hidden]{display:none!important}
16510
17666
  .xp{max-height:0;overflow:hidden;transition:max-height .3s ease-out}.xp-open{max-height:3000px;transition:max-height .5s ease-in}
16511
17667
  .card-sel{outline:2px solid rgba(59,130,246,.4);outline-offset:1px}
16512
17668
  .md pre{background:#1a1f2e;border:1px solid #1e2433;border-radius:6px;padding:8px 12px;overflow-x:auto;margin:6px 0;font-size:12px;line-height:1.5}
@@ -16527,8 +17683,7 @@ select{-webkit-appearance:none;appearance:none;background-image:url("data:image/
16527
17683
  <header class="fixed top-0 inset-x-0 h-11 bg-base-950/95 backdrop-blur border-b border-base-800 flex items-center justify-between px-3 sm:px-4 z-50">
16528
17684
  <div class="flex items-center gap-2 sm:gap-3 min-w-0 flex-1">
16529
17685
  <span class="font-mono font-semibold text-[13px] tracking-[.08em] text-txt-200">ensemble</span>
16530
- <span class="text-base-700">|</span>
16531
- <select id="sel" class="bg-base-900 border border-base-700 rounded-md px-2 py-[3px] text-[11px] text-txt-200 font-mono outline-none cursor-pointer hover:border-base-600 transition-colors max-w-[180px] sm:max-w-[320px] min-w-0"></select>
17686
+ <span id="crumb" class="text-[11px] text-txt-500 font-mono truncate"></span>
16532
17687
  </div>
16533
17688
  <div class="flex items-center gap-2 sm:gap-4 shrink-0">
16534
17689
  <div id="hring" class="w-6 h-6 rounded-full" title="Team health"></div>
@@ -16547,7 +17702,10 @@ select{-webkit-appearance:none;appearance:none;background-image:url("data:image/
16547
17702
  <div class="text-txt-400 text-sm">Waiting for a team</div>
16548
17703
  <div class="text-txt-500 text-[11px]">Run <code class="px-1.5 py-0.5 bg-base-900 rounded text-txt-300 font-mono text-[11px]">team_create</code> in OpenCode to get started</div>
16549
17704
  </div>
16550
- <div id="content" class="hidden max-w-[1600px] mx-auto">
17705
+ <div id="content" class="hidden max-w-[1720px] mx-auto grid grid-cols-1 lg:grid-cols-[260px_minmax(0,1fr)] gap-4 items-start">
17706
+ <div id="project-rail" hidden class="lg:sticky lg:top-[88px]"><button id="nav-expand" type="button" aria-label="Show project navigation" aria-controls="projects" aria-expanded="false" class="h-8 w-8 rounded border border-base-800 text-txt-500 hover:text-txt-200 hover:border-base-700 transition-colors">&gt;</button></div>
17707
+ <aside id="projects" aria-label="Project navigation" class="bg-base-950/60 border-r border-base-800/70 pr-3 lg:sticky lg:top-[88px]"></aside>
17708
+ <div class="min-w-0">
16551
17709
  <section id="attention" aria-label="Team attention" class="mb-3"></section>
16552
17710
  <div class="grid grid-cols-1 xl:grid-cols-[minmax(360px,1.35fr)_minmax(320px,.8fr)] gap-4 items-start">
16553
17711
  <section aria-label="Agent roster"><div id="agents" class="grid gap-2" style="grid-template-columns:repeat(auto-fill,minmax(300px,1fr))"></div></section>
@@ -16557,6 +17715,7 @@ select{-webkit-appearance:none;appearance:none;background-image:url("data:image/
16557
17715
  </div>
16558
17716
  </div>
16559
17717
  </div>
17718
+ </div>
16560
17719
  </main>
16561
17720
  <div id="tl" aria-label="Event timeline" class="fixed bottom-0 inset-x-0 h-10 bg-base-900/90 backdrop-blur border-t border-base-800 px-4 flex items-center z-40 overflow-x-auto scroll hidden"></div>
16562
17721
  <div id="sco" role="dialog" aria-modal="true" aria-hidden="true" aria-labelledby="shortcuts-title" tabindex="-1" onclick="closeShortcuts()">
@@ -16575,9 +17734,9 @@ select{-webkit-appearance:none;appearance:none;background-image:url("data:image/
16575
17734
  <div id="drawer-bg" onclick="closeDrawer()"></div>
16576
17735
  <div id="drawer" class="scroll p-4" tabindex="-1" inert role="dialog" aria-modal="true" aria-labelledby="drawer-title" aria-hidden="true"><h2 id="drawer-title" class="sr-only">Agent detail</h2></div>`;
16577
17736
 
16578
- // src/dashboard-js-part1.ts
16579
- var DASHBOARD_JS_PART1 = `
16580
- let S=null,selId=null,fails=0,pollT=Date.now(),prevMC=0,selCard=-1;
17737
+ // src/dashboard-js-core.ts
17738
+ var DASHBOARD_JS_CORE = `
17739
+ let S=null,selId=null,selProjectId=null,fails=0,pollT=Date.now(),prevMC=0,selCard=-1,navCollapsed=false;
16581
17740
  const expCards=new Set(),expMsgs=new Set();
16582
17741
  const E=s=>s?String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;'):'';
16583
17742
  const D=ms=>{const s=Math.floor(Math.abs(ms)/1000);return s<60?s+'s':s<3600?Math.floor(s/60)+'m':Math.floor(s/3600)+'h'};
@@ -16640,13 +17799,21 @@ function allTeams(){
16640
17799
  const archived=[...S.teams.filter(t=>t.status!=='active')].sort((a,b)=>b.timeUpdated-a.timeUpdated);
16641
17800
  return{active,archived};
16642
17801
  }
16643
- function cur(){const{active,archived}=allTeams(),all=[...active,...archived];if(!all.length)return null;if(selId){const t=all.find(t=>t.id===selId);if(t)return t}return active[0]||all[0]}
17802
+ function allProjects(){return S?.projects?[...S.projects].sort((a,b)=>b.timeUpdated-a.timeUpdated):[]}
17803
+ function projectLabel(p){return p?(p.name||p.path||p.id):''}
17804
+ function curProject(){const ps=allProjects();if(!ps.length)return null;if(selProjectId){const p=ps.find(p=>p.id===selProjectId);if(p)return p}var t=cur();return t?ps.find(p=>p.id===t.projectId)||ps[0]:ps[0]}
17805
+ function cur(){const{active,archived}=allTeams(),all=[...active,...archived];if(!all.length)return null;if(selId){const t=all.find(t=>t.id===selId);if(t){selProjectId=t.projectId;return t}}const p=selProjectId&&S?.projects?.find(p=>p.id===selProjectId);const pt=p?[...(p.teams||[])].filter(t=>t.status==='active'):[ ];const t=pt.sort((a,b)=>b.timeUpdated-a.timeUpdated)[0]||active[0]||all[0];if(t){selId=t.id;selProjectId=t.projectId}return t}
16644
17806
 
16645
17807
  function deriveHealth(t){
16646
17808
  const mm=t.members||[];if(!mm.length)return{w:0,i:0,e:0,d:0,total:0};
16647
17809
  return{w:mm.filter(m=>m.status==='busy').length,i:mm.filter(m=>m.status==='ready').length,e:mm.filter(m=>m.status==='error').length,d:mm.filter(m=>m.status==='shutdown'||m.status==='shutdown_requested').length,total:mm.length};
16648
17810
  }
16649
17811
 
17812
+ function coarseTeamStatus(t){const h=deriveHealth(t),blocked=(t.tasks||[]).filter(x=>x.status==='blocked').length;if(h.e)return{label:'error',color:'red',dot:'bg-red-500'};if(blocked)return{label:'blocked',color:'amber',dot:'bg-amber-500'};if(h.w)return{label:'working',color:'blue',dot:'bg-blue-500'};if(h.i)return{label:'idle',color:'muted',dot:'bg-txt-500'};return{label:t.status==='active'?'empty':t.status,color:'muted',dot:'bg-base-600'}}
17813
+ function projectStatus(p){const teams=p.teams||[],counts={working:0,blocked:0,error:0,idle:0,done:0};teams.forEach(t=>{const s=coarseTeamStatus(t).label;if(s==='working')counts.working++;else if(s==='blocked')counts.blocked++;else if(s==='error')counts.error++;else if(s==='idle'||s==='empty')counts.idle++;else counts.done++});if(counts.error)return{label:'error',color:'red',dot:'bg-red-500',counts};if(counts.blocked)return{label:'blocked',color:'amber',dot:'bg-amber-500',counts};if(counts.working)return{label:'working',color:'blue',dot:'bg-blue-500',counts};return{label:'idle',color:'muted',dot:'bg-txt-500',counts}}
17814
+ function statusTitleProject(p){const s=projectStatus(p),teams=p.teams||[];return projectLabel(p)+'\\nStatus: '+s.label+'\\nTeams: '+teams.length+'\\nWorking: '+s.counts.working+' · Blocked: '+s.counts.blocked+' · Error: '+s.counts.error+' · Idle: '+s.counts.idle}
17815
+ function statusTitleTeam(t){const h=deriveHealth(t),tasks=t.tasks||[],blocked=tasks.filter(x=>x.status==='blocked').length,active=tasks.filter(x=>x.status==='in_progress').length,pending=tasks.filter(x=>x.status==='pending').length,done=tasks.filter(x=>x.status==='completed').length;return t.name+'\\nStatus: '+coarseTeamStatus(t).label+'\\nAgents: '+h.total+' total, '+h.w+' working, '+h.i+' idle, '+h.e+' error\\nTasks: '+active+' active, '+blocked+' blocked, '+pending+' pending, '+done+' done'}
17816
+
16650
17817
  function lastMessageFor(name,msgs){return msgs.filter(m=>m.fromName===name||m.toName===name).sort((a,b)=>b.timeCreated-a.timeCreated)[0]||null}
16651
17818
  function activeTaskFor(name,tasks){return tasks.find(x=>x.assignee===name&&x.status==='in_progress')||tasks.find(x=>x.assignee===name&&x.status==='blocked')||null}
16652
17819
  function blockedTaskFor(name,tasks){return tasks.find(x=>x.assignee===name&&x.status==='blocked')||null}
@@ -16707,18 +17874,135 @@ function deriveThreads(msgs){
16707
17874
  }
16708
17875
  `;
16709
17876
 
16710
- // src/dashboard-js-part2.ts
16711
- var DASHBOARD_JS_PART2 = `
17877
+ // src/dashboard-js-events.ts
17878
+ var DASHBOARD_JS_EVENTS = `
17879
+ function toggleMsg(id){if(expMsgs.has(id))expMsgs.delete(id);else expMsgs.add(id);render()}
17880
+
17881
+ function applyNavCollapse(){
17882
+ const content=document.getElementById('content'),projects=document.getElementById('projects'),rail=document.getElementById('project-rail'),toggle=document.getElementById('nav-toggle'),expand=document.getElementById('nav-expand');
17883
+ content.classList.toggle('nav-collapsed',navCollapsed);
17884
+ projects.hidden=navCollapsed;
17885
+ projects.setAttribute('aria-hidden',String(navCollapsed));
17886
+ rail.hidden=!navCollapsed;
17887
+ if(toggle)toggle.setAttribute('aria-expanded',String(!navCollapsed));
17888
+ expand.setAttribute('aria-expanded',String(!navCollapsed));
17889
+ if(document.activeElement===toggle&&navCollapsed)expand.focus();
17890
+ if(document.activeElement===expand&&!navCollapsed&&toggle)toggle.focus();
17891
+ }
17892
+
17893
+ function render(){
17894
+ rSel();const t=cur();
17895
+ const empty=document.getElementById('empty'),content=document.getElementById('content');
17896
+ if(!t){empty.classList.remove('hidden');empty.classList.add('flex');content.classList.add('hidden');document.getElementById('tl').classList.add('hidden');return}
17897
+ empty.classList.add('hidden');empty.classList.remove('flex');content.classList.remove('hidden');
17898
+ applyNavCollapse();
17899
+ const p=curProject();document.getElementById('crumb').textContent=p?' / '+projectLabel(p)+' / '+t.name:'';
17900
+ rHealth(t);rSum(t);rAttention(t);rAgents(t);rTasks(t);rActivity(t);rTimeline(t);
17901
+ }
17902
+
17903
+ function selectProject(id){selProjectId=id;const p=S?.projects?.find(p=>p.id===id);const t=(p?.teams||[]).filter(t=>t.status==='active').sort((a,b)=>b.timeUpdated-a.timeUpdated)[0]||(p?.teams||[])[0];if(t)selId=t.id;selCard=-1;render()}
17904
+ function selectTeam(id){selId=id;selCard=-1;render()}
17905
+
17906
+ function conn(ok){
17907
+ document.getElementById('cd').className='w-[7px] h-[7px] rounded-full '+(ok?'bg-emerald-500 pulse':'bg-red-500');
17908
+ document.getElementById('ct').textContent=ok?D(Date.now()-pollT)+' ago':'reconnecting to dashboard state';
17909
+ }
17910
+
17911
+ async function poll(){try{S=await(await fetch('/api/state')).json();fails=0;pollT=Date.now();conn(true);render()}catch{if(++fails>=3)conn(false)}}
17912
+
17913
+ function setBackgroundInert(locked){
17914
+ document.querySelectorAll('header,main,#sum,#tl').forEach(function(el){
17915
+ el.inert=locked;
17916
+ if(locked)el.setAttribute('aria-hidden','true');
17917
+ else el.removeAttribute('aria-hidden');
17918
+ });
17919
+ }
17920
+
17921
+ function modalOpen(){return document.getElementById('sco').classList.contains('show')||document.getElementById('drawer').classList.contains('open')}
17922
+
17923
+ function trapFocus(root,e){
17924
+ const nodes=[...root.querySelectorAll('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])')].filter(function(el){return !el.disabled&&!el.inert&&el.offsetParent!==null});
17925
+ if(!nodes.length){e.preventDefault();root.focus();return}
17926
+ const first=nodes[0],last=nodes[nodes.length-1];
17927
+ if(e.shiftKey&&document.activeElement===first){e.preventDefault();last.focus();return}
17928
+ if(!e.shiftKey&&document.activeElement===last){e.preventDefault();first.focus();return}
17929
+ }
17930
+
17931
+ function openShortcuts(){
17932
+ const el=document.getElementById('sco');
17933
+ setBackgroundInert(true);
17934
+ el.classList.add('show');
17935
+ el.setAttribute('aria-hidden','false');
17936
+ document.getElementById('sco').focus();
17937
+ }
17938
+
17939
+ function closeShortcuts(){
17940
+ const el=document.getElementById('sco');
17941
+ el.classList.remove('show');
17942
+ el.setAttribute('aria-hidden','true');
17943
+ if(!modalOpen())setBackgroundInert(false);
17944
+ }
17945
+
17946
+ // Clock update every second
17947
+ setInterval(function(){var t=cur();if(t)rClock(t);if(fails<3)conn(true)},1000);
17948
+
17949
+ // Poll every 2.5s
17950
+ setInterval(poll,2500);
17951
+
17952
+ document.addEventListener('click',function(e){
17953
+ const id=e.target&&e.target.id;
17954
+ if(id!=='nav-toggle'&&id!=='nav-expand')return;
17955
+ navCollapsed=id==='nav-toggle';
17956
+ applyNavCollapse();
17957
+ });
17958
+
17959
+ // Keyboard shortcuts
17960
+ document.addEventListener('keydown',function(e){
17961
+ const shortcutsOpen=document.getElementById('sco').classList.contains('show');
17962
+ if(shortcutsOpen&&e.key==='Tab'){trapFocus(document.getElementById('sco'),e);return}
17963
+ if(shortcutsOpen&&e.key==='Escape'){e.preventDefault();closeShortcuts();return}
17964
+ const drawerOpen=document.getElementById('drawer').classList.contains('open');
17965
+ if(drawerOpen&&e.key==='Tab'){trapFocus(document.getElementById('drawer'),e);return}
17966
+ if(drawerOpen&&e.key==='Escape'){e.preventDefault();closeDrawer();return}
17967
+ if(drawerOpen&&e.key==='?'){e.preventDefault();return}
17968
+ if(e.target.tagName==='INPUT'||e.target.tagName==='SELECT'||e.target.tagName==='TEXTAREA')return;
17969
+ var t=cur();if(!t)return;
17970
+ var mm=[...(t.members||[])].sort((a,b)=>rankAgent(a,b,t));
17971
+ if(e.key==='?'){e.preventDefault();shortcutsOpen?closeShortcuts():openShortcuts();return}
17972
+ if(e.key==='Escape'){closeDrawer();expMsgs.clear();selCard=-1;closeShortcuts();render();return}
17973
+ if(e.key==='j'&&mm.length){e.preventDefault();selCard=Math.min(selCard+1,mm.length-1);render();return}
17974
+ if(e.key==='k'&&mm.length){e.preventDefault();selCard=Math.max(selCard-1,0);render();return}
17975
+ if(e.key==='Enter'&&selCard>=0&&selCard<mm.length){e.preventDefault();openDrawer(mm[selCard].name);return}
17976
+ if(e.key>='1'&&e.key<='9'){
17977
+ var teams=allTeams(),all=[...teams.active,...teams.archived];
17978
+ var idx=parseInt(e.key)-1;
17979
+ if(idx<all.length){selId=all[idx].id;render()}
17980
+ }
17981
+ });
17982
+
17983
+ // Initial poll
17984
+ poll();
17985
+
17986
+ console.log('%c Ensemble Mission Control','font-size:14px;font-weight:bold;color:#22c55e');
17987
+ `;
17988
+
17989
+ // src/dashboard-js-render.ts
17990
+ var DASHBOARD_JS_RENDER = `
16712
17991
  function rSel(){
16713
- const el=document.getElementById('sel'),{active,archived}=allTeams(),c=cur();
16714
- if(!active.length&&!archived.length){el.innerHTML='<option>No teams</option>';return}
16715
- let h='';
16716
- if(active.length){h+='<optgroup label="Active">';h+=active.map(t=>'<option value="'+t.id+'">'+E(t.name)+' ('+relT(t.timeUpdated)+')</option>').join('');h+='</optgroup>'}
16717
- if(archived.length){h+='<optgroup label="Archived">';h+=archived.slice(0,5).map(t=>'<option value="'+t.id+'">'+E(t.name)+'</option>').join('');if(archived.length>5)h+='<option disabled>+ '+(archived.length-5)+' more</option>';h+='</optgroup>'}
16718
- if(el._lh!==h){el.innerHTML=h;el._lh=h}
16719
- if(c)el.value=c.id;
17992
+ const el=document.getElementById('projects'),ps=allProjects(),c=cur(),cp=curProject();
17993
+ const head=renderProjectNavHeader();
17994
+ if(!ps.length){patch(el,head+'<div class="text-center text-txt-500 text-[12px] py-6">No projects yet</div>');return}
17995
+ let h='<nav class="text-[12px]" aria-label="Projects">'+head+'<div class="space-y-4">';
17996
+ ps.forEach(function(p){h+=renderProjectSection(p,cp,c)});
17997
+ h+='</div></nav>';
17998
+ patch(el,h);
16720
17999
  }
16721
18000
 
18001
+ function renderProjectNavHeader(){return '<div class="flex items-center justify-between gap-2 mb-3"><div class="text-[10px] uppercase tracking-[.18em] text-txt-500">Projects</div><button id="nav-toggle" type="button" aria-label="Hide project navigation" aria-controls="projects" aria-expanded="true" class="text-[10px] text-txt-500 border border-base-800 rounded px-1.5 py-[2px] hover:text-txt-200 hover:border-base-700 transition-colors">hide</button></div>'}
18002
+ function renderProjectSection(p,cp,c){const teams=p.teams||[];return '<section>'+renderProjectButton(p,cp)+'<div class="mt-2 ml-[7px] border-l border-base-800/80">'+[...teams].sort((a,b)=>b.timeUpdated-a.timeUpdated).map(t=>renderTeamLink(t,c)).join('')+'</div></section>'}
18003
+ function renderProjectButton(p,cp){const teams=p.teams||[],active=teams.filter(t=>t.status==='active').length,sel=cp&&cp.id===p.id,pss=projectStatus(p);return '<button type="button" aria-current="'+(sel?'true':'false')+'" title="'+E(statusTitleProject(p))+'" class="project-link group w-full text-left text-txt-300 hover:text-txt-100 transition-colors" data-project="'+E(p.id)+'" onclick="selectProject(this.dataset.project)"><div class="flex items-center gap-2 min-w-0"><span class="w-[5px] h-[5px] rounded-full '+pss.dot+(pss.label==='working'?' pulse':'')+' shrink-0"></span><span class="font-mono font-semibold truncate">'+E(projectLabel(p))+'</span>'+chip(pss.label,pss.color)+'</div><div class="mt-1 ml-3 text-[10px] text-txt-500">'+active+' team'+(active!==1?'s':'')+'</div></button>'}
18004
+ function renderTeamLink(t,c){const ss=coarseTeamStatus(t),tsel=c&&c.id===t.id;return '<button type="button" title="'+E(statusTitleTeam(t))+'" class="team-link block w-full text-left border-l-2 border-transparent -ml-px py-1.5 pl-3 pr-2 text-[11px] text-txt-500 hover:text-txt-200 hover:bg-base-900/70 transition-colors" aria-current="'+(tsel?'true':'false')+'" data-team="'+E(t.id)+'" onclick="selectTeam(this.dataset.team)"><div class="flex items-center gap-2 min-w-0"><span class="w-[5px] h-[5px] rounded-full '+ss.dot+(ss.label==='working'?' pulse':'')+' shrink-0"></span><span class="truncate font-mono">'+E(t.name)+'</span><span class="ml-auto text-[9px] uppercase tracking-wide text-txt-500">'+E(ss.label)+'</span></div></button>'}
18005
+
16722
18006
  function rHealth(t){
16723
18007
  const el=document.getElementById('hring'),h=deriveHealth(t);
16724
18008
  if(!h.total){el.style.background='conic-gradient(#2a3144 0deg,#2a3144 360deg)';return}
@@ -16968,100 +18252,9 @@ function rTimeline(t){
16968
18252
  }
16969
18253
  `;
16970
18254
 
16971
- // src/dashboard-js-part3.ts
16972
- var DASHBOARD_JS_PART3 = `
16973
- function toggleMsg(id){if(expMsgs.has(id))expMsgs.delete(id);else expMsgs.add(id);render()}
16974
-
16975
- function render(){
16976
- rSel();const t=cur();
16977
- const empty=document.getElementById('empty'),content=document.getElementById('content');
16978
- if(!t){empty.classList.remove('hidden');empty.classList.add('flex');content.classList.add('hidden');document.getElementById('tl').classList.add('hidden');return}
16979
- empty.classList.add('hidden');empty.classList.remove('flex');content.classList.remove('hidden');
16980
- rHealth(t);rSum(t);rAttention(t);rAgents(t);rTasks(t);rActivity(t);rTimeline(t);
16981
- }
16982
-
16983
- function conn(ok){
16984
- document.getElementById('cd').className='w-[7px] h-[7px] rounded-full '+(ok?'bg-emerald-500 pulse':'bg-red-500');
16985
- document.getElementById('ct').textContent=ok?D(Date.now()-pollT)+' ago':'reconnecting to dashboard state';
16986
- }
16987
-
16988
- async function poll(){try{S=await(await fetch('/api/state')).json();fails=0;pollT=Date.now();conn(true);render()}catch{if(++fails>=3)conn(false)}}
16989
-
16990
- function setBackgroundInert(locked){
16991
- document.querySelectorAll('header,main,#sum,#tl').forEach(function(el){
16992
- el.inert=locked;
16993
- if(locked)el.setAttribute('aria-hidden','true');
16994
- else el.removeAttribute('aria-hidden');
16995
- });
16996
- }
16997
-
16998
- function modalOpen(){return document.getElementById('sco').classList.contains('show')||document.getElementById('drawer').classList.contains('open')}
16999
-
17000
- function trapFocus(root,e){
17001
- const nodes=[...root.querySelectorAll('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])')].filter(function(el){return !el.disabled&&!el.inert&&el.offsetParent!==null});
17002
- if(!nodes.length){e.preventDefault();root.focus();return}
17003
- const first=nodes[0],last=nodes[nodes.length-1];
17004
- if(e.shiftKey&&document.activeElement===first){e.preventDefault();last.focus();return}
17005
- if(!e.shiftKey&&document.activeElement===last){e.preventDefault();first.focus();return}
17006
- }
17007
-
17008
- function openShortcuts(){
17009
- const el=document.getElementById('sco');
17010
- setBackgroundInert(true);
17011
- el.classList.add('show');
17012
- el.setAttribute('aria-hidden','false');
17013
- document.getElementById('sco').focus();
17014
- }
17015
-
17016
- function closeShortcuts(){
17017
- const el=document.getElementById('sco');
17018
- el.classList.remove('show');
17019
- el.setAttribute('aria-hidden','true');
17020
- if(!modalOpen())setBackgroundInert(false);
17021
- }
17022
-
17023
- // Clock update every second
17024
- setInterval(function(){var t=cur();if(t)rClock(t);if(fails<3)conn(true)},1000);
17025
-
17026
- // Poll every 2.5s
17027
- setInterval(poll,2500);
17028
-
17029
- // Keyboard shortcuts
17030
- document.addEventListener('keydown',function(e){
17031
- const shortcutsOpen=document.getElementById('sco').classList.contains('show');
17032
- if(shortcutsOpen&&e.key==='Tab'){trapFocus(document.getElementById('sco'),e);return}
17033
- if(shortcutsOpen&&e.key==='Escape'){e.preventDefault();closeShortcuts();return}
17034
- const drawerOpen=document.getElementById('drawer').classList.contains('open');
17035
- if(drawerOpen&&e.key==='Tab'){trapFocus(document.getElementById('drawer'),e);return}
17036
- if(drawerOpen&&e.key==='Escape'){e.preventDefault();closeDrawer();return}
17037
- if(drawerOpen&&e.key==='?'){e.preventDefault();return}
17038
- if(e.target.tagName==='INPUT'||e.target.tagName==='SELECT'||e.target.tagName==='TEXTAREA')return;
17039
- var t=cur();if(!t)return;
17040
- var mm=[...(t.members||[])].sort((a,b)=>rankAgent(a,b,t));
17041
- if(e.key==='?'){e.preventDefault();shortcutsOpen?closeShortcuts():openShortcuts();return}
17042
- if(e.key==='Escape'){closeDrawer();expMsgs.clear();selCard=-1;closeShortcuts();render();return}
17043
- if(e.key==='j'&&mm.length){e.preventDefault();selCard=Math.min(selCard+1,mm.length-1);render();return}
17044
- if(e.key==='k'&&mm.length){e.preventDefault();selCard=Math.max(selCard-1,0);render();return}
17045
- if(e.key==='Enter'&&selCard>=0&&selCard<mm.length){e.preventDefault();openDrawer(mm[selCard].name);return}
17046
- if(e.key>='1'&&e.key<='9'){
17047
- var teams=allTeams(),all=[...teams.active,...teams.archived];
17048
- var idx=parseInt(e.key)-1;
17049
- if(idx<all.length){selId=all[idx].id;render()}
17050
- }
17051
- });
17052
-
17053
- // Select handler
17054
- document.getElementById('sel').addEventListener('change',function(){selId=this.value;render()});
17055
-
17056
- // Initial poll
17057
- poll();
17058
-
17059
- console.log('%c Ensemble Mission Control','font-size:14px;font-weight:bold;color:#22c55e');
17060
- `;
17061
-
17062
18255
  // src/dashboard.ts
17063
18256
  var DASHBOARD_HTML = DASHBOARD_HEAD + `
17064
- <script>` + DASHBOARD_JS_PART1 + DASHBOARD_JS_PART2 + DASHBOARD_JS_PART3 + `</script>
18257
+ <script>` + DASHBOARD_JS_CORE + DASHBOARD_JS_RENDER + DASHBOARD_JS_EVENTS + `</script>
17065
18258
  </body></html>`;
17066
18259
  function parseDependsOn(value) {
17067
18260
  if (!value)
@@ -17078,30 +18271,33 @@ function parseDependsOn(value) {
17078
18271
  return [];
17079
18272
  }
17080
18273
  function buildState(db) {
17081
- const teams = db.query("SELECT id, name, status, lead_agent, time_created, time_updated FROM team ORDER BY time_created DESC").all();
18274
+ const projects = db.query("SELECT id, name, path, status, time_created, time_updated FROM project ORDER BY time_updated DESC").all();
18275
+ const teams = db.query("SELECT id, name, project_id, status, lead_agent, time_created, time_updated FROM team ORDER BY time_created DESC").all();
17082
18276
  const memberStmt = db.query("SELECT name, agent, status, execution_status, worktree_branch, prompt, model, plan_approval, time_created, time_updated FROM team_member WHERE team_id = ?");
17083
18277
  const taskStmt = db.query("SELECT id, content, status, priority, assignee, depends_on, time_created, time_updated FROM team_task WHERE team_id = ?");
17084
18278
  const msgStmt = db.query("SELECT id, from_name, to_name, content, delivered, read, time_created FROM team_message WHERE team_id = ? ORDER BY time_created DESC LIMIT 50");
17085
- return {
17086
- teams: teams.map((t) => ({
18279
+ const mappedTeams = teams.map((t) => {
18280
+ const members = memberStmt.all(t.id).map((m) => ({
18281
+ name: m.name,
18282
+ agent: m.agent,
18283
+ status: m.status,
18284
+ executionStatus: m.execution_status,
18285
+ worktreeBranch: m.worktree_branch,
18286
+ prompt: m.prompt,
18287
+ model: m.model,
18288
+ planApproval: m.plan_approval,
18289
+ timeCreated: m.time_created,
18290
+ timeUpdated: m.time_updated
18291
+ }));
18292
+ return {
17087
18293
  id: t.id,
17088
18294
  name: t.name,
18295
+ projectId: t.project_id,
17089
18296
  status: t.status,
17090
18297
  leadAgent: t.lead_agent,
17091
18298
  timeCreated: t.time_created,
17092
18299
  timeUpdated: t.time_updated,
17093
- members: memberStmt.all(t.id).map((m) => ({
17094
- name: m.name,
17095
- agent: m.agent,
17096
- status: m.status,
17097
- executionStatus: m.execution_status,
17098
- worktreeBranch: m.worktree_branch,
17099
- prompt: m.prompt,
17100
- model: m.model,
17101
- planApproval: m.plan_approval,
17102
- timeCreated: m.time_created,
17103
- timeUpdated: m.time_updated
17104
- })),
18300
+ members,
17105
18301
  tasks: taskStmt.all(t.id).map((tk) => ({
17106
18302
  id: tk.id,
17107
18303
  content: tk.content,
@@ -17121,7 +18317,34 @@ function buildState(db) {
17121
18317
  read: msg.read === 1,
17122
18318
  timeCreated: msg.time_created
17123
18319
  }))
17124
- }))
18320
+ };
18321
+ });
18322
+ const teamsByProject = new Map;
18323
+ mappedTeams.forEach((team) => {
18324
+ const projectId = team.projectId;
18325
+ teamsByProject.set(projectId, [...teamsByProject.get(projectId) ?? [], team]);
18326
+ });
18327
+ return {
18328
+ projects: projects.flatMap((project) => {
18329
+ const projectTeams = teamsByProject.get(project.id) ?? [];
18330
+ if (projectTeams.length === 0)
18331
+ return [];
18332
+ return {
18333
+ id: project.id,
18334
+ name: project.name,
18335
+ path: project.path,
18336
+ status: project.status,
18337
+ timeCreated: project.time_created,
18338
+ timeUpdated: project.time_updated,
18339
+ activeTeams: projectTeams.filter((team) => team.status === "active").length,
18340
+ workingAgents: projectTeams.reduce((count, team) => {
18341
+ const members = team.members;
18342
+ return count + members.filter((member) => member.status === "busy").length;
18343
+ }, 0),
18344
+ teams: projectTeams
18345
+ };
18346
+ }),
18347
+ teams: mappedTeams
17125
18348
  };
17126
18349
  }
17127
18350
  function sendJson(res, data) {
@@ -17204,7 +18427,13 @@ async function executeTeamCreate(deps, args, sessionId) {
17204
18427
  const nameError = validateTeamName(args.name);
17205
18428
  if (nameError)
17206
18429
  throw new Error(nameError);
17207
- const existing = deps.db.query("SELECT id FROM team WHERE name = ? AND status = 'active'").get(args.name);
18430
+ if (args.project_name) {
18431
+ const projectNameError = validateProjectName(args.project_name);
18432
+ if (projectNameError)
18433
+ throw new Error(projectNameError);
18434
+ }
18435
+ const projectId = deps.directory;
18436
+ const existing = deps.db.query("SELECT id FROM team WHERE name = ? AND project_id = ? AND status = 'active'").get(args.name, projectId);
17208
18437
  if (existing)
17209
18438
  throw new Error(`Team "${args.name}" already exists`);
17210
18439
  const lead = findTeamBySession(deps.db, deps.registry, sessionId);
@@ -17212,7 +18441,11 @@ async function executeTeamCreate(deps, args, sessionId) {
17212
18441
  throw new Error(`This session already belongs to team "${lead.teamName}"`);
17213
18442
  const id = generateId("team");
17214
18443
  const now = Date.now();
17215
- deps.db.run("INSERT INTO team (id, name, lead_session_id, status, delegate, time_created, time_updated) VALUES (?, ?, ?, 'active', 0, ?, ?)", [id, args.name, sessionId, now, now]);
18444
+ const projectName = args.project_name ?? generateProjectName();
18445
+ deps.db.run(`INSERT INTO project (id, name, path, status, time_created, time_updated)
18446
+ VALUES (?, ?, ?, 'active', ?, ?)
18447
+ ON CONFLICT(id) DO UPDATE SET time_updated = excluded.time_updated`, [projectId, projectName, projectId, now, now]);
18448
+ deps.db.run("INSERT INTO team (id, name, project_id, lead_session_id, status, delegate, time_created, time_updated) VALUES (?, ?, ?, ?, 'active', 0, ?, ?)", [id, args.name, projectId, sessionId, now, now]);
17216
18449
  return `Team "${args.name}" created. You are the lead. Use team_spawn to add teammates.`;
17217
18450
  }
17218
18451
 
@@ -17277,6 +18510,7 @@ function requireCanPurgeArchivedTeams(deps, sessionId) {
17277
18510
  }
17278
18511
 
17279
18512
  // src/tools/team-spawn.ts
18513
+ init_merge_helper();
17280
18514
  var spawnFailures = new Map;
17281
18515
  function parseModelId(model) {
17282
18516
  const slash = model.indexOf("/");
@@ -17333,7 +18567,8 @@ async function executeTeamSpawn(deps, args, sessionId) {
17333
18567
  let worktreeDir = null;
17334
18568
  let worktreeBranch = null;
17335
18569
  if (useWorktree) {
17336
- const worktreeName = `ensemble-${teamInfo.teamName}-${args.name}`;
18570
+ const resource = getTeamResourceParts(deps.db, teamInfo.teamId);
18571
+ const worktreeName = teamWorktreeName(resource.projectName, resource.teamName, resource.teamId, args.name);
17337
18572
  try {
17338
18573
  log(`spawn:worktree:start name=${args.name}`);
17339
18574
  const result = await withTimeout(deps.client.worktree.create({ worktreeCreateInput: { name: worktreeName } }), getSpawnTimeout(), `worktree.create for "${args.name}"`);
@@ -17650,7 +18885,7 @@ async function executeTeamShutdown(deps, args, sessionId, isDirty = checkWorktre
17650
18885
  throw new Error(`Teammate "${args.member}" is already shut down`);
17651
18886
  const force = args.force ?? false;
17652
18887
  if (member.status === "shutdown_requested") {
17653
- await preserveAndAbort(deps, teamInfo.teamId, teamInfo.teamName, args.member, member.session_id, member.worktree_branch, preserve);
18888
+ await preserveAndAbort(deps, teamInfo.teamId, args.member, member.session_id, member.worktree_branch, preserve);
17654
18889
  const status = await getBranchStatus(deps, teamInfo.teamId, args.member, member.worktree_dir, isDirty, commitCount);
17655
18890
  return `Force shut down "${args.member}".${status}`;
17656
18891
  }
@@ -17661,12 +18896,13 @@ async function executeTeamShutdown(deps, args, sessionId, isDirty = checkWorktre
17661
18896
  isIdle = !sessionStatus || sessionStatus.type === "idle";
17662
18897
  } catch {}
17663
18898
  if (isIdle || force) {
17664
- await preserveAndAbort(deps, teamInfo.teamId, teamInfo.teamName, args.member, member.session_id, member.worktree_branch, preserve);
18899
+ await preserveAndAbort(deps, teamInfo.teamId, args.member, member.session_id, member.worktree_branch, preserve);
17665
18900
  const status = await getBranchStatus(deps, teamInfo.teamId, args.member, member.worktree_dir, isDirty, commitCount);
17666
18901
  return `Teammate "${args.member}" has been shut down.${status}`;
17667
18902
  }
17668
18903
  if (member.worktree_branch) {
17669
- const safeBranch = preservedBranchName(teamInfo.teamName, args.member);
18904
+ const resource = getTeamResourceParts(deps.db, teamInfo.teamId);
18905
+ const safeBranch = preservedBranchName(resource.projectName, resource.teamName, resource.teamId, args.member);
17670
18906
  const ok = await preserve(member.worktree_branch, safeBranch, deps.directory);
17671
18907
  if (ok) {
17672
18908
  deps.db.run("UPDATE team_member SET worktree_branch = ? WHERE team_id = ? AND name = ?", [safeBranch, teamInfo.teamId, args.member]);
@@ -17685,9 +18921,10 @@ async function executeTeamShutdown(deps, args, sessionId, isDirty = checkWorktre
17685
18921
  deps.db.run("UPDATE team_member SET status = 'shutdown_requested', time_updated = ? WHERE team_id = ? AND name = ?", [Date.now(), teamInfo.teamId, args.member]);
17686
18922
  return `Shutdown requested for ${args.member}. They will finish current work and shut down. Call team_shutdown with force: true to abort immediately.`;
17687
18923
  }
17688
- async function preserveAndAbort(deps, teamId, teamName, memberName, sessionId, worktreeBranch, preserve) {
18924
+ async function preserveAndAbort(deps, teamId, memberName, sessionId, worktreeBranch, preserve) {
17689
18925
  if (worktreeBranch && !worktreeBranch.startsWith("ensemble/preserved/")) {
17690
- const safeBranch = preservedBranchName(teamName, memberName);
18926
+ const resource = getTeamResourceParts(deps.db, teamId);
18927
+ const safeBranch = preservedBranchName(resource.projectName, resource.teamName, resource.teamId, memberName);
17691
18928
  const ok = await preserve(worktreeBranch, safeBranch, deps.directory);
17692
18929
  if (ok) {
17693
18930
  deps.db.run("UPDATE team_member SET worktree_branch = ? WHERE team_id = ? AND name = ?", [safeBranch, teamId, memberName]);
@@ -17771,20 +19008,20 @@ function resolvePurgeTargets(deps, purge) {
17771
19008
  throw new Error("Wildcard purge cannot be combined with explicit team names. Use purge: ['*'] by itself.");
17772
19009
  }
17773
19010
  if (purge.includes("*")) {
17774
- return deps.db.query("SELECT id, name, time_updated FROM team WHERE status = 'archived' ORDER BY time_updated DESC, name ASC").all();
19011
+ return deps.db.query("SELECT t.id, t.name, t.project_id, p.name as project_name, t.time_updated FROM team t JOIN project p ON t.project_id = p.id WHERE t.status = 'archived' AND t.project_id = ? ORDER BY t.time_updated DESC, t.name ASC").all(deps.directory);
17775
19012
  }
17776
19013
  const uniqueNames = [...new Set(purge)];
17777
19014
  const rows = uniqueNames.map((name) => ({
17778
19015
  name,
17779
- team: deps.db.query("SELECT id, name, status, time_updated FROM team WHERE name = ?").get(name)
19016
+ teams: deps.db.query("SELECT t.id, t.name, t.project_id, p.name as project_name, t.status, t.time_updated FROM team t JOIN project p ON t.project_id = p.id WHERE t.name = ? AND t.project_id = ? ORDER BY t.time_updated DESC").all(name, deps.directory)
17780
19017
  }));
17781
- const missing = rows.filter((row) => row.team === null).map((row) => row.name);
19018
+ const missing = rows.filter((row) => row.teams.length === 0).map((row) => row.name);
17782
19019
  if (missing.length > 0)
17783
19020
  throw new Error(`Team not found: ${missing.join(", ")}`);
17784
- const active = rows.filter((row) => row.team?.status === "active").map((row) => row.name);
19021
+ const active = rows.filter((row) => row.teams.some((team) => team.status === "active")).map((row) => row.name);
17785
19022
  if (active.length > 0)
17786
19023
  throw new Error(`Cannot purge active team: ${active.join(", ")}`);
17787
- return rows.map((row) => row.team).sort((a, b) => b.time_updated - a.time_updated || a.name.localeCompare(b.name));
19024
+ return rows.map((row) => row.teams[0]).sort((a, b) => b.time_updated - a.time_updated || a.name.localeCompare(b.name));
17788
19025
  }
17789
19026
  function deleteArchivedTeams(deps, targets) {
17790
19027
  const transaction = deps.db.transaction((teams) => {
@@ -17808,6 +19045,7 @@ function deleteArchivedTeams(deps, targets) {
17808
19045
  }
17809
19046
  function getPurgeMemberResources(deps, targets) {
17810
19047
  return targets.flatMap((target) => deps.db.query(`SELECT t.name as team_name,
19048
+ p.name as project_name,
17811
19049
  tm.team_id,
17812
19050
  tm.name as member_name,
17813
19051
  tm.worktree_dir,
@@ -17815,19 +19053,24 @@ function getPurgeMemberResources(deps, targets) {
17815
19053
  tm.worktree_branch
17816
19054
  FROM team_member tm
17817
19055
  JOIN team t ON tm.team_id = t.id
19056
+ JOIN project p ON t.project_id = p.id
17818
19057
  WHERE tm.team_id = ?`).all(target.id));
17819
19058
  }
17820
19059
  function preservedBranchPrefix(resource) {
19060
+ return `ensemble/preserved/${resource.project_name}/${teamResourceSegment(resource.team_name, resource.team_id)}/`;
19061
+ }
19062
+ function legacyPreservedBranchPrefix(resource) {
17821
19063
  return `ensemble/preserved/${resource.team_name}/`;
17822
19064
  }
17823
19065
  function staleEnsembleBranchNames(resource) {
17824
19066
  return [
19067
+ `ensemble-${resource.team_id}-${resource.member_name}`,
17825
19068
  `ensemble-${resource.team_name}-${resource.member_name}`,
17826
19069
  `opencode/ensemble-${resource.team_name}-${resource.member_name}`
17827
19070
  ];
17828
19071
  }
17829
19072
  function isPreservedBranch(resource) {
17830
- return resource.worktree_branch !== null && resource.worktree_branch.startsWith(preservedBranchPrefix(resource));
19073
+ return resource.worktree_branch !== null && (resource.worktree_branch.startsWith(preservedBranchPrefix(resource)) || resource.worktree_branch.startsWith(legacyPreservedBranchPrefix(resource)));
17831
19074
  }
17832
19075
  function isStaleEnsembleBranch(resource) {
17833
19076
  return resource.worktree_branch !== null && staleEnsembleBranchNames(resource).includes(resource.worktree_branch);
@@ -17955,18 +19198,18 @@ function validatePurgeTargetsStillArchived(deps, targets) {
17955
19198
  }
17956
19199
  async function collectPreservedBranches(targets, cwd, listBranches) {
17957
19200
  const entries = await Promise.all(targets.map(async (target) => {
17958
- const prefix = `ensemble/preserved/${target.name}/`;
19201
+ const prefixes = [`ensemble/preserved/${target.project_name}/${teamResourceSegment(target.name, target.id)}/`, `ensemble/preserved/${target.name}/`];
17959
19202
  let listed;
17960
19203
  try {
17961
- listed = await listBranches(target.name, cwd);
19204
+ listed = [...await listBranches(target.project_name, cwd), ...await listBranches(target.name, cwd)];
17962
19205
  } catch (err) {
17963
19206
  const message = err instanceof Error ? err.message : String(err);
17964
19207
  if (message.includes("not a git repository"))
17965
19208
  listed = [];
17966
19209
  else
17967
- throw new Error(`Failed to list preserved branches for ${target.name}: ${message}`);
19210
+ throw new Error(`Failed to list preserved branches for ${target.id}: ${message}`);
17968
19211
  }
17969
- const branches = listed.map(normalizeBranchName).filter((branch) => branch.startsWith(prefix));
19212
+ const branches = listed.map(normalizeBranchName).filter((branch) => prefixes.some((prefix) => branch.startsWith(prefix)));
17970
19213
  return [target.id, [...new Set(branches)]];
17971
19214
  }));
17972
19215
  return new Map(entries);
@@ -18090,7 +19333,8 @@ Commit or merge their work first, then call team_cleanup with acknowledge_uncomm
18090
19333
  if (args.force) {
18091
19334
  for (const member of active) {
18092
19335
  if (member.worktree_branch && !member.worktree_branch.startsWith("ensemble/preserved/")) {
18093
- const safeBranch = preservedBranchName(teamInfo.teamName, member.name);
19336
+ const resource = getTeamResourceParts(deps.db, teamInfo.teamId);
19337
+ const safeBranch = preservedBranchName(resource.projectName, resource.teamName, resource.teamId, member.name);
18094
19338
  const ok = await preserveBranch(member.worktree_branch, safeBranch, deps.directory);
18095
19339
  if (ok) {
18096
19340
  deps.db.run("UPDATE team_member SET worktree_branch = ? WHERE team_id = ? AND name = ?", [safeBranch, teamInfo.teamId, member.name]);
@@ -18601,15 +19845,16 @@ class Watchdog {
18601
19845
  if (this.ttlMs === 0)
18602
19846
  return;
18603
19847
  const cutoff = Date.now() - this.ttlMs;
18604
- const stale = this.db.query(`SELECT tm.team_id, tm.name, tm.session_id, tm.worktree_branch, t.name as team_name
19848
+ const stale = this.db.query(`SELECT tm.team_id, tm.name, tm.session_id, tm.worktree_branch, t.name as team_name, p.name as project_name
18605
19849
  FROM team_member tm
18606
19850
  JOIN team t ON tm.team_id = t.id
19851
+ JOIN project p ON t.project_id = p.id
18607
19852
  WHERE t.status = 'active'
18608
19853
  AND tm.status = 'busy'
18609
19854
  AND tm.time_updated < ?`).all(cutoff);
18610
19855
  for (const member of stale) {
18611
19856
  if (this.cwd && member.worktree_branch && !member.worktree_branch.startsWith("ensemble/preserved/")) {
18612
- const safeBranch = preservedBranchName(member.team_name, member.name);
19857
+ const safeBranch = preservedBranchName(member.project_name, member.team_name, member.team_id, member.name);
18613
19858
  const ok = await preserveBranch(member.worktree_branch, safeBranch, this.cwd);
18614
19859
  if (ok) {
18615
19860
  this.db.run("UPDATE team_member SET worktree_branch = ? WHERE team_id = ? AND name = ?", [safeBranch, member.team_id, member.name]);
@@ -18773,15 +20018,13 @@ var plugin = async (input) => {
18773
20018
  } else if (transition.to === "busy_while_shutdown") {
18774
20019
  const member = deps.db.query("SELECT worktree_branch, name, team_id FROM team_member WHERE session_id = ?").get(sessionID);
18775
20020
  if (member?.worktree_branch && !member.worktree_branch.startsWith("ensemble/preserved/")) {
18776
- const teamRow = deps.db.query("SELECT name FROM team WHERE id = ?").get(member.team_id);
18777
- if (teamRow) {
18778
- const { preserveBranch: preserve, preservedBranchName: branchName } = await Promise.resolve().then(() => (init_merge_helper(), exports_merge_helper));
18779
- const safeBranch = branchName(teamRow.name, member.name);
18780
- const ok = await preserve(member.worktree_branch, safeBranch, deps.directory);
18781
- if (ok) {
18782
- deps.db.run("UPDATE team_member SET worktree_branch = ? WHERE team_id = ? AND name = ?", [safeBranch, member.team_id, member.name]);
18783
- log(`busy_while_shutdown:branch:preserved src=${member.worktree_branch} target=${safeBranch}`);
18784
- }
20021
+ const { getTeamResourceParts: getTeamResourceParts2, preserveBranch: preserve, preservedBranchName: branchName } = await Promise.resolve().then(() => (init_merge_helper(), exports_merge_helper));
20022
+ const resource = getTeamResourceParts2(deps.db, member.team_id);
20023
+ const safeBranch = branchName(resource.projectName, resource.teamName, resource.teamId, member.name);
20024
+ const ok = await preserve(member.worktree_branch, safeBranch, deps.directory);
20025
+ if (ok) {
20026
+ deps.db.run("UPDATE team_member SET worktree_branch = ? WHERE team_id = ? AND name = ?", [safeBranch, member.team_id, member.name]);
20027
+ log(`busy_while_shutdown:branch:preserved src=${member.worktree_branch} target=${safeBranch}`);
18785
20028
  }
18786
20029
  }
18787
20030
  try {
@@ -18898,7 +20141,8 @@ var plugin = async (input) => {
18898
20141
  team_create: tool({
18899
20142
  description: "Create a new agent team. You become the team lead. Use this before spawning teammates.",
18900
20143
  args: {
18901
- name: tool.schema.string().describe("Team name (lowercase alphanumeric with hyphens, 1-64 chars)")
20144
+ name: tool.schema.string().describe("Team name (lowercase alphanumeric with hyphens, 1-64 chars)"),
20145
+ project_name: tool.schema.string().optional().describe("Project display name for first use of this working directory. If omitted, a short random name is generated.")
18902
20146
  },
18903
20147
  async execute(args, ctx) {
18904
20148
  const result = await executeTeamCreate(deps, args, ctx.sessionID);