@hueyexe/opencode-ensemble 0.15.2 → 0.16.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
@@ -4,25 +4,43 @@ var __getProtoOf = Object.getPrototypeOf;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
7
12
  var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
8
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
9
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
22
  for (let key of __getOwnPropNames(mod))
11
23
  if (!__hasOwnProp.call(to, key))
12
24
  __defProp(to, key, {
13
- get: () => mod[key],
25
+ get: __accessProp.bind(mod, key),
14
26
  enumerable: true
15
27
  });
28
+ if (canCache)
29
+ cache.set(mod, to);
16
30
  return to;
17
31
  };
18
32
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
+ var __returnValue = (v) => v;
34
+ function __exportSetter(name, newValue) {
35
+ this[name] = __returnValue.bind(null, newValue);
36
+ }
19
37
  var __export = (target, all) => {
20
38
  for (var name in all)
21
39
  __defProp(target, name, {
22
40
  get: all[name],
23
41
  enumerable: true,
24
42
  configurable: true,
25
- set: (newValue) => all[name] = () => newValue
43
+ set: __exportSetter.bind(all, name)
26
44
  });
27
45
  };
28
46
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -11365,7 +11383,7 @@ class JSONSchemaGenerator {
11365
11383
  if (val === undefined) {
11366
11384
  if (this.unrepresentable === "throw") {
11367
11385
  throw new Error("Literal `undefined` cannot be represented in JSON Schema");
11368
- } else {}
11386
+ }
11369
11387
  } else if (typeof val === "bigint") {
11370
11388
  if (this.unrepresentable === "throw") {
11371
11389
  throw new Error("BigInt literals cannot be represented in JSON Schema");
@@ -13908,112 +13926,19 @@ class App extends HeyApiClient {
13908
13926
  }
13909
13927
  }
13910
13928
 
13911
- class Config extends HeyApiClient {
13912
- get(options) {
13913
- return (options?.client ?? this.client).get({
13914
- url: "/global/config",
13915
- ...options
13916
- });
13917
- }
13918
- update(parameters, options) {
13919
- const params = buildClientParams([parameters], [{ args: [{ key: "config", map: "body" }] }]);
13920
- return (options?.client ?? this.client).patch({
13921
- url: "/global/config",
13922
- ...options,
13923
- ...params,
13924
- headers: {
13925
- "Content-Type": "application/json",
13926
- ...options?.headers,
13927
- ...params.headers
13928
- }
13929
- });
13930
- }
13931
- }
13932
-
13933
- class Global extends HeyApiClient {
13934
- health(options) {
13935
- return (options?.client ?? this.client).get({
13936
- url: "/global/health",
13937
- ...options
13938
- });
13939
- }
13940
- event(options) {
13941
- return (options?.client ?? this.client).sse.get({
13942
- url: "/global/event",
13943
- ...options
13944
- });
13945
- }
13946
- dispose(options) {
13947
- return (options?.client ?? this.client).post({
13948
- url: "/global/dispose",
13949
- ...options
13950
- });
13951
- }
13952
- upgrade(parameters, options) {
13953
- const params = buildClientParams([parameters], [{ args: [{ in: "body", key: "target" }] }]);
13954
- return (options?.client ?? this.client).post({
13955
- url: "/global/upgrade",
13956
- ...options,
13957
- ...params,
13958
- headers: {
13959
- "Content-Type": "application/json",
13960
- ...options?.headers,
13961
- ...params.headers
13962
- }
13963
- });
13964
- }
13965
- _config;
13966
- get config() {
13967
- return this._config ??= new Config({ client: this.client });
13968
- }
13969
- }
13970
-
13971
- class Event extends HeyApiClient {
13972
- subscribe(parameters, options) {
13973
- const params = buildClientParams([parameters], [
13974
- {
13975
- args: [
13976
- { in: "query", key: "directory" },
13977
- { in: "query", key: "workspace" }
13978
- ]
13979
- }
13980
- ]);
13981
- return (options?.client ?? this.client).sse.get({
13982
- url: "/event",
13983
- ...options,
13984
- ...params
13985
- });
13986
- }
13987
- }
13988
-
13989
- class Config2 extends HeyApiClient {
13990
- get(parameters, options) {
13991
- const params = buildClientParams([parameters], [
13992
- {
13993
- args: [
13994
- { in: "query", key: "directory" },
13995
- { in: "query", key: "workspace" }
13996
- ]
13997
- }
13998
- ]);
13999
- return (options?.client ?? this.client).get({
14000
- url: "/config",
14001
- ...options,
14002
- ...params
14003
- });
14004
- }
14005
- update(parameters, options) {
13929
+ class ControlPlane extends HeyApiClient {
13930
+ moveSession(parameters, options) {
14006
13931
  const params = buildClientParams([parameters], [
14007
13932
  {
14008
13933
  args: [
14009
- { in: "query", key: "directory" },
14010
- { in: "query", key: "workspace" },
14011
- { key: "config", map: "body" }
13934
+ { in: "body", key: "sessionID" },
13935
+ { in: "body", key: "destination" },
13936
+ { in: "body", key: "moveChanges" }
14012
13937
  ]
14013
13938
  }
14014
13939
  ]);
14015
- return (options?.client ?? this.client).patch({
14016
- url: "/config",
13940
+ return (options?.client ?? this.client).post({
13941
+ url: "/experimental/control-plane/move-session",
14017
13942
  ...options,
14018
13943
  ...params,
14019
13944
  headers: {
@@ -14023,7 +13948,10 @@ class Config2 extends HeyApiClient {
14023
13948
  }
14024
13949
  });
14025
13950
  }
14026
- providers(parameters, options) {
13951
+ }
13952
+
13953
+ class Capabilities extends HeyApiClient {
13954
+ get(parameters, options) {
14027
13955
  const params = buildClientParams([parameters], [
14028
13956
  {
14029
13957
  args: [
@@ -14033,7 +13961,7 @@ class Config2 extends HeyApiClient {
14033
13961
  }
14034
13962
  ]);
14035
13963
  return (options?.client ?? this.client).get({
14036
- url: "/config/providers",
13964
+ url: "/experimental/capabilities",
14037
13965
  ...options,
14038
13966
  ...params
14039
13967
  });
@@ -14117,6 +14045,22 @@ class Session extends HeyApiClient {
14117
14045
  ...params
14118
14046
  });
14119
14047
  }
14048
+ background(parameters, options) {
14049
+ const params = buildClientParams([parameters], [
14050
+ {
14051
+ args: [
14052
+ { in: "path", key: "sessionID" },
14053
+ { in: "query", key: "directory" },
14054
+ { in: "query", key: "workspace" }
14055
+ ]
14056
+ }
14057
+ ]);
14058
+ return (options?.client ?? this.client).post({
14059
+ url: "/experimental/session/{sessionID}/background",
14060
+ ...options,
14061
+ ...params
14062
+ });
14063
+ }
14120
14064
  }
14121
14065
 
14122
14066
  class Resource extends HeyApiClient {
@@ -14137,6 +14081,31 @@ class Resource extends HeyApiClient {
14137
14081
  }
14138
14082
  }
14139
14083
 
14084
+ class ProjectCopy extends HeyApiClient {
14085
+ generateName(parameters, options) {
14086
+ const params = buildClientParams([parameters], [
14087
+ {
14088
+ args: [
14089
+ { in: "path", key: "projectID" },
14090
+ { in: "query", key: "directory" },
14091
+ { in: "query", key: "workspace" },
14092
+ { in: "body", key: "context" }
14093
+ ]
14094
+ }
14095
+ ]);
14096
+ return (options?.client ?? this.client).post({
14097
+ url: "/experimental/project/{projectID}/copy/generate-name",
14098
+ ...options,
14099
+ ...params,
14100
+ headers: {
14101
+ "Content-Type": "application/json",
14102
+ ...options?.headers,
14103
+ ...params.headers
14104
+ }
14105
+ });
14106
+ }
14107
+ }
14108
+
14140
14109
  class Adapter extends HeyApiClient {
14141
14110
  list(parameters, options) {
14142
14111
  const params = buildClientParams([parameters], [
@@ -14271,6 +14240,14 @@ class Workspace extends HeyApiClient {
14271
14240
  }
14272
14241
 
14273
14242
  class Experimental extends HeyApiClient {
14243
+ _controlPlane;
14244
+ get controlPlane() {
14245
+ return this._controlPlane ??= new ControlPlane({ client: this.client });
14246
+ }
14247
+ _capabilities;
14248
+ get capabilities() {
14249
+ return this._capabilities ??= new Capabilities({ client: this.client });
14250
+ }
14274
14251
  _console;
14275
14252
  get console() {
14276
14253
  return this._console ??= new Console({ client: this.client });
@@ -14283,31 +14260,96 @@ class Experimental extends HeyApiClient {
14283
14260
  get resource() {
14284
14261
  return this._resource ??= new Resource({ client: this.client });
14285
14262
  }
14263
+ _projectCopy;
14264
+ get projectCopy() {
14265
+ return this._projectCopy ??= new ProjectCopy({ client: this.client });
14266
+ }
14286
14267
  _workspace;
14287
14268
  get workspace() {
14288
14269
  return this._workspace ??= new Workspace({ client: this.client });
14289
14270
  }
14290
14271
  }
14291
14272
 
14292
- class Tool extends HeyApiClient {
14293
- list(parameters, options) {
14273
+ class Config extends HeyApiClient {
14274
+ get(options) {
14275
+ return (options?.client ?? this.client).get({
14276
+ url: "/global/config",
14277
+ ...options
14278
+ });
14279
+ }
14280
+ update(parameters, options) {
14281
+ const params = buildClientParams([parameters], [{ args: [{ key: "config", map: "body" }] }]);
14282
+ return (options?.client ?? this.client).patch({
14283
+ url: "/global/config",
14284
+ ...options,
14285
+ ...params,
14286
+ headers: {
14287
+ "Content-Type": "application/json",
14288
+ ...options?.headers,
14289
+ ...params.headers
14290
+ }
14291
+ });
14292
+ }
14293
+ }
14294
+
14295
+ class Global extends HeyApiClient {
14296
+ health(options) {
14297
+ return (options?.client ?? this.client).get({
14298
+ url: "/global/health",
14299
+ ...options
14300
+ });
14301
+ }
14302
+ event(options) {
14303
+ return (options?.client ?? this.client).sse.get({
14304
+ url: "/global/event",
14305
+ ...options
14306
+ });
14307
+ }
14308
+ dispose(options) {
14309
+ return (options?.client ?? this.client).post({
14310
+ url: "/global/dispose",
14311
+ ...options
14312
+ });
14313
+ }
14314
+ upgrade(parameters, options) {
14315
+ const params = buildClientParams([parameters], [{ args: [{ in: "body", key: "target" }] }]);
14316
+ return (options?.client ?? this.client).post({
14317
+ url: "/global/upgrade",
14318
+ ...options,
14319
+ ...params,
14320
+ headers: {
14321
+ "Content-Type": "application/json",
14322
+ ...options?.headers,
14323
+ ...params.headers
14324
+ }
14325
+ });
14326
+ }
14327
+ _config;
14328
+ get config() {
14329
+ return this._config ??= new Config({ client: this.client });
14330
+ }
14331
+ }
14332
+
14333
+ class Event extends HeyApiClient {
14334
+ subscribe(parameters, options) {
14294
14335
  const params = buildClientParams([parameters], [
14295
14336
  {
14296
14337
  args: [
14297
14338
  { in: "query", key: "directory" },
14298
- { in: "query", key: "workspace" },
14299
- { in: "query", key: "provider" },
14300
- { in: "query", key: "model" }
14339
+ { in: "query", key: "workspace" }
14301
14340
  ]
14302
14341
  }
14303
14342
  ]);
14304
- return (options?.client ?? this.client).get({
14305
- url: "/experimental/tool",
14343
+ return (options?.client ?? this.client).sse.get({
14344
+ url: "/event",
14306
14345
  ...options,
14307
14346
  ...params
14308
14347
  });
14309
14348
  }
14310
- ids(parameters, options) {
14349
+ }
14350
+
14351
+ class Config2 extends HeyApiClient {
14352
+ get(parameters, options) {
14311
14353
  const params = buildClientParams([parameters], [
14312
14354
  {
14313
14355
  args: [
@@ -14317,26 +14359,23 @@ class Tool extends HeyApiClient {
14317
14359
  }
14318
14360
  ]);
14319
14361
  return (options?.client ?? this.client).get({
14320
- url: "/experimental/tool/ids",
14362
+ url: "/config",
14321
14363
  ...options,
14322
14364
  ...params
14323
14365
  });
14324
14366
  }
14325
- }
14326
-
14327
- class Worktree extends HeyApiClient {
14328
- remove(parameters, options) {
14367
+ update(parameters, options) {
14329
14368
  const params = buildClientParams([parameters], [
14330
14369
  {
14331
14370
  args: [
14332
14371
  { in: "query", key: "directory" },
14333
14372
  { in: "query", key: "workspace" },
14334
- { key: "worktreeRemoveInput", map: "body" }
14373
+ { key: "config", map: "body" }
14335
14374
  ]
14336
14375
  }
14337
14376
  ]);
14338
- return (options?.client ?? this.client).delete({
14339
- url: "/experimental/worktree",
14377
+ return (options?.client ?? this.client).patch({
14378
+ url: "/config",
14340
14379
  ...options,
14341
14380
  ...params,
14342
14381
  headers: {
@@ -14346,7 +14385,7 @@ class Worktree extends HeyApiClient {
14346
14385
  }
14347
14386
  });
14348
14387
  }
14349
- list(parameters, options) {
14388
+ providers(parameters, options) {
14350
14389
  const params = buildClientParams([parameters], [
14351
14390
  {
14352
14391
  args: [
@@ -14356,25 +14395,99 @@ class Worktree extends HeyApiClient {
14356
14395
  }
14357
14396
  ]);
14358
14397
  return (options?.client ?? this.client).get({
14359
- url: "/experimental/worktree",
14398
+ url: "/config/providers",
14360
14399
  ...options,
14361
14400
  ...params
14362
14401
  });
14363
14402
  }
14364
- create(parameters, options) {
14403
+ }
14404
+
14405
+ class Tool extends HeyApiClient {
14406
+ list(parameters, options) {
14365
14407
  const params = buildClientParams([parameters], [
14366
14408
  {
14367
14409
  args: [
14368
14410
  { in: "query", key: "directory" },
14369
14411
  { in: "query", key: "workspace" },
14370
- { key: "worktreeCreateInput", map: "body" }
14412
+ { in: "query", key: "provider" },
14413
+ { in: "query", key: "model" }
14371
14414
  ]
14372
14415
  }
14373
14416
  ]);
14374
- return (options?.client ?? this.client).post({
14375
- url: "/experimental/worktree",
14417
+ return (options?.client ?? this.client).get({
14418
+ url: "/experimental/tool",
14376
14419
  ...options,
14377
- ...params,
14420
+ ...params
14421
+ });
14422
+ }
14423
+ ids(parameters, options) {
14424
+ const params = buildClientParams([parameters], [
14425
+ {
14426
+ args: [
14427
+ { in: "query", key: "directory" },
14428
+ { in: "query", key: "workspace" }
14429
+ ]
14430
+ }
14431
+ ]);
14432
+ return (options?.client ?? this.client).get({
14433
+ url: "/experimental/tool/ids",
14434
+ ...options,
14435
+ ...params
14436
+ });
14437
+ }
14438
+ }
14439
+
14440
+ class Worktree extends HeyApiClient {
14441
+ remove(parameters, options) {
14442
+ const params = buildClientParams([parameters], [
14443
+ {
14444
+ args: [
14445
+ { in: "query", key: "directory" },
14446
+ { in: "query", key: "workspace" },
14447
+ { key: "worktreeRemoveInput", map: "body" }
14448
+ ]
14449
+ }
14450
+ ]);
14451
+ return (options?.client ?? this.client).delete({
14452
+ url: "/experimental/worktree",
14453
+ ...options,
14454
+ ...params,
14455
+ headers: {
14456
+ "Content-Type": "application/json",
14457
+ ...options?.headers,
14458
+ ...params.headers
14459
+ }
14460
+ });
14461
+ }
14462
+ list(parameters, options) {
14463
+ const params = buildClientParams([parameters], [
14464
+ {
14465
+ args: [
14466
+ { in: "query", key: "directory" },
14467
+ { in: "query", key: "workspace" }
14468
+ ]
14469
+ }
14470
+ ]);
14471
+ return (options?.client ?? this.client).get({
14472
+ url: "/experimental/worktree",
14473
+ ...options,
14474
+ ...params
14475
+ });
14476
+ }
14477
+ create(parameters, options) {
14478
+ const params = buildClientParams([parameters], [
14479
+ {
14480
+ args: [
14481
+ { in: "query", key: "directory" },
14482
+ { in: "query", key: "workspace" },
14483
+ { key: "worktreeCreateInput", map: "body" }
14484
+ ]
14485
+ }
14486
+ ]);
14487
+ return (options?.client ?? this.client).post({
14488
+ url: "/experimental/worktree",
14489
+ ...options,
14490
+ ...params,
14378
14491
  headers: {
14379
14492
  "Content-Type": "application/json",
14380
14493
  ...options?.headers,
@@ -14600,7 +14713,8 @@ class Vcs extends HeyApiClient {
14600
14713
  args: [
14601
14714
  { in: "query", key: "directory" },
14602
14715
  { in: "query", key: "workspace" },
14603
- { in: "query", key: "mode" }
14716
+ { in: "query", key: "mode" },
14717
+ { in: "query", key: "context" }
14604
14718
  ]
14605
14719
  }
14606
14720
  ]);
@@ -14910,6 +15024,22 @@ class Project extends HeyApiClient {
14910
15024
  }
14911
15025
  });
14912
15026
  }
15027
+ directories(parameters, options) {
15028
+ const params = buildClientParams([parameters], [
15029
+ {
15030
+ args: [
15031
+ { in: "path", key: "projectID" },
15032
+ { in: "query", key: "directory" },
15033
+ { in: "query", key: "workspace" }
15034
+ ]
15035
+ }
15036
+ ]);
15037
+ return (options?.client ?? this.client).get({
15038
+ url: "/project/{projectID}/directories",
15039
+ ...options,
15040
+ ...params
15041
+ });
15042
+ }
14913
15043
  }
14914
15044
 
14915
15045
  class Pty extends HeyApiClient {
@@ -15045,7 +15175,9 @@ class Pty extends HeyApiClient {
15045
15175
  args: [
15046
15176
  { in: "path", key: "ptyID" },
15047
15177
  { in: "query", key: "directory" },
15048
- { in: "query", key: "workspace" }
15178
+ { in: "query", key: "workspace" },
15179
+ { in: "query", key: "cursor" },
15180
+ { in: "query", key: "ticket" }
15049
15181
  ]
15050
15182
  }
15051
15183
  ]);
@@ -15295,6 +15427,7 @@ class Session2 extends HeyApiClient {
15295
15427
  { in: "body", key: "title" },
15296
15428
  { in: "body", key: "agent" },
15297
15429
  { in: "body", key: "model" },
15430
+ { in: "body", key: "metadata" },
15298
15431
  { in: "body", key: "permission" },
15299
15432
  { in: "body", key: "workspaceID" }
15300
15433
  ]
@@ -15366,6 +15499,7 @@ class Session2 extends HeyApiClient {
15366
15499
  { in: "query", key: "directory" },
15367
15500
  { in: "query", key: "workspace" },
15368
15501
  { in: "body", key: "title" },
15502
+ { in: "body", key: "metadata" },
15369
15503
  { in: "body", key: "permission" },
15370
15504
  { in: "body", key: "time" }
15371
15505
  ]
@@ -15897,43 +16031,34 @@ class Sync extends HeyApiClient {
15897
16031
  }
15898
16032
  }
15899
16033
 
15900
- class Session3 extends HeyApiClient {
15901
- list(parameters, options) {
16034
+ class Control extends HeyApiClient {
16035
+ next(parameters, options) {
15902
16036
  const params = buildClientParams([parameters], [
15903
16037
  {
15904
16038
  args: [
15905
16039
  { 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" }
16040
+ { in: "query", key: "workspace" }
15914
16041
  ]
15915
16042
  }
15916
16043
  ]);
15917
16044
  return (options?.client ?? this.client).get({
15918
- url: "/api/session",
16045
+ url: "/tui/control/next",
15919
16046
  ...options,
15920
16047
  ...params
15921
16048
  });
15922
16049
  }
15923
- prompt(parameters, options) {
16050
+ response(parameters, options) {
15924
16051
  const params = buildClientParams([parameters], [
15925
16052
  {
15926
16053
  args: [
15927
- { in: "path", key: "sessionID" },
15928
16054
  { in: "query", key: "directory" },
15929
16055
  { in: "query", key: "workspace" },
15930
- { in: "body", key: "prompt" },
15931
- { in: "body", key: "delivery" }
16056
+ { key: "body", map: "body" }
15932
16057
  ]
15933
16058
  }
15934
16059
  ]);
15935
16060
  return (options?.client ?? this.client).post({
15936
- url: "/api/session/{sessionID}/prompt",
16061
+ url: "/tui/control/response",
15937
16062
  ...options,
15938
16063
  ...params,
15939
16064
  headers: {
@@ -15943,129 +16068,106 @@ class Session3 extends HeyApiClient {
15943
16068
  }
15944
16069
  });
15945
16070
  }
15946
- compact(parameters, options) {
16071
+ }
16072
+
16073
+ class Tui extends HeyApiClient {
16074
+ appendPrompt(parameters, options) {
15947
16075
  const params = buildClientParams([parameters], [
15948
16076
  {
15949
16077
  args: [
15950
- { in: "path", key: "sessionID" },
15951
16078
  { in: "query", key: "directory" },
15952
- { in: "query", key: "workspace" }
16079
+ { in: "query", key: "workspace" },
16080
+ { in: "body", key: "text" }
15953
16081
  ]
15954
16082
  }
15955
16083
  ]);
15956
16084
  return (options?.client ?? this.client).post({
15957
- url: "/api/session/{sessionID}/compact",
16085
+ url: "/tui/append-prompt",
15958
16086
  ...options,
15959
- ...params
16087
+ ...params,
16088
+ headers: {
16089
+ "Content-Type": "application/json",
16090
+ ...options?.headers,
16091
+ ...params.headers
16092
+ }
15960
16093
  });
15961
16094
  }
15962
- wait(parameters, options) {
16095
+ openHelp(parameters, options) {
15963
16096
  const params = buildClientParams([parameters], [
15964
16097
  {
15965
16098
  args: [
15966
- { in: "path", key: "sessionID" },
15967
16099
  { in: "query", key: "directory" },
15968
16100
  { in: "query", key: "workspace" }
15969
16101
  ]
15970
16102
  }
15971
16103
  ]);
15972
16104
  return (options?.client ?? this.client).post({
15973
- url: "/api/session/{sessionID}/wait",
16105
+ url: "/tui/open-help",
15974
16106
  ...options,
15975
16107
  ...params
15976
16108
  });
15977
16109
  }
15978
- context(parameters, options) {
16110
+ openSessions(parameters, options) {
15979
16111
  const params = buildClientParams([parameters], [
15980
16112
  {
15981
16113
  args: [
15982
- { in: "path", key: "sessionID" },
15983
16114
  { in: "query", key: "directory" },
15984
16115
  { in: "query", key: "workspace" }
15985
16116
  ]
15986
16117
  }
15987
16118
  ]);
15988
- return (options?.client ?? this.client).get({
15989
- url: "/api/session/{sessionID}/context",
16119
+ return (options?.client ?? this.client).post({
16120
+ url: "/tui/open-sessions",
15990
16121
  ...options,
15991
16122
  ...params
15992
16123
  });
15993
16124
  }
15994
- messages(parameters, options) {
16125
+ openThemes(parameters, options) {
15995
16126
  const params = buildClientParams([parameters], [
15996
16127
  {
15997
16128
  args: [
15998
- { in: "path", key: "sessionID" },
15999
16129
  { in: "query", key: "directory" },
16000
- { in: "query", key: "workspace" },
16001
- { in: "query", key: "limit" },
16002
- { in: "query", key: "order" },
16003
- { in: "query", key: "cursor" }
16130
+ { in: "query", key: "workspace" }
16004
16131
  ]
16005
16132
  }
16006
16133
  ]);
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",
16134
+ return (options?.client ?? this.client).post({
16135
+ url: "/tui/open-themes",
16020
16136
  ...options,
16021
16137
  ...params
16022
16138
  });
16023
16139
  }
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",
16140
+ openModels(parameters, options) {
16141
+ const params = buildClientParams([parameters], [
16142
+ {
16143
+ args: [
16144
+ { in: "query", key: "directory" },
16145
+ { in: "query", key: "workspace" }
16146
+ ]
16147
+ }
16148
+ ]);
16149
+ return (options?.client ?? this.client).post({
16150
+ url: "/tui/open-models",
16031
16151
  ...options,
16032
16152
  ...params
16033
16153
  });
16034
16154
  }
16035
- get(parameters, options) {
16155
+ submitPrompt(parameters, options) {
16036
16156
  const params = buildClientParams([parameters], [
16037
16157
  {
16038
16158
  args: [
16039
- { in: "path", key: "providerID" },
16040
- { in: "query", key: "location" }
16159
+ { in: "query", key: "directory" },
16160
+ { in: "query", key: "workspace" }
16041
16161
  ]
16042
16162
  }
16043
16163
  ]);
16044
- return (options?.client ?? this.client).get({
16045
- url: "/api/provider/{providerID}",
16164
+ return (options?.client ?? this.client).post({
16165
+ url: "/tui/submit-prompt",
16046
16166
  ...options,
16047
16167
  ...params
16048
16168
  });
16049
16169
  }
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 });
16064
- }
16065
- }
16066
-
16067
- class Control extends HeyApiClient {
16068
- next(parameters, options) {
16170
+ clearPrompt(parameters, options) {
16069
16171
  const params = buildClientParams([parameters], [
16070
16172
  {
16071
16173
  args: [
@@ -16074,24 +16176,24 @@ class Control extends HeyApiClient {
16074
16176
  ]
16075
16177
  }
16076
16178
  ]);
16077
- return (options?.client ?? this.client).get({
16078
- url: "/tui/control/next",
16179
+ return (options?.client ?? this.client).post({
16180
+ url: "/tui/clear-prompt",
16079
16181
  ...options,
16080
16182
  ...params
16081
16183
  });
16082
16184
  }
16083
- response(parameters, options) {
16185
+ executeCommand(parameters, options) {
16084
16186
  const params = buildClientParams([parameters], [
16085
16187
  {
16086
16188
  args: [
16087
16189
  { in: "query", key: "directory" },
16088
16190
  { in: "query", key: "workspace" },
16089
- { key: "body", map: "body" }
16191
+ { in: "body", key: "command" }
16090
16192
  ]
16091
16193
  }
16092
16194
  ]);
16093
16195
  return (options?.client ?? this.client).post({
16094
- url: "/tui/control/response",
16196
+ url: "/tui/execute-command",
16095
16197
  ...options,
16096
16198
  ...params,
16097
16199
  headers: {
@@ -16101,21 +16203,21 @@ class Control extends HeyApiClient {
16101
16203
  }
16102
16204
  });
16103
16205
  }
16104
- }
16105
-
16106
- class Tui extends HeyApiClient {
16107
- appendPrompt(parameters, options) {
16206
+ showToast(parameters, options) {
16108
16207
  const params = buildClientParams([parameters], [
16109
16208
  {
16110
16209
  args: [
16111
16210
  { in: "query", key: "directory" },
16112
16211
  { in: "query", key: "workspace" },
16113
- { in: "body", key: "text" }
16212
+ { in: "body", key: "title" },
16213
+ { in: "body", key: "message" },
16214
+ { in: "body", key: "variant" },
16215
+ { in: "body", key: "duration" }
16114
16216
  ]
16115
16217
  }
16116
16218
  ]);
16117
16219
  return (options?.client ?? this.client).post({
16118
- url: "/tui/append-prompt",
16220
+ url: "/tui/show-toast",
16119
16221
  ...options,
16120
16222
  ...params,
16121
16223
  headers: {
@@ -16125,132 +16227,966 @@ class Tui extends HeyApiClient {
16125
16227
  }
16126
16228
  });
16127
16229
  }
16128
- openHelp(parameters, options) {
16230
+ publish(parameters, options) {
16129
16231
  const params = buildClientParams([parameters], [
16130
16232
  {
16131
16233
  args: [
16132
16234
  { in: "query", key: "directory" },
16133
- { in: "query", key: "workspace" }
16235
+ { in: "query", key: "workspace" },
16236
+ { key: "body", map: "body" }
16134
16237
  ]
16135
16238
  }
16136
16239
  ]);
16137
16240
  return (options?.client ?? this.client).post({
16138
- url: "/tui/open-help",
16241
+ url: "/tui/publish",
16139
16242
  ...options,
16140
- ...params
16243
+ ...params,
16244
+ headers: {
16245
+ "Content-Type": "application/json",
16246
+ ...options?.headers,
16247
+ ...params.headers
16248
+ }
16141
16249
  });
16142
16250
  }
16143
- openSessions(parameters, options) {
16251
+ selectSession(parameters, options) {
16144
16252
  const params = buildClientParams([parameters], [
16145
16253
  {
16146
16254
  args: [
16147
16255
  { in: "query", key: "directory" },
16148
- { in: "query", key: "workspace" }
16256
+ { in: "query", key: "workspace" },
16257
+ { in: "body", key: "sessionID" }
16149
16258
  ]
16150
16259
  }
16151
16260
  ]);
16152
16261
  return (options?.client ?? this.client).post({
16153
- url: "/tui/open-sessions",
16262
+ url: "/tui/select-session",
16154
16263
  ...options,
16155
- ...params
16156
- });
16264
+ ...params,
16265
+ headers: {
16266
+ "Content-Type": "application/json",
16267
+ ...options?.headers,
16268
+ ...params.headers
16269
+ }
16270
+ });
16271
+ }
16272
+ _control;
16273
+ get control() {
16274
+ return this._control ??= new Control({ client: this.client });
16275
+ }
16276
+ }
16277
+
16278
+ class Health extends HeyApiClient {
16279
+ get(options) {
16280
+ return (options?.client ?? this.client).get({
16281
+ url: "/api/health",
16282
+ ...options
16283
+ });
16284
+ }
16285
+ }
16286
+
16287
+ class Location extends HeyApiClient {
16288
+ get(parameters, options) {
16289
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
16290
+ return (options?.client ?? this.client).get({
16291
+ url: "/api/location",
16292
+ ...options,
16293
+ ...params
16294
+ });
16295
+ }
16296
+ }
16297
+
16298
+ class Agent extends HeyApiClient {
16299
+ list(parameters, options) {
16300
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
16301
+ return (options?.client ?? this.client).get({
16302
+ url: "/api/agent",
16303
+ ...options,
16304
+ ...params
16305
+ });
16306
+ }
16307
+ }
16308
+
16309
+ class Revert extends HeyApiClient {
16310
+ stage(parameters, options) {
16311
+ const params = buildClientParams([parameters], [
16312
+ {
16313
+ args: [
16314
+ { in: "path", key: "sessionID" },
16315
+ { in: "body", key: "messageID" },
16316
+ { in: "body", key: "files" }
16317
+ ]
16318
+ }
16319
+ ]);
16320
+ return (options?.client ?? this.client).post({
16321
+ url: "/api/session/{sessionID}/revert/stage",
16322
+ ...options,
16323
+ ...params,
16324
+ headers: {
16325
+ "Content-Type": "application/json",
16326
+ ...options?.headers,
16327
+ ...params.headers
16328
+ }
16329
+ });
16330
+ }
16331
+ clear(parameters, options) {
16332
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }]);
16333
+ return (options?.client ?? this.client).post({
16334
+ url: "/api/session/{sessionID}/revert/clear",
16335
+ ...options,
16336
+ ...params
16337
+ });
16338
+ }
16339
+ commit(parameters, options) {
16340
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }]);
16341
+ return (options?.client ?? this.client).post({
16342
+ url: "/api/session/{sessionID}/revert/commit",
16343
+ ...options,
16344
+ ...params
16345
+ });
16346
+ }
16347
+ }
16348
+
16349
+ class Permission2 extends HeyApiClient {
16350
+ list(parameters, options) {
16351
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }]);
16352
+ return (options?.client ?? this.client).get({
16353
+ url: "/api/session/{sessionID}/permission",
16354
+ ...options,
16355
+ ...params
16356
+ });
16357
+ }
16358
+ create(parameters, options) {
16359
+ const params = buildClientParams([parameters], [
16360
+ {
16361
+ args: [
16362
+ { in: "path", key: "sessionID" },
16363
+ { in: "body", key: "id" },
16364
+ { in: "body", key: "action" },
16365
+ { in: "body", key: "resources" },
16366
+ { in: "body", key: "save" },
16367
+ { in: "body", key: "metadata" },
16368
+ { in: "body", key: "source" },
16369
+ { in: "body", key: "agent" }
16370
+ ]
16371
+ }
16372
+ ]);
16373
+ return (options?.client ?? this.client).post({
16374
+ url: "/api/session/{sessionID}/permission",
16375
+ ...options,
16376
+ ...params,
16377
+ headers: {
16378
+ "Content-Type": "application/json",
16379
+ ...options?.headers,
16380
+ ...params.headers
16381
+ }
16382
+ });
16383
+ }
16384
+ get(parameters, options) {
16385
+ const params = buildClientParams([parameters], [
16386
+ {
16387
+ args: [
16388
+ { in: "path", key: "sessionID" },
16389
+ { in: "path", key: "requestID" }
16390
+ ]
16391
+ }
16392
+ ]);
16393
+ return (options?.client ?? this.client).get({
16394
+ url: "/api/session/{sessionID}/permission/{requestID}",
16395
+ ...options,
16396
+ ...params
16397
+ });
16398
+ }
16399
+ reply(parameters, options) {
16400
+ const params = buildClientParams([parameters], [
16401
+ {
16402
+ args: [
16403
+ { in: "path", key: "sessionID" },
16404
+ { in: "path", key: "requestID" },
16405
+ { in: "body", key: "reply" },
16406
+ { in: "body", key: "message" }
16407
+ ]
16408
+ }
16409
+ ]);
16410
+ return (options?.client ?? this.client).post({
16411
+ url: "/api/session/{sessionID}/permission/{requestID}/reply",
16412
+ ...options,
16413
+ ...params,
16414
+ headers: {
16415
+ "Content-Type": "application/json",
16416
+ ...options?.headers,
16417
+ ...params.headers
16418
+ }
16419
+ });
16420
+ }
16421
+ }
16422
+
16423
+ class Question2 extends HeyApiClient {
16424
+ list(parameters, options) {
16425
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }]);
16426
+ return (options?.client ?? this.client).get({
16427
+ url: "/api/session/{sessionID}/question",
16428
+ ...options,
16429
+ ...params
16430
+ });
16431
+ }
16432
+ reply(parameters, options) {
16433
+ const params = buildClientParams([parameters], [
16434
+ {
16435
+ args: [
16436
+ { in: "path", key: "sessionID" },
16437
+ { in: "path", key: "requestID" },
16438
+ { key: "questionV2Reply", map: "body" }
16439
+ ]
16440
+ }
16441
+ ]);
16442
+ return (options?.client ?? this.client).post({
16443
+ url: "/api/session/{sessionID}/question/{requestID}/reply",
16444
+ ...options,
16445
+ ...params,
16446
+ headers: {
16447
+ "Content-Type": "application/json",
16448
+ ...options?.headers,
16449
+ ...params.headers
16450
+ }
16451
+ });
16452
+ }
16453
+ reject(parameters, options) {
16454
+ const params = buildClientParams([parameters], [
16455
+ {
16456
+ args: [
16457
+ { in: "path", key: "sessionID" },
16458
+ { in: "path", key: "requestID" }
16459
+ ]
16460
+ }
16461
+ ]);
16462
+ return (options?.client ?? this.client).post({
16463
+ url: "/api/session/{sessionID}/question/{requestID}/reject",
16464
+ ...options,
16465
+ ...params
16466
+ });
16467
+ }
16468
+ }
16469
+
16470
+ class Session3 extends HeyApiClient {
16471
+ list(parameters, options) {
16472
+ const params = buildClientParams([parameters], [
16473
+ {
16474
+ args: [
16475
+ { in: "query", key: "workspace" },
16476
+ { in: "query", key: "limit" },
16477
+ { in: "query", key: "order" },
16478
+ { in: "query", key: "search" },
16479
+ { in: "query", key: "directory" },
16480
+ { in: "query", key: "project" },
16481
+ { in: "query", key: "subpath" },
16482
+ { in: "query", key: "cursor" }
16483
+ ]
16484
+ }
16485
+ ]);
16486
+ return (options?.client ?? this.client).get({
16487
+ url: "/api/session",
16488
+ ...options,
16489
+ ...params
16490
+ });
16491
+ }
16492
+ create(parameters, options) {
16493
+ const params = buildClientParams([parameters], [
16494
+ {
16495
+ args: [
16496
+ { in: "body", key: "id" },
16497
+ { in: "body", key: "agent" },
16498
+ { in: "body", key: "model" },
16499
+ { in: "body", key: "location" }
16500
+ ]
16501
+ }
16502
+ ]);
16503
+ return (options?.client ?? this.client).post({
16504
+ url: "/api/session",
16505
+ ...options,
16506
+ ...params,
16507
+ headers: {
16508
+ "Content-Type": "application/json",
16509
+ ...options?.headers,
16510
+ ...params.headers
16511
+ }
16512
+ });
16513
+ }
16514
+ active(options) {
16515
+ return (options?.client ?? this.client).get({
16516
+ url: "/api/session/active",
16517
+ ...options
16518
+ });
16519
+ }
16520
+ get(parameters, options) {
16521
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }]);
16522
+ return (options?.client ?? this.client).get({
16523
+ url: "/api/session/{sessionID}",
16524
+ ...options,
16525
+ ...params
16526
+ });
16527
+ }
16528
+ switchAgent(parameters, options) {
16529
+ const params = buildClientParams([parameters], [
16530
+ {
16531
+ args: [
16532
+ { in: "path", key: "sessionID" },
16533
+ { in: "body", key: "agent" }
16534
+ ]
16535
+ }
16536
+ ]);
16537
+ return (options?.client ?? this.client).post({
16538
+ url: "/api/session/{sessionID}/agent",
16539
+ ...options,
16540
+ ...params,
16541
+ headers: {
16542
+ "Content-Type": "application/json",
16543
+ ...options?.headers,
16544
+ ...params.headers
16545
+ }
16546
+ });
16547
+ }
16548
+ switchModel(parameters, options) {
16549
+ const params = buildClientParams([parameters], [
16550
+ {
16551
+ args: [
16552
+ { in: "path", key: "sessionID" },
16553
+ { in: "body", key: "model" }
16554
+ ]
16555
+ }
16556
+ ]);
16557
+ return (options?.client ?? this.client).post({
16558
+ url: "/api/session/{sessionID}/model",
16559
+ ...options,
16560
+ ...params,
16561
+ headers: {
16562
+ "Content-Type": "application/json",
16563
+ ...options?.headers,
16564
+ ...params.headers
16565
+ }
16566
+ });
16567
+ }
16568
+ prompt(parameters, options) {
16569
+ const params = buildClientParams([parameters], [
16570
+ {
16571
+ args: [
16572
+ { in: "path", key: "sessionID" },
16573
+ { in: "body", key: "id" },
16574
+ { in: "body", key: "prompt" },
16575
+ { in: "body", key: "delivery" },
16576
+ { in: "body", key: "resume" }
16577
+ ]
16578
+ }
16579
+ ]);
16580
+ return (options?.client ?? this.client).post({
16581
+ url: "/api/session/{sessionID}/prompt",
16582
+ ...options,
16583
+ ...params,
16584
+ headers: {
16585
+ "Content-Type": "application/json",
16586
+ ...options?.headers,
16587
+ ...params.headers
16588
+ }
16589
+ });
16590
+ }
16591
+ compact(parameters, options) {
16592
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }]);
16593
+ return (options?.client ?? this.client).post({
16594
+ url: "/api/session/{sessionID}/compact",
16595
+ ...options,
16596
+ ...params
16597
+ });
16598
+ }
16599
+ wait(parameters, options) {
16600
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }]);
16601
+ return (options?.client ?? this.client).post({
16602
+ url: "/api/session/{sessionID}/wait",
16603
+ ...options,
16604
+ ...params
16605
+ });
16606
+ }
16607
+ context(parameters, options) {
16608
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }]);
16609
+ return (options?.client ?? this.client).get({
16610
+ url: "/api/session/{sessionID}/context",
16611
+ ...options,
16612
+ ...params
16613
+ });
16614
+ }
16615
+ history(parameters, options) {
16616
+ const params = buildClientParams([parameters], [
16617
+ {
16618
+ args: [
16619
+ { in: "path", key: "sessionID" },
16620
+ { in: "query", key: "limit" },
16621
+ { in: "query", key: "after" }
16622
+ ]
16623
+ }
16624
+ ]);
16625
+ return (options?.client ?? this.client).get({
16626
+ url: "/api/session/{sessionID}/history",
16627
+ ...options,
16628
+ ...params
16629
+ });
16630
+ }
16631
+ events(parameters, options) {
16632
+ const params = buildClientParams([parameters], [
16633
+ {
16634
+ args: [
16635
+ { in: "path", key: "sessionID" },
16636
+ { in: "query", key: "after" }
16637
+ ]
16638
+ }
16639
+ ]);
16640
+ return (options?.client ?? this.client).sse.get({
16641
+ url: "/api/session/{sessionID}/event",
16642
+ ...options,
16643
+ ...params
16644
+ });
16645
+ }
16646
+ interrupt(parameters, options) {
16647
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }]);
16648
+ return (options?.client ?? this.client).post({
16649
+ url: "/api/session/{sessionID}/interrupt",
16650
+ ...options,
16651
+ ...params
16652
+ });
16653
+ }
16654
+ message(parameters, options) {
16655
+ const params = buildClientParams([parameters], [
16656
+ {
16657
+ args: [
16658
+ { in: "path", key: "sessionID" },
16659
+ { in: "path", key: "messageID" }
16660
+ ]
16661
+ }
16662
+ ]);
16663
+ return (options?.client ?? this.client).get({
16664
+ url: "/api/session/{sessionID}/message/{messageID}",
16665
+ ...options,
16666
+ ...params
16667
+ });
16668
+ }
16669
+ messages(parameters, options) {
16670
+ const params = buildClientParams([parameters], [
16671
+ {
16672
+ args: [
16673
+ { in: "path", key: "sessionID" },
16674
+ { in: "query", key: "limit" },
16675
+ { in: "query", key: "order" },
16676
+ { in: "query", key: "cursor" }
16677
+ ]
16678
+ }
16679
+ ]);
16680
+ return (options?.client ?? this.client).get({
16681
+ url: "/api/session/{sessionID}/message",
16682
+ ...options,
16683
+ ...params
16684
+ });
16685
+ }
16686
+ _revert;
16687
+ get revert() {
16688
+ return this._revert ??= new Revert({ client: this.client });
16689
+ }
16690
+ _permission;
16691
+ get permission() {
16692
+ return this._permission ??= new Permission2({ client: this.client });
16693
+ }
16694
+ _question;
16695
+ get question() {
16696
+ return this._question ??= new Question2({ client: this.client });
16697
+ }
16698
+ }
16699
+
16700
+ class Model extends HeyApiClient {
16701
+ list(parameters, options) {
16702
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
16703
+ return (options?.client ?? this.client).get({
16704
+ url: "/api/model",
16705
+ ...options,
16706
+ ...params
16707
+ });
16708
+ }
16709
+ }
16710
+
16711
+ class Provider2 extends HeyApiClient {
16712
+ list(parameters, options) {
16713
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
16714
+ return (options?.client ?? this.client).get({
16715
+ url: "/api/provider",
16716
+ ...options,
16717
+ ...params
16718
+ });
16719
+ }
16720
+ get(parameters, options) {
16721
+ const params = buildClientParams([parameters], [
16722
+ {
16723
+ args: [
16724
+ { in: "path", key: "providerID" },
16725
+ { in: "query", key: "location" }
16726
+ ]
16727
+ }
16728
+ ]);
16729
+ return (options?.client ?? this.client).get({
16730
+ url: "/api/provider/{providerID}",
16731
+ ...options,
16732
+ ...params
16733
+ });
16157
16734
  }
16158
- openThemes(parameters, options) {
16735
+ }
16736
+
16737
+ class Connect extends HeyApiClient {
16738
+ key(parameters, options) {
16739
+ const params = buildClientParams([parameters], [
16740
+ {
16741
+ args: [
16742
+ { in: "path", key: "integrationID" },
16743
+ { in: "query", key: "location" },
16744
+ { in: "body", key: "key" },
16745
+ { in: "body", key: "label" }
16746
+ ]
16747
+ }
16748
+ ]);
16749
+ return (options?.client ?? this.client).post({
16750
+ url: "/api/integration/{integrationID}/connect/key",
16751
+ ...options,
16752
+ ...params,
16753
+ headers: {
16754
+ "Content-Type": "application/json",
16755
+ ...options?.headers,
16756
+ ...params.headers
16757
+ }
16758
+ });
16759
+ }
16760
+ oauth(parameters, options) {
16761
+ const params = buildClientParams([parameters], [
16762
+ {
16763
+ args: [
16764
+ { in: "path", key: "integrationID" },
16765
+ { in: "query", key: "location" },
16766
+ { in: "body", key: "methodID" },
16767
+ { in: "body", key: "inputs" },
16768
+ { in: "body", key: "label" }
16769
+ ]
16770
+ }
16771
+ ]);
16772
+ return (options?.client ?? this.client).post({
16773
+ url: "/api/integration/{integrationID}/connect/oauth",
16774
+ ...options,
16775
+ ...params,
16776
+ headers: {
16777
+ "Content-Type": "application/json",
16778
+ ...options?.headers,
16779
+ ...params.headers
16780
+ }
16781
+ });
16782
+ }
16783
+ }
16784
+
16785
+ class Attempt extends HeyApiClient {
16786
+ cancel(parameters, options) {
16787
+ const params = buildClientParams([parameters], [
16788
+ {
16789
+ args: [
16790
+ { in: "path", key: "attemptID" },
16791
+ { in: "query", key: "location" }
16792
+ ]
16793
+ }
16794
+ ]);
16795
+ return (options?.client ?? this.client).delete({
16796
+ url: "/api/integration/attempt/{attemptID}",
16797
+ ...options,
16798
+ ...params
16799
+ });
16800
+ }
16801
+ status(parameters, options) {
16802
+ const params = buildClientParams([parameters], [
16803
+ {
16804
+ args: [
16805
+ { in: "path", key: "attemptID" },
16806
+ { in: "query", key: "location" }
16807
+ ]
16808
+ }
16809
+ ]);
16810
+ return (options?.client ?? this.client).get({
16811
+ url: "/api/integration/attempt/{attemptID}",
16812
+ ...options,
16813
+ ...params
16814
+ });
16815
+ }
16816
+ complete(parameters, options) {
16817
+ const params = buildClientParams([parameters], [
16818
+ {
16819
+ args: [
16820
+ { in: "path", key: "attemptID" },
16821
+ { in: "query", key: "location" },
16822
+ { in: "body", key: "code" }
16823
+ ]
16824
+ }
16825
+ ]);
16826
+ return (options?.client ?? this.client).post({
16827
+ url: "/api/integration/attempt/{attemptID}/complete",
16828
+ ...options,
16829
+ ...params,
16830
+ headers: {
16831
+ "Content-Type": "application/json",
16832
+ ...options?.headers,
16833
+ ...params.headers
16834
+ }
16835
+ });
16836
+ }
16837
+ }
16838
+
16839
+ class Integration extends HeyApiClient {
16840
+ list(parameters, options) {
16841
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
16842
+ return (options?.client ?? this.client).get({
16843
+ url: "/api/integration",
16844
+ ...options,
16845
+ ...params
16846
+ });
16847
+ }
16848
+ get(parameters, options) {
16849
+ const params = buildClientParams([parameters], [
16850
+ {
16851
+ args: [
16852
+ { in: "path", key: "integrationID" },
16853
+ { in: "query", key: "location" }
16854
+ ]
16855
+ }
16856
+ ]);
16857
+ return (options?.client ?? this.client).get({
16858
+ url: "/api/integration/{integrationID}",
16859
+ ...options,
16860
+ ...params
16861
+ });
16862
+ }
16863
+ _connect;
16864
+ get connect() {
16865
+ return this._connect ??= new Connect({ client: this.client });
16866
+ }
16867
+ _attempt;
16868
+ get attempt() {
16869
+ return this._attempt ??= new Attempt({ client: this.client });
16870
+ }
16871
+ }
16872
+
16873
+ class Credential extends HeyApiClient {
16874
+ remove(parameters, options) {
16875
+ const params = buildClientParams([parameters], [
16876
+ {
16877
+ args: [
16878
+ { in: "path", key: "credentialID" },
16879
+ { in: "query", key: "location" }
16880
+ ]
16881
+ }
16882
+ ]);
16883
+ return (options?.client ?? this.client).delete({
16884
+ url: "/api/credential/{credentialID}",
16885
+ ...options,
16886
+ ...params
16887
+ });
16888
+ }
16889
+ update(parameters, options) {
16890
+ const params = buildClientParams([parameters], [
16891
+ {
16892
+ args: [
16893
+ { in: "path", key: "credentialID" },
16894
+ { in: "query", key: "location" },
16895
+ { in: "body", key: "label" }
16896
+ ]
16897
+ }
16898
+ ]);
16899
+ return (options?.client ?? this.client).patch({
16900
+ url: "/api/credential/{credentialID}",
16901
+ ...options,
16902
+ ...params,
16903
+ headers: {
16904
+ "Content-Type": "application/json",
16905
+ ...options?.headers,
16906
+ ...params.headers
16907
+ }
16908
+ });
16909
+ }
16910
+ }
16911
+
16912
+ class Request2 extends HeyApiClient {
16913
+ list(parameters, options) {
16914
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
16915
+ return (options?.client ?? this.client).get({
16916
+ url: "/api/permission/request",
16917
+ ...options,
16918
+ ...params
16919
+ });
16920
+ }
16921
+ }
16922
+
16923
+ class Saved extends HeyApiClient {
16924
+ list(parameters, options) {
16925
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "projectID" }] }]);
16926
+ return (options?.client ?? this.client).get({
16927
+ url: "/api/permission/saved",
16928
+ ...options,
16929
+ ...params
16930
+ });
16931
+ }
16932
+ remove(parameters, options) {
16933
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "id" }] }]);
16934
+ return (options?.client ?? this.client).delete({
16935
+ url: "/api/permission/saved/{id}",
16936
+ ...options,
16937
+ ...params
16938
+ });
16939
+ }
16940
+ }
16941
+
16942
+ class Permission3 extends HeyApiClient {
16943
+ _request;
16944
+ get request() {
16945
+ return this._request ??= new Request2({ client: this.client });
16946
+ }
16947
+ _saved;
16948
+ get saved() {
16949
+ return this._saved ??= new Saved({ client: this.client });
16950
+ }
16951
+ }
16952
+
16953
+ class Fs extends HeyApiClient {
16954
+ read(parameters, options) {
16955
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
16956
+ return (options?.client ?? this.client).get({
16957
+ url: "/api/fs/read/*",
16958
+ ...options,
16959
+ ...params
16960
+ });
16961
+ }
16962
+ list(parameters, options) {
16963
+ const params = buildClientParams([parameters], [
16964
+ {
16965
+ args: [
16966
+ { in: "query", key: "location" },
16967
+ { in: "query", key: "path" }
16968
+ ]
16969
+ }
16970
+ ]);
16971
+ return (options?.client ?? this.client).get({
16972
+ url: "/api/fs/list",
16973
+ ...options,
16974
+ ...params
16975
+ });
16976
+ }
16977
+ find(parameters, options) {
16978
+ const params = buildClientParams([parameters], [
16979
+ {
16980
+ args: [
16981
+ { in: "query", key: "location" },
16982
+ { in: "query", key: "query" },
16983
+ { in: "query", key: "type" },
16984
+ { in: "query", key: "limit" }
16985
+ ]
16986
+ }
16987
+ ]);
16988
+ return (options?.client ?? this.client).get({
16989
+ url: "/api/fs/find",
16990
+ ...options,
16991
+ ...params
16992
+ });
16993
+ }
16994
+ }
16995
+
16996
+ class Command2 extends HeyApiClient {
16997
+ list(parameters, options) {
16998
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
16999
+ return (options?.client ?? this.client).get({
17000
+ url: "/api/command",
17001
+ ...options,
17002
+ ...params
17003
+ });
17004
+ }
17005
+ }
17006
+
17007
+ class Skill extends HeyApiClient {
17008
+ list(parameters, options) {
17009
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
17010
+ return (options?.client ?? this.client).get({
17011
+ url: "/api/skill",
17012
+ ...options,
17013
+ ...params
17014
+ });
17015
+ }
17016
+ }
17017
+
17018
+ class Event2 extends HeyApiClient {
17019
+ subscribe(options) {
17020
+ return (options?.client ?? this.client).sse.get({
17021
+ url: "/api/event",
17022
+ ...options
17023
+ });
17024
+ }
17025
+ }
17026
+
17027
+ class Pty2 extends HeyApiClient {
17028
+ list(parameters, options) {
17029
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
17030
+ return (options?.client ?? this.client).get({
17031
+ url: "/api/pty",
17032
+ ...options,
17033
+ ...params
17034
+ });
17035
+ }
17036
+ create(parameters, options) {
17037
+ const params = buildClientParams([parameters], [
17038
+ {
17039
+ args: [
17040
+ { in: "query", key: "location" },
17041
+ { in: "body", key: "command" },
17042
+ { in: "body", key: "args" },
17043
+ { in: "body", key: "cwd" },
17044
+ { in: "body", key: "title" },
17045
+ { in: "body", key: "env" }
17046
+ ]
17047
+ }
17048
+ ]);
17049
+ return (options?.client ?? this.client).post({
17050
+ url: "/api/pty",
17051
+ ...options,
17052
+ ...params,
17053
+ headers: {
17054
+ "Content-Type": "application/json",
17055
+ ...options?.headers,
17056
+ ...params.headers
17057
+ }
17058
+ });
17059
+ }
17060
+ remove(parameters, options) {
16159
17061
  const params = buildClientParams([parameters], [
16160
17062
  {
16161
17063
  args: [
16162
- { in: "query", key: "directory" },
16163
- { in: "query", key: "workspace" }
17064
+ { in: "path", key: "ptyID" },
17065
+ { in: "query", key: "location" }
16164
17066
  ]
16165
17067
  }
16166
17068
  ]);
16167
- return (options?.client ?? this.client).post({
16168
- url: "/tui/open-themes",
17069
+ return (options?.client ?? this.client).delete({
17070
+ url: "/api/pty/{ptyID}",
16169
17071
  ...options,
16170
17072
  ...params
16171
17073
  });
16172
17074
  }
16173
- openModels(parameters, options) {
17075
+ get(parameters, options) {
16174
17076
  const params = buildClientParams([parameters], [
16175
17077
  {
16176
17078
  args: [
16177
- { in: "query", key: "directory" },
16178
- { in: "query", key: "workspace" }
17079
+ { in: "path", key: "ptyID" },
17080
+ { in: "query", key: "location" }
16179
17081
  ]
16180
17082
  }
16181
17083
  ]);
16182
- return (options?.client ?? this.client).post({
16183
- url: "/tui/open-models",
17084
+ return (options?.client ?? this.client).get({
17085
+ url: "/api/pty/{ptyID}",
16184
17086
  ...options,
16185
17087
  ...params
16186
17088
  });
16187
17089
  }
16188
- submitPrompt(parameters, options) {
17090
+ update(parameters, options) {
16189
17091
  const params = buildClientParams([parameters], [
16190
17092
  {
16191
17093
  args: [
16192
- { in: "query", key: "directory" },
16193
- { in: "query", key: "workspace" }
17094
+ { in: "path", key: "ptyID" },
17095
+ { in: "query", key: "location" },
17096
+ { in: "body", key: "title" },
17097
+ { in: "body", key: "size" }
16194
17098
  ]
16195
17099
  }
16196
17100
  ]);
16197
- return (options?.client ?? this.client).post({
16198
- url: "/tui/submit-prompt",
17101
+ return (options?.client ?? this.client).put({
17102
+ url: "/api/pty/{ptyID}",
16199
17103
  ...options,
16200
- ...params
17104
+ ...params,
17105
+ headers: {
17106
+ "Content-Type": "application/json",
17107
+ ...options?.headers,
17108
+ ...params.headers
17109
+ }
16201
17110
  });
16202
17111
  }
16203
- clearPrompt(parameters, options) {
17112
+ connectToken(parameters, options) {
16204
17113
  const params = buildClientParams([parameters], [
16205
17114
  {
16206
17115
  args: [
16207
- { in: "query", key: "directory" },
16208
- { in: "query", key: "workspace" }
17116
+ { in: "path", key: "ptyID" },
17117
+ { in: "query", key: "location" }
16209
17118
  ]
16210
17119
  }
16211
17120
  ]);
16212
17121
  return (options?.client ?? this.client).post({
16213
- url: "/tui/clear-prompt",
17122
+ url: "/api/pty/{ptyID}/connect-token",
16214
17123
  ...options,
16215
17124
  ...params
16216
17125
  });
16217
17126
  }
16218
- executeCommand(parameters, options) {
17127
+ connect(parameters, options) {
16219
17128
  const params = buildClientParams([parameters], [
16220
17129
  {
16221
17130
  args: [
16222
- { in: "query", key: "directory" },
16223
- { in: "query", key: "workspace" },
16224
- { in: "body", key: "command" }
17131
+ { in: "path", key: "ptyID" },
17132
+ { in: "query", key: "location[directory]" },
17133
+ { in: "query", key: "location[workspace]" },
17134
+ { in: "query", key: "cursor" },
17135
+ { in: "query", key: "ticket" }
16225
17136
  ]
16226
17137
  }
16227
17138
  ]);
16228
- return (options?.client ?? this.client).post({
16229
- url: "/tui/execute-command",
17139
+ return (options?.client ?? this.client).get({
17140
+ url: "/api/pty/{ptyID}/connect",
16230
17141
  ...options,
16231
- ...params,
16232
- headers: {
16233
- "Content-Type": "application/json",
16234
- ...options?.headers,
16235
- ...params.headers
16236
- }
17142
+ ...params
16237
17143
  });
16238
17144
  }
16239
- showToast(parameters, options) {
17145
+ }
17146
+
17147
+ class Request22 extends HeyApiClient {
17148
+ list(parameters, options) {
17149
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
17150
+ return (options?.client ?? this.client).get({
17151
+ url: "/api/question/request",
17152
+ ...options,
17153
+ ...params
17154
+ });
17155
+ }
17156
+ }
17157
+
17158
+ class Question3 extends HeyApiClient {
17159
+ _request;
17160
+ get request() {
17161
+ return this._request ??= new Request22({ client: this.client });
17162
+ }
17163
+ }
17164
+
17165
+ class Reference extends HeyApiClient {
17166
+ list(parameters, options) {
17167
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
17168
+ return (options?.client ?? this.client).get({
17169
+ url: "/api/reference",
17170
+ ...options,
17171
+ ...params
17172
+ });
17173
+ }
17174
+ }
17175
+
17176
+ class ProjectCopy2 extends HeyApiClient {
17177
+ remove(parameters, options) {
16240
17178
  const params = buildClientParams([parameters], [
16241
17179
  {
16242
17180
  args: [
16243
- { in: "query", key: "directory" },
16244
- { in: "query", key: "workspace" },
16245
- { in: "body", key: "title" },
16246
- { in: "body", key: "message" },
16247
- { in: "body", key: "variant" },
16248
- { in: "body", key: "duration" }
17181
+ { in: "path", key: "projectID" },
17182
+ { in: "query", key: "location" },
17183
+ { in: "body", key: "directory" },
17184
+ { in: "body", key: "force" }
16249
17185
  ]
16250
17186
  }
16251
17187
  ]);
16252
- return (options?.client ?? this.client).post({
16253
- url: "/tui/show-toast",
17188
+ return (options?.client ?? this.client).delete({
17189
+ url: "/experimental/project/{projectID}/copy",
16254
17190
  ...options,
16255
17191
  ...params,
16256
17192
  headers: {
@@ -16260,18 +17196,20 @@ class Tui extends HeyApiClient {
16260
17196
  }
16261
17197
  });
16262
17198
  }
16263
- publish(parameters, options) {
17199
+ create(parameters, options) {
16264
17200
  const params = buildClientParams([parameters], [
16265
17201
  {
16266
17202
  args: [
16267
- { in: "query", key: "directory" },
16268
- { in: "query", key: "workspace" },
16269
- { key: "body", map: "body" }
17203
+ { in: "path", key: "projectID" },
17204
+ { in: "query", key: "location" },
17205
+ { in: "body", key: "strategy" },
17206
+ { in: "body", key: "directory" },
17207
+ { in: "body", key: "name" }
16270
17208
  ]
16271
17209
  }
16272
17210
  ]);
16273
17211
  return (options?.client ?? this.client).post({
16274
- url: "/tui/publish",
17212
+ url: "/experimental/project/{projectID}/copy",
16275
17213
  ...options,
16276
17214
  ...params,
16277
17215
  headers: {
@@ -16281,30 +17219,91 @@ class Tui extends HeyApiClient {
16281
17219
  }
16282
17220
  });
16283
17221
  }
16284
- selectSession(parameters, options) {
17222
+ refresh(parameters, options) {
16285
17223
  const params = buildClientParams([parameters], [
16286
17224
  {
16287
17225
  args: [
16288
- { in: "query", key: "directory" },
16289
- { in: "query", key: "workspace" },
16290
- { in: "body", key: "sessionID" }
17226
+ { in: "path", key: "projectID" },
17227
+ { in: "query", key: "location" }
16291
17228
  ]
16292
17229
  }
16293
17230
  ]);
16294
17231
  return (options?.client ?? this.client).post({
16295
- url: "/tui/select-session",
17232
+ url: "/experimental/project/{projectID}/copy/refresh",
16296
17233
  ...options,
16297
- ...params,
16298
- headers: {
16299
- "Content-Type": "application/json",
16300
- ...options?.headers,
16301
- ...params.headers
16302
- }
17234
+ ...params
16303
17235
  });
16304
17236
  }
16305
- _control;
16306
- get control() {
16307
- return this._control ??= new Control({ client: this.client });
17237
+ }
17238
+
17239
+ class V2 extends HeyApiClient {
17240
+ _health;
17241
+ get health() {
17242
+ return this._health ??= new Health({ client: this.client });
17243
+ }
17244
+ _location;
17245
+ get location() {
17246
+ return this._location ??= new Location({ client: this.client });
17247
+ }
17248
+ _agent;
17249
+ get agent() {
17250
+ return this._agent ??= new Agent({ client: this.client });
17251
+ }
17252
+ _session;
17253
+ get session() {
17254
+ return this._session ??= new Session3({ client: this.client });
17255
+ }
17256
+ _model;
17257
+ get model() {
17258
+ return this._model ??= new Model({ client: this.client });
17259
+ }
17260
+ _provider;
17261
+ get provider() {
17262
+ return this._provider ??= new Provider2({ client: this.client });
17263
+ }
17264
+ _integration;
17265
+ get integration() {
17266
+ return this._integration ??= new Integration({ client: this.client });
17267
+ }
17268
+ _credential;
17269
+ get credential() {
17270
+ return this._credential ??= new Credential({ client: this.client });
17271
+ }
17272
+ _permission;
17273
+ get permission() {
17274
+ return this._permission ??= new Permission3({ client: this.client });
17275
+ }
17276
+ _fs;
17277
+ get fs() {
17278
+ return this._fs ??= new Fs({ client: this.client });
17279
+ }
17280
+ _command;
17281
+ get command() {
17282
+ return this._command ??= new Command2({ client: this.client });
17283
+ }
17284
+ _skill;
17285
+ get skill() {
17286
+ return this._skill ??= new Skill({ client: this.client });
17287
+ }
17288
+ _event;
17289
+ get event() {
17290
+ return this._event ??= new Event2({ client: this.client });
17291
+ }
17292
+ _pty;
17293
+ get pty() {
17294
+ return this._pty ??= new Pty2({ client: this.client });
17295
+ }
17296
+ _question;
17297
+ get question() {
17298
+ return this._question ??= new Question3({ client: this.client });
17299
+ }
17300
+ _reference;
17301
+ get reference() {
17302
+ return this._reference ??= new Reference({ client: this.client });
17303
+ }
17304
+ _projectCopy;
17305
+ get projectCopy() {
17306
+ return this._projectCopy ??= new ProjectCopy2({ client: this.client });
16308
17307
  }
16309
17308
  }
16310
17309
 
@@ -16322,6 +17321,10 @@ class OpencodeClient extends HeyApiClient {
16322
17321
  get app() {
16323
17322
  return this._app ??= new App({ client: this.client });
16324
17323
  }
17324
+ _experimental;
17325
+ get experimental() {
17326
+ return this._experimental ??= new Experimental({ client: this.client });
17327
+ }
16325
17328
  _global;
16326
17329
  get global() {
16327
17330
  return this._global ??= new Global({ client: this.client });
@@ -16334,10 +17337,6 @@ class OpencodeClient extends HeyApiClient {
16334
17337
  get config() {
16335
17338
  return this._config ??= new Config2({ client: this.client });
16336
17339
  }
16337
- _experimental;
16338
- get experimental() {
16339
- return this._experimental ??= new Experimental({ client: this.client });
16340
- }
16341
17340
  _tool;
16342
17341
  get tool() {
16343
17342
  return this._tool ??= new Tool({ client: this.client });
@@ -16414,14 +17413,14 @@ class OpencodeClient extends HeyApiClient {
16414
17413
  get sync() {
16415
17414
  return this._sync ??= new Sync({ client: this.client });
16416
17415
  }
16417
- _v2;
16418
- get v2() {
16419
- return this._v2 ??= new V2({ client: this.client });
16420
- }
16421
17416
  _tui;
16422
17417
  get tui() {
16423
17418
  return this._tui ??= new Tui({ client: this.client });
16424
17419
  }
17420
+ _v2;
17421
+ get v2() {
17422
+ return this._v2 ??= new V2({ client: this.client });
17423
+ }
16425
17424
  }
16426
17425
  // node_modules/@opencode-ai/sdk/dist/v2/server.js
16427
17426
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
@@ -16714,7 +17713,9 @@ function wrapThrowingClient(raw) {
16714
17713
  create: throwing(r.session.create.bind(r.session)),
16715
17714
  promptAsync: throwing(r.session.promptAsync.bind(r.session)),
16716
17715
  abort: throwing(r.session.abort.bind(r.session)),
16717
- status: throwing(r.session.status.bind(r.session))
17716
+ status: throwing(r.session.status.bind(r.session)),
17717
+ messages: throwing(r.session.messages.bind(r.session)),
17718
+ get: throwing(r.session.get.bind(r.session))
16718
17719
  },
16719
17720
  tui: {
16720
17721
  showToast: throwing(r.tui.showToast.bind(r.tui)),
@@ -17626,6 +18627,72 @@ class ProgressTracker {
17626
18627
  }
17627
18628
  }
17628
18629
 
18630
+ // src/activity.ts
18631
+ class ActivityBuffer {
18632
+ buffers = new Map;
18633
+ maxPerSession;
18634
+ constructor(options) {
18635
+ this.maxPerSession = options?.maxPerSession ?? 100;
18636
+ }
18637
+ record(sessionID, entry) {
18638
+ const entries = this.buffers.get(sessionID) ?? [];
18639
+ entries.push(entry);
18640
+ if (entries.length > this.maxPerSession) {
18641
+ entries.splice(0, entries.length - this.maxPerSession);
18642
+ }
18643
+ this.buffers.set(sessionID, entries);
18644
+ }
18645
+ getActivity(sessionID, limit) {
18646
+ const entries = this.buffers.get(sessionID);
18647
+ if (!entries)
18648
+ return [];
18649
+ if (limit !== undefined)
18650
+ return entries.slice(-limit);
18651
+ return [...entries];
18652
+ }
18653
+ remove(sessionID) {
18654
+ this.buffers.delete(sessionID);
18655
+ }
18656
+ has(sessionID) {
18657
+ const entries = this.buffers.get(sessionID);
18658
+ return entries !== undefined && entries.length > 0;
18659
+ }
18660
+ }
18661
+ function recordFromV2Event(event, registry2, buffer) {
18662
+ const props = event.properties;
18663
+ if (!props?.sessionID || !registry2.getBySession(props.sessionID))
18664
+ return;
18665
+ if (event.type === "session.next.shell.started") {
18666
+ buffer.record(props.sessionID, { type: "shell_command", command: props.command, timestamp: Date.now() });
18667
+ } else if (event.type === "session.next.shell.ended") {
18668
+ buffer.record(props.sessionID, { type: "shell_command", exitCode: props.exitCode, timestamp: Date.now() });
18669
+ } else if (event.type === "session.next.step.ended") {
18670
+ buffer.record(props.sessionID, {
18671
+ type: "step",
18672
+ cost: props.cost,
18673
+ tokensIn: props.tokens?.input,
18674
+ tokensOut: props.tokens?.output,
18675
+ timestamp: Date.now()
18676
+ });
18677
+ }
18678
+ }
18679
+ function recordFromToolBefore(input, registry2, buffer) {
18680
+ if (!registry2.getBySession(input.sessionID))
18681
+ return;
18682
+ buffer.record(input.sessionID, { type: "tool_call", tool: input.tool, timestamp: Date.now() });
18683
+ }
18684
+ function recordFromToolAfter(input, output, registry2, buffer) {
18685
+ if (!registry2.getBySession(input.sessionID))
18686
+ return;
18687
+ buffer.record(input.sessionID, {
18688
+ type: "tool_result",
18689
+ tool: input.tool,
18690
+ title: output.title,
18691
+ output: output.output,
18692
+ timestamp: Date.now()
18693
+ });
18694
+ }
18695
+
17629
18696
  // src/dashboard.ts
17630
18697
  import { createServer } from "node:http";
17631
18698
 
@@ -17726,6 +18793,7 @@ select{-webkit-appearance:none;appearance:none;background-image:url("data:image/
17726
18793
  <div><kbd class="px-1.5 py-0.5 bg-base-800 rounded font-mono text-txt-300 text-[11px]">k</kbd> <span class="text-txt-400">Prev agent</span></div>
17727
18794
  <div><kbd class="px-1.5 py-0.5 bg-base-800 rounded font-mono text-txt-300 text-[11px]">Enter</kbd> <span class="text-txt-400">Expand agent</span></div>
17728
18795
  <div><kbd class="px-1.5 py-0.5 bg-base-800 rounded font-mono text-txt-300 text-[11px]">Esc</kbd> <span class="text-txt-400">Collapse all</span></div>
18796
+ <div><kbd class="px-1.5 py-0.5 bg-base-800 rounded font-mono text-txt-300 text-[11px]">v</kbd> <span class="text-txt-400">Toggle verbose</span></div>
17729
18797
  <div><kbd class="px-1.5 py-0.5 bg-base-800 rounded font-mono text-txt-300 text-[11px]">1-9</kbd> <span class="text-txt-400">Switch team</span></div>
17730
18798
  <div><kbd class="px-1.5 py-0.5 bg-base-800 rounded font-mono text-txt-300 text-[11px]">?</kbd> <span class="text-txt-400">This help</span></div>
17731
18799
  </div>
@@ -17736,7 +18804,7 @@ select{-webkit-appearance:none;appearance:none;background-image:url("data:image/
17736
18804
 
17737
18805
  // src/dashboard-js-core.ts
17738
18806
  var DASHBOARD_JS_CORE = `
17739
- let S=null,selId=null,selProjectId=null,fails=0,pollT=Date.now(),prevMC=0,selCard=-1,navCollapsed=false;
18807
+ let S=null,selId=null,selProjectId=null,fails=0,pollT=Date.now(),prevMC=0,selCard=-1,navCollapsed=false,verbose=(function(){try{return localStorage.getItem('ensemble-verbose')==='1'}catch(e){return false}})(),drawerActivity=null,drawerSession=null;
17740
18808
  const expCards=new Set(),expMsgs=new Set();
17741
18809
  const E=s=>s?String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;'):'';
17742
18810
  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'};
@@ -17878,6 +18946,31 @@ function deriveThreads(msgs){
17878
18946
  var DASHBOARD_JS_EVENTS = `
17879
18947
  function toggleMsg(id){if(expMsgs.has(id))expMsgs.delete(id);else expMsgs.add(id);render()}
17880
18948
 
18949
+ function toggleVerbose(){
18950
+ verbose=!verbose;
18951
+ try{localStorage.setItem('ensemble-verbose',verbose?'1':'0')}catch(e){}
18952
+ var btn=document.getElementById('verbose-toggle');
18953
+ if(btn){
18954
+ btn.textContent='verbose: '+(verbose?'on':'off');
18955
+ btn.setAttribute('aria-pressed',verbose?'true':'false');
18956
+ btn.className='text-[10px] '+(verbose?'text-blue-400 border-blue-500/40 bg-blue-500/10':'text-txt-500 hover:text-txt-200 border-base-800')+' rounded px-1.5 py-[2px] transition-colors';
18957
+ }
18958
+ rDrawerActivityUpdate();
18959
+ }
18960
+
18961
+ var fetchActivityGen=0;
18962
+ async function fetchActivity(sessionId){
18963
+ var gen=++fetchActivityGen;
18964
+ try{
18965
+ var res=await fetch('api/session/'+encodeURIComponent(sessionId)+'/activity');
18966
+ var data=await res.json();
18967
+ if(gen!==fetchActivityGen)return;
18968
+ drawerActivity=data.activity||[];
18969
+ drawerSession=data.session||null;
18970
+ rDrawerActivityUpdate();
18971
+ }catch{if(gen!==fetchActivityGen)return;drawerActivity=[];drawerSession=null;rDrawerActivityUpdate()}
18972
+ }
18973
+
17881
18974
  function applyNavCollapse(){
17882
18975
  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
18976
  content.classList.toggle('nav-collapsed',navCollapsed);
@@ -17972,6 +19065,7 @@ document.addEventListener('keydown',function(e){
17972
19065
  if(e.key==='Escape'){closeDrawer();expMsgs.clear();selCard=-1;closeShortcuts();render();return}
17973
19066
  if(e.key==='j'&&mm.length){e.preventDefault();selCard=Math.min(selCard+1,mm.length-1);render();return}
17974
19067
  if(e.key==='k'&&mm.length){e.preventDefault();selCard=Math.max(selCard-1,0);render();return}
19068
+ if(e.key==='v'&&!e.ctrlKey&&!e.metaKey&&!e.altKey){e.preventDefault();toggleVerbose();return}
17975
19069
  if(e.key==='Enter'&&selCard>=0&&selCard<mm.length){e.preventDefault();openDrawer(mm[selCard].name);return}
17976
19070
  if(e.key>='1'&&e.key<='9'){
17977
19071
  var teams=allTeams(),all=[...teams.active,...teams.archived];
@@ -18139,6 +19233,14 @@ function openDrawer(name){
18139
19233
  h+='</div></div>';
18140
19234
  });
18141
19235
  }
19236
+ // Activity timeline
19237
+ h+='<div class="mt-4 pt-4 border-t border-base-800/50">';
19238
+ h+='<div class="flex items-center justify-between mb-3">';
19239
+ h+='<span class="text-txt-400 text-[10px] uppercase tracking-wider">Activity</span>';
19240
+ h+='<button type="button" id="verbose-toggle" onclick="toggleVerbose()" aria-pressed="'+(verbose?'true':'false')+'" class="text-[10px] '+(verbose?'text-blue-400 border-blue-500/40 bg-blue-500/10':'text-txt-500 hover:text-txt-200 border-base-800')+' rounded px-1.5 py-[2px] transition-colors">verbose: '+(verbose?'on':'off')+'</button>';
19241
+ h+='</div>';
19242
+ h+='<div id="drawer-activity-list"><div class="text-txt-500 text-[12px]">Loading activity...</div></div>';
19243
+ h+='</div>';
18142
19244
  var drawer=document.getElementById('drawer');
18143
19245
  drawer.innerHTML=h;
18144
19246
  drawer.classList.add('open');
@@ -18147,6 +19249,92 @@ function openDrawer(name){
18147
19249
  setBackgroundInert(true);
18148
19250
  drawer.focus();
18149
19251
  document.getElementById('drawer-bg').classList.add('open');
19252
+ // Fetch activity for this agent's session
19253
+ drawerActivity=null;drawerSession=null;
19254
+ if(m.sessionId)fetchActivity(m.sessionId);
19255
+ else rDrawerActivityUpdate();
19256
+ }
19257
+
19258
+ function rDrawerActivityUpdate(){
19259
+ var el=document.getElementById('drawer-activity-list');
19260
+ if(!el)return;
19261
+ if(!drawerActivity||!drawerActivity.length){
19262
+ el.innerHTML='<div class="text-txt-500 text-[12px]">No activity recorded</div>';
19263
+ return;
19264
+ }
19265
+ var html=drawerActivity.map(function(a){
19266
+ var icon='\\u25CF',color='text-txt-500',label=a.type;
19267
+ if(a.type==='tool_call'){icon='\\u25B8';color='text-blue-400';label=a.tool||'tool'}
19268
+ if(a.type==='tool_result'){icon='\\u25B8';color=a.error?'text-red-400':'text-emerald-400';label=a.tool||'tool'}
19269
+ if(a.type==='shell_command'){icon='$';color='text-amber-400';label='shell'}
19270
+ if(a.type==='step'){icon='\\u2261';color='text-violet-400';label='step'}
19271
+ if(a.type==='reasoning'){icon='\\u2726';color='text-violet-400';label='reasoning'}
19272
+ if(a.type==='file'){icon='\\u25A3';color='text-cyan-400';label=a.filePath?a.filePath.split('/').pop():'file'}
19273
+ if(a.type==='text'){icon='\\u00BB';color=a.role==='user'?'text-emerald-400':'text-blue-400';label=a.role==='user'?'prompt':'response'}
19274
+ var ts=relT(a.timestamp);
19275
+ if(!verbose){
19276
+ return '<div class="flex items-center gap-2 py-1 border-b border-base-800/30">'+
19277
+ '<span class="'+color+' text-[11px] shrink-0 font-mono">'+icon+'</span>'+
19278
+ '<span class="text-[12px] text-txt-400 truncate flex-1">'+E(label)+'</span>'+
19279
+ '<span class="text-[10px] text-txt-500 shrink-0">'+ts+'</span>'+
19280
+ '</div>';
19281
+ }
19282
+ if(a.type==='reasoning'){
19283
+ return '<details open class="py-2 border-b border-base-800/30">'+
19284
+ '<summary class="flex items-center gap-2 cursor-pointer select-none hover:text-txt-100 transition-colors">'+
19285
+ '<span class="'+color+' text-[11px] shrink-0 font-mono">'+icon+'</span>'+
19286
+ '<span class="text-[12px] text-violet-300 font-medium">Reasoning</span>'+
19287
+ '<span class="text-[10px] text-txt-500 ml-auto shrink-0">'+ts+'</span>'+
19288
+ '</summary>'+
19289
+ '<div class="mt-1.5 ml-5 text-[11px] text-violet-200/60 bg-violet-950/20 rounded-md p-2 border border-violet-800/30 overflow-x-auto whitespace-pre-wrap font-mono max-h-[200px] overflow-y-auto">'+E(a.reasoning||'')+'</div>'+
19290
+ '</details>';
19291
+ }
19292
+ if(a.type==='file'){
19293
+ var fname=a.filePath?a.filePath.split('/').pop():'file';
19294
+ var fcontent=a.fileDiff||a.fileContent||'';
19295
+ return '<details open class="py-2 border-b border-base-800/30">'+
19296
+ '<summary class="flex items-center gap-2 cursor-pointer select-none hover:text-txt-100 transition-colors">'+
19297
+ '<span class="'+color+' text-[11px] shrink-0 font-mono">'+icon+'</span>'+
19298
+ '<span class="text-[12px] text-cyan-300 font-medium truncate flex-1">'+E(a.filePath||fname)+'</span>'+
19299
+ '<span class="text-[10px] text-txt-500 shrink-0">'+ts+'</span>'+
19300
+ '</summary>'+
19301
+ (fcontent?'<div class="mt-1.5 ml-5 text-[11px] text-cyan-200/70 bg-cyan-950/20 rounded-md p-2 border border-cyan-800/30 overflow-x-auto whitespace-pre font-mono max-h-[300px] overflow-y-auto">'+E(fcontent)+'</div>':'')+
19302
+ '</details>';
19303
+ }
19304
+ if(a.type==='text'){
19305
+ return '<div class="py-2 border-b border-base-800/30">'+
19306
+ '<div class="flex items-start gap-2">'+
19307
+ '<span class="'+color+' text-[11px] mt-[1px] shrink-0 font-mono">'+icon+'</span>'+
19308
+ '<div class="flex-1 min-w-0">'+
19309
+ '<div class="text-[12px] '+(a.role==='user'?'text-emerald-300':'text-blue-300')+' font-medium">'+E(label)+'</div>'+
19310
+ '<div class="text-[11px] text-txt-300 mt-1 md">'+md(a.text||'')+'</div>'+
19311
+ '</div>'+
19312
+ '<span class="text-[10px] text-txt-500 shrink-0">'+ts+'</span>'+
19313
+ '</div></div>';
19314
+ }
19315
+ var title=a.title||a.tool||a.command||label;
19316
+ var row='<div class="py-2 border-b border-base-800/30">';
19317
+ row+='<div class="flex items-start gap-2">';
19318
+ row+='<span class="'+color+' text-[11px] mt-[1px] shrink-0 font-mono">'+icon+'</span>';
19319
+ row+='<div class="flex-1 min-w-0">';
19320
+ row+='<div class="text-[12px] text-txt-200 font-medium">'+E(title)+'</div>';
19321
+ if(a.input){row+='<div class="text-[11px] text-txt-300 mt-1.5 bg-base-900/60 rounded-md p-2 border border-base-700/40 overflow-x-auto font-mono whitespace-pre max-h-[200px] overflow-y-auto">'+E(a.input)+'</div>'}
19322
+ if(a.output){row+='<div class="text-[11px] text-emerald-300/80 mt-1.5 bg-emerald-950/20 rounded-md p-2 border border-emerald-800/30 overflow-x-auto whitespace-pre max-h-[200px] overflow-y-auto">'+E(a.output)+'</div>'}
19323
+ if(a.error){row+='<div class="text-[11px] text-red-400 mt-1.5 bg-red-950/20 rounded-md p-2 border border-red-800/30 overflow-x-auto">'+E(a.error)+'</div>'}
19324
+ if(a.command){row+='<div class="text-[11px] text-amber-300 mt-1.5 bg-amber-950/20 rounded-md p-2 border border-amber-800/30 overflow-x-auto font-mono whitespace-pre">'+E(a.command)+'</div>'}
19325
+ if(a.exitCode!==undefined||a.cost||a.tokensIn||a.tokensOut){
19326
+ row+='<div class="flex flex-wrap gap-1.5 mt-1.5">';
19327
+ if(a.exitCode!==undefined){row+=chip('exit: '+a.exitCode,'muted')}
19328
+ if(a.cost){row+=chip('$'+a.cost.toFixed(4),'gray')}
19329
+ if(a.tokensIn||a.tokensOut){row+=chip((a.tokensIn||0)+' in / '+(a.tokensOut||0)+' out','muted')}
19330
+ row+='</div>';
19331
+ }
19332
+ row+='</div>';
19333
+ row+='<span class="text-[10px] text-txt-500 shrink-0">'+ts+'</span>';
19334
+ row+='</div></div>';
19335
+ return row;
19336
+ }).join('');
19337
+ el.innerHTML=html;
18150
19338
  }
18151
19339
 
18152
19340
  function closeDrawer(){
@@ -18273,7 +19461,7 @@ function parseDependsOn(value) {
18273
19461
  function buildState(db) {
18274
19462
  const projects = db.query("SELECT id, name, path, status, time_created, time_updated FROM project ORDER BY time_updated DESC").all();
18275
19463
  const teams = db.query("SELECT id, name, project_id, status, lead_agent, time_created, time_updated FROM team ORDER BY time_created DESC").all();
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 = ?");
19464
+ const memberStmt = db.query("SELECT name, agent, status, execution_status, session_id, worktree_branch, prompt, model, plan_approval, time_created, time_updated FROM team_member WHERE team_id = ?");
18277
19465
  const taskStmt = db.query("SELECT id, content, status, priority, assignee, depends_on, time_created, time_updated FROM team_task WHERE team_id = ?");
18278
19466
  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");
18279
19467
  const mappedTeams = teams.map((t) => {
@@ -18282,6 +19470,7 @@ function buildState(db) {
18282
19470
  agent: m.agent,
18283
19471
  status: m.status,
18284
19472
  executionStatus: m.execution_status,
19473
+ sessionId: m.session_id,
18285
19474
  worktreeBranch: m.worktree_branch,
18286
19475
  prompt: m.prompt,
18287
19476
  model: m.model,
@@ -18354,7 +19543,71 @@ function sendJson(res, data) {
18354
19543
  });
18355
19544
  res.end(JSON.stringify(data));
18356
19545
  }
18357
- function handleDashboardRequest(db, port, req, res) {
19546
+ function parseMessageParts(parts, msgInfo) {
19547
+ const entries = [];
19548
+ const info = msgInfo ?? {};
19549
+ const timestamp = info.time ? new Date(info.time).getTime() : Date.now();
19550
+ for (const part of parts) {
19551
+ if (typeof part !== "object" || part === null)
19552
+ continue;
19553
+ const p = part;
19554
+ if (p.type === "tool" && p.tool) {
19555
+ const state = p.state ?? {};
19556
+ const inputStr = typeof state.input === "string" ? state.input : state.input != null ? JSON.stringify(state.input, null, 2) : undefined;
19557
+ const outputStr = typeof state.output === "string" ? state.output : state.output != null ? JSON.stringify(state.output, null, 2) : undefined;
19558
+ entries.push({
19559
+ type: state.status === "completed" ? "tool_result" : "tool_call",
19560
+ tool: p.tool,
19561
+ title: state.title,
19562
+ input: inputStr,
19563
+ output: outputStr,
19564
+ error: state.error,
19565
+ timestamp
19566
+ });
19567
+ } else if (p.type === "reasoning" && p.text) {
19568
+ entries.push({ type: "reasoning", reasoning: p.text, timestamp });
19569
+ } else if (p.type === "file" && (p.path || p.content || p.diff)) {
19570
+ entries.push({
19571
+ type: "file",
19572
+ filePath: p.path,
19573
+ fileContent: p.content,
19574
+ fileDiff: p.diff,
19575
+ timestamp
19576
+ });
19577
+ } else if (p.type === "text" && p.text) {
19578
+ entries.push({ type: "text", text: p.text, role: info.role, timestamp });
19579
+ } else if (p.type === "step-start") {
19580
+ entries.push({ type: "step", title: p.label ?? p.step ?? "step", timestamp });
19581
+ } else if (p.type === "step-finish") {
19582
+ entries.push({ type: "step", title: p.label ?? p.step ?? "step complete", timestamp });
19583
+ }
19584
+ }
19585
+ return entries;
19586
+ }
19587
+ async function handleActivityRoute(sessionId, options, res) {
19588
+ const buffer = options?.activityBuffer;
19589
+ const client3 = options?.client;
19590
+ const buffered = buffer?.getActivity(sessionId) ?? [];
19591
+ let sessionData = null;
19592
+ let fallbackActivity = [];
19593
+ if (client3) {
19594
+ try {
19595
+ const [msgResult, getResult] = await Promise.all([
19596
+ client3.session.messages({ sessionID: sessionId, limit: 100 }),
19597
+ client3.session.get({ sessionID: sessionId })
19598
+ ]);
19599
+ const messages = msgResult.data ?? [];
19600
+ for (const msg of messages) {
19601
+ const parts = msg.parts ?? [];
19602
+ fallbackActivity.push(...parseMessageParts(parts, msg.info));
19603
+ }
19604
+ sessionData = getResult.data ?? null;
19605
+ } catch {}
19606
+ }
19607
+ const combined = [...buffered, ...fallbackActivity].sort((a, b) => a.timestamp - b.timestamp);
19608
+ sendJson(res, { activity: combined, session: sessionData });
19609
+ }
19610
+ function handleDashboardRequest(db, port, req, res, options) {
18358
19611
  const url2 = new URL(req.url ?? "/", `http://${req.headers.host ?? `localhost:${port}`}`);
18359
19612
  if (url2.pathname === "/api/health") {
18360
19613
  sendJson(res, { ensemble: true, pid: process.pid });
@@ -18364,6 +19617,17 @@ function handleDashboardRequest(db, port, req, res) {
18364
19617
  sendJson(res, buildState(db));
18365
19618
  return;
18366
19619
  }
19620
+ const activityMatch = url2.pathname.match(/^\/api\/session\/([^/]+)\/activity$/);
19621
+ if (activityMatch) {
19622
+ const sessionId = decodeURIComponent(activityMatch[1]);
19623
+ handleActivityRoute(sessionId, options, res).catch(() => {
19624
+ if (!res.headersSent) {
19625
+ res.writeHead(500, { "Content-Type": "application/json" });
19626
+ res.end(JSON.stringify({ error: "Failed to fetch activity" }));
19627
+ }
19628
+ });
19629
+ return;
19630
+ }
18367
19631
  if (url2.pathname === "/") {
18368
19632
  res.writeHead(200, { "Content-Type": "text/html" });
18369
19633
  res.end(DASHBOARD_HTML);
@@ -18384,9 +19648,9 @@ function toDashboardServer(server2) {
18384
19648
  }
18385
19649
  };
18386
19650
  }
18387
- async function startDashboard(db, port) {
19651
+ async function startDashboard(db, port, options) {
18388
19652
  return new Promise((resolve) => {
18389
- const server2 = createServer((req, res) => handleDashboardRequest(db, port, req, res));
19653
+ const server2 = createServer((req, res) => handleDashboardRequest(db, port, req, res, options));
18390
19654
  server2.once("error", async (err) => {
18391
19655
  if (err.code === "EADDRINUSE") {
18392
19656
  try {
@@ -18509,6 +19773,30 @@ function requireCanPurgeArchivedTeams(deps, sessionId) {
18509
19773
  }
18510
19774
  }
18511
19775
 
19776
+ // src/tools/team-claim.ts
19777
+ function claimTask(db, teamId, taskId, assignee) {
19778
+ const task = db.query("SELECT content, status, assignee FROM team_task WHERE id = ? AND team_id = ?").get(taskId, teamId);
19779
+ if (!task)
19780
+ throw new Error(`Task "${taskId}" not found`);
19781
+ if (task.status === "blocked")
19782
+ throw new Error(`Task "${taskId}" is blocked by unresolved dependencies`);
19783
+ if (task.status !== "pending")
19784
+ throw new Error(`Task "${taskId}" is not pending (status: ${task.status})`);
19785
+ if (task.assignee)
19786
+ throw new Error(`Task "${taskId}" is already claimed by ${task.assignee}`);
19787
+ const result = db.run("UPDATE team_task SET status = 'in_progress', assignee = ?, time_updated = ? WHERE id = ? AND status = 'pending' AND assignee IS NULL", [assignee, Date.now(), taskId]);
19788
+ if (result.changes === 0) {
19789
+ throw new Error(`Task "${taskId}" is already claimed (race condition)`);
19790
+ }
19791
+ return task.content;
19792
+ }
19793
+ async function executeTeamClaim(deps, args, sessionId) {
19794
+ const teamInfo = requireTeamMember(deps, sessionId);
19795
+ const claimerName = teamInfo.role === "lead" ? "lead" : teamInfo.memberName ?? "unknown";
19796
+ const content = claimTask(deps.db, teamInfo.teamId, args.task_id, claimerName);
19797
+ return `Claimed task: ${content}`;
19798
+ }
19799
+
18512
19800
  // src/tools/team-spawn.ts
18513
19801
  init_merge_helper();
18514
19802
  var spawnFailures = new Map;
@@ -18549,6 +19837,7 @@ function withTimeout(promise2, ms, label) {
18549
19837
  ]);
18550
19838
  }
18551
19839
  async function executeTeamSpawn(deps, args, sessionId) {
19840
+ const agent = args.agent ?? "build";
18552
19841
  const nameError = validateMemberName(args.name);
18553
19842
  if (nameError)
18554
19843
  throw new Error(nameError);
@@ -18560,10 +19849,10 @@ async function executeTeamSpawn(deps, args, sessionId) {
18560
19849
  const existing = deps.db.query("SELECT name FROM team_member WHERE team_id = ? AND name = ?").get(teamInfo.teamId, args.name);
18561
19850
  if (existing)
18562
19851
  throw new Error(`Teammate "${args.name}" already exists in team "${teamInfo.teamName}"`);
18563
- const isReadOnly = args.agent === "plan" || args.agent === "explore";
19852
+ const isReadOnly = agent === "plan" || agent === "explore";
18564
19853
  const useWorktree = args.worktree !== false && !isReadOnly && !isWorktreeDirectory(deps.directory);
18565
19854
  const usePlanApproval = args.plan_approval === true;
18566
- log(`spawn:start name=${args.name} agent=${args.agent} worktree=${useWorktree}`);
19855
+ log(`spawn:start name=${args.name} agent=${agent} worktree=${useWorktree}`);
18567
19856
  let worktreeDir = null;
18568
19857
  let worktreeBranch = null;
18569
19858
  if (useWorktree) {
@@ -18619,7 +19908,7 @@ async function executeTeamSpawn(deps, args, sessionId) {
18619
19908
  log(`spawn:session:start name=${args.name}`);
18620
19909
  const createResult = await withTimeout(deps.client.session.create({
18621
19910
  parentID: sessionId,
18622
- title: `${args.name} (@${args.agent} teammate)`,
19911
+ title: `${args.name} (@${agent} teammate)`,
18623
19912
  permission,
18624
19913
  ...workspaceId ? { workspaceID: workspaceId } : {}
18625
19914
  }), getSpawnTimeout(), `session.create for "${args.name}"`);
@@ -18658,15 +19947,26 @@ async function executeTeamSpawn(deps, args, sessionId) {
18658
19947
  const planApproval = usePlanApproval ? "pending" : "none";
18659
19948
  const now = Date.now();
18660
19949
  const memberCount = deps.db.query("SELECT COUNT(*) as c FROM team_member WHERE team_id = ?").get(teamInfo.teamId).c;
18661
- const resolvedModel = resolveModel(args.model, args.agent, memberCount, deps.config);
19950
+ const resolvedModel = resolveModel(args.model, agent, memberCount, deps.config);
18662
19951
  if (resolvedModel)
18663
19952
  log(`spawn:model name=${args.name} model=${resolvedModel}`);
18664
19953
  deps.db.run(`INSERT INTO team_member (team_id, name, session_id, agent, status, execution_status, model, prompt, worktree_dir, worktree_branch, workspace_id, plan_approval, time_created, time_updated)
18665
- VALUES (?, ?, ?, ?, 'busy', 'starting', ?, ?, ?, ?, ?, ?, ?, ?)`, [teamInfo.teamId, args.name, childSessionId, args.agent, resolvedModel ?? null, args.prompt, worktreeDir, worktreeBranch, workspaceId, planApproval, now, now]);
19954
+ VALUES (?, ?, ?, ?, 'busy', 'starting', ?, ?, ?, ?, ?, ?, ?, ?)`, [teamInfo.teamId, args.name, childSessionId, agent, resolvedModel ?? null, args.prompt, worktreeDir, worktreeBranch, workspaceId, planApproval, now, now]);
18666
19955
  deps.registry.register(teamInfo.teamId, args.name, childSessionId);
19956
+ let claimedTaskContent = null;
19957
+ let claimWarning = null;
19958
+ if (args.claim_task && !isReadOnly) {
19959
+ try {
19960
+ claimedTaskContent = claimTask(deps.db, teamInfo.teamId, args.claim_task, args.name);
19961
+ log(`spawn:claim:ok name=${args.name} task=${args.claim_task}`);
19962
+ } catch (err) {
19963
+ claimWarning = err instanceof Error ? err.message : String(err);
19964
+ log(`spawn:claim:failed name=${args.name} task=${args.claim_task} err=${claimWarning}`);
19965
+ }
19966
+ }
18667
19967
  const context = [
18668
19968
  `You are "${args.name}", a teammate in team "${teamInfo.teamName}".`,
18669
- `Your agent type is "${args.agent}".`
19969
+ `Your agent type is "${agent}".`
18670
19970
  ];
18671
19971
  const otherMembers = deps.db.query("SELECT name FROM team_member WHERE team_id = ? AND name != ? AND status NOT IN ('shutdown', 'error')").all(teamInfo.teamId, args.name);
18672
19972
  if (otherMembers.length > 0) {
@@ -18709,7 +20009,7 @@ async function executeTeamSpawn(deps, args, sessionId) {
18709
20009
  const lastStep = !isReadOnly && worktreeBranch ? "4" : !isReadOnly ? "3" : "2";
18710
20010
  context.push(`${lastStep}. STOP. Do not send follow-up confirmations, status updates, or 'standing by' messages.`, "", "If you are blocked:", "- Send ONE message to the lead via team_message describing the specific blocker.", "- Do NOT attempt workarounds or make assumptions. Wait for the lead's response.", "", "Your plain text output is NOT visible to the team. You MUST use team_message to communicate.");
18711
20011
  context.push("", "Your task:", args.prompt);
18712
- if (args.claim_task) {
20012
+ if (claimedTaskContent) {
18713
20013
  context.push("", `You have been assigned task ${args.claim_task}. Mark it complete when done.`);
18714
20014
  }
18715
20015
  const contextStr = context.join(`
@@ -18722,7 +20022,7 @@ async function executeTeamSpawn(deps, args, sessionId) {
18722
20022
  deps.client.session.promptAsync({
18723
20023
  sessionID: childSessionId,
18724
20024
  parts: [{ type: "text", text: contextStr }],
18725
- agent: args.agent,
20025
+ agent,
18726
20026
  ...modelParam ? { model: modelParam } : {}
18727
20027
  }).catch((err) => {
18728
20028
  const errMsg = err instanceof Error ? err.message : String(err);
@@ -18730,6 +20030,9 @@ async function executeTeamSpawn(deps, args, sessionId) {
18730
20030
  try {
18731
20031
  deps.db.run("DELETE FROM team_member WHERE team_id = ? AND session_id = ?", [teamInfo.teamId, childSessionId]);
18732
20032
  deps.registry.unregister(childSessionId);
20033
+ if (claimedTaskContent) {
20034
+ deps.db.run("UPDATE team_task SET status = 'pending', assignee = NULL, time_updated = ? WHERE id = ? AND assignee = ?", [Date.now(), args.claim_task, args.name]);
20035
+ }
18733
20036
  deps.client.session.abort({ sessionID: childSessionId }).catch(() => {});
18734
20037
  if (workspaceId) {
18735
20038
  deps.client.workspace.remove({ id: workspaceId }).catch(() => {});
@@ -18754,9 +20057,10 @@ async function executeTeamSpawn(deps, args, sessionId) {
18754
20057
  });
18755
20058
  const branchInfo = worktreeBranch ? ` (branch: ${worktreeBranch})` : "";
18756
20059
  const planInfo = usePlanApproval ? " [plan mode — will send plan for approval]" : "";
20060
+ const claimInfo = claimedTaskContent ? ` (claimed task: ${args.claim_task})` : claimWarning ? ` (could not claim task: ${claimWarning})` : "";
18757
20061
  spawnFailures.delete(teamInfo.teamId);
18758
20062
  log(`spawn:done name=${args.name} sessionId=${childSessionId}`);
18759
- return `Teammate "${args.name}" spawned (agent: ${args.agent})${branchInfo}${planInfo}. They are working on: ${args.prompt.slice(0, 120)}${args.prompt.length > 120 ? "..." : ""}`;
20063
+ return `Teammate "${args.name}" spawned (agent: ${agent})${branchInfo}${planInfo}${claimInfo}. They are working on: ${args.prompt.slice(0, 120)}${args.prompt.length > 120 ? "..." : ""}`;
18760
20064
  }
18761
20065
 
18762
20066
  // src/tools/team-message.ts
@@ -19490,11 +20794,28 @@ async function executeTeamTasksAdd(deps, args, sessionId) {
19490
20794
  // src/tools/team-tasks-complete.ts
19491
20795
  async function executeTeamTasksComplete(deps, args, sessionId) {
19492
20796
  const teamInfo = requireTeamMember(deps, sessionId);
19493
- const task = deps.db.query("SELECT * FROM team_task WHERE id = ? AND team_id = ?").get(args.task_id, teamInfo.teamId);
20797
+ const caller = teamInfo.role === "lead" ? "lead" : teamInfo.memberName ?? "unknown";
20798
+ const task = deps.db.query("SELECT id, content, status, assignee FROM team_task WHERE id = ? AND team_id = ?").get(args.task_id, teamInfo.teamId);
19494
20799
  if (!task)
19495
20800
  throw new Error(`Task "${args.task_id}" not found`);
20801
+ if (task.status === "completed")
20802
+ throw new Error(`Task "${args.task_id}" is already completed`);
20803
+ if (task.status === "cancelled")
20804
+ throw new Error(`Task "${args.task_id}" was cancelled`);
20805
+ if (task.status === "blocked")
20806
+ throw new Error(`Task "${args.task_id}" is blocked by unresolved dependencies`);
20807
+ if (task.status === "in_progress" && task.assignee && teamInfo.role !== "lead" && caller !== task.assignee) {
20808
+ throw new Error(`Task "${args.task_id}" is claimed by ${task.assignee}`);
20809
+ }
19496
20810
  const now = Date.now();
19497
- deps.db.run("UPDATE team_task SET status = 'completed', time_updated = ? WHERE id = ?", [now, args.task_id]);
20811
+ if (task.assignee) {
20812
+ deps.db.run("UPDATE team_task SET status = 'completed', time_updated = ? WHERE id = ?", [now, args.task_id]);
20813
+ } else {
20814
+ const result = deps.db.run("UPDATE team_task SET status = 'completed', assignee = ?, time_updated = ? WHERE id = ? AND assignee IS NULL", [caller, now, args.task_id]);
20815
+ if (result.changes === 0) {
20816
+ throw new Error(`Task "${args.task_id}" was just completed by another teammate`);
20817
+ }
20818
+ }
19498
20819
  const allTasks = deps.db.query("SELECT id, depends_on, status FROM team_task WHERE team_id = ?").all(teamInfo.teamId);
19499
20820
  let unblocked = 0;
19500
20821
  for (const t of allTasks) {
@@ -19532,26 +20853,6 @@ async function executeTeamTasksComplete(deps, args, sessionId) {
19532
20853
  return `Completed task: ${task.content}${unblockedMsg}`;
19533
20854
  }
19534
20855
 
19535
- // src/tools/team-claim.ts
19536
- async function executeTeamClaim(deps, args, sessionId) {
19537
- const teamInfo = requireTeamMember(deps, sessionId);
19538
- const claimerName = teamInfo.role === "lead" ? "lead" : teamInfo.memberName ?? "unknown";
19539
- const task = deps.db.query("SELECT * FROM team_task WHERE id = ? AND team_id = ?").get(args.task_id, teamInfo.teamId);
19540
- if (!task)
19541
- throw new Error(`Task "${args.task_id}" not found`);
19542
- if (task.status === "blocked")
19543
- throw new Error(`Task "${args.task_id}" is blocked by unresolved dependencies`);
19544
- if (task.status !== "pending")
19545
- throw new Error(`Task "${args.task_id}" is not pending (status: ${task.status})`);
19546
- if (task.assignee)
19547
- throw new Error(`Task "${args.task_id}" is already claimed by ${task.assignee}`);
19548
- const result = deps.db.run("UPDATE team_task SET status = 'in_progress', assignee = ?, time_updated = ? WHERE id = ? AND status = 'pending' AND assignee IS NULL", [claimerName, Date.now(), args.task_id]);
19549
- if (result.changes === 0) {
19550
- throw new Error(`Task "${args.task_id}" is already claimed (race condition)`);
19551
- }
19552
- return `Claimed task: ${task.content}`;
19553
- }
19554
-
19555
20856
  // src/tools/team-results.ts
19556
20857
  async function executeTeamResults(deps, args, sessionId) {
19557
20858
  const team = requireTeamMember(deps, sessionId);
@@ -19905,6 +21206,7 @@ var plugin = async (input) => {
19905
21206
  const purgeApprovals = new PendingPurgeApprovals;
19906
21207
  const nudgedMembers = new Set;
19907
21208
  const progressTracker = new ProgressTracker;
21209
+ const activityBuffer = new ActivityBuffer;
19908
21210
  const wakeLeadTimestamps = new Map;
19909
21211
  const WAKE_LEAD_COOLDOWN_MS = 5000;
19910
21212
  const pluginTransport = input.client._client;
@@ -19932,7 +21234,7 @@ var plugin = async (input) => {
19932
21234
  });
19933
21235
  log("init:recovery:done");
19934
21236
  if (config2.dashboardPort !== 0) {
19935
- startDashboard(db, config2.dashboardPort).catch((err) => {
21237
+ startDashboard(db, config2.dashboardPort, { activityBuffer, client: client3 }).catch((err) => {
19936
21238
  log(`init:dashboard:failed err=${err instanceof Error ? err.message : String(err)}`);
19937
21239
  });
19938
21240
  }
@@ -20086,6 +21388,7 @@ var plugin = async (input) => {
20086
21388
  }
20087
21389
  }
20088
21390
  }
21391
+ recordFromV2Event(event, registry2, activityBuffer);
20089
21392
  },
20090
21393
  "tool.execute.before": async (input2, _output) => {
20091
21394
  checkToolIsolation(registry2, tracker, input2.tool, input2.sessionID, db);
@@ -20094,11 +21397,13 @@ var plugin = async (input) => {
20094
21397
  await rateLimiter.waitForToken();
20095
21398
  }
20096
21399
  }
21400
+ recordFromToolBefore(input2, registry2, activityBuffer);
20097
21401
  },
20098
21402
  "tool.execute.after": async (input2, output) => {
20099
21403
  if (input2.tool === "question") {
20100
21404
  purgeApprovals.recordQuestionAnswer(input2.sessionID, output.output, input2.args);
20101
21405
  }
21406
+ recordFromToolAfter(input2, output, registry2, activityBuffer);
20102
21407
  },
20103
21408
  "experimental.chat.system.transform": async (input2, output) => {
20104
21409
  if (!input2.sessionID)
@@ -20265,8 +21570,10 @@ var plugin = async (input) => {
20265
21570
  async execute(args, ctx) {
20266
21571
  const result = await executeTeamShutdown(deps, args, ctx.sessionID);
20267
21572
  const member = deps.db.query("SELECT session_id FROM team_member WHERE name = ? AND status IN ('shutdown', 'shutdown_requested')").get(args.member);
20268
- if (member)
21573
+ if (member) {
20269
21574
  progressTracker.remove(member.session_id);
21575
+ activityBuffer.remove(member.session_id);
21576
+ }
20270
21577
  const hasWarning = result.includes("uncommitted");
20271
21578
  ctx.metadata({ title: hasWarning ? `${args.member} shut down — uncommitted changes` : `${args.member} shut down` });
20272
21579
  return result;
@@ -20293,7 +21600,13 @@ var plugin = async (input) => {
20293
21600
  }
20294
21601
  });
20295
21602
  } : undefined;
21603
+ const teamInfoForCleanup = findTeamBySession(db, registry2, ctx.sessionID);
21604
+ const memberSessions = teamInfoForCleanup ? db.query("SELECT session_id FROM team_member WHERE team_id = ?").all(teamInfoForCleanup.teamId).map((m) => m.session_id) : [];
20296
21605
  const result = await executeTeamCleanup(deps, args, ctx.sessionID, undefined, undefined, undefined, config2.mergeOnCleanup, undefined, approvePurge);
21606
+ if (!result.includes("uncommitted") && !args.purge) {
21607
+ for (const sid of memberSessions)
21608
+ activityBuffer.remove(sid);
21609
+ }
20297
21610
  const blocked = result.includes("uncommitted");
20298
21611
  const title = args.purge ? result.startsWith("No archived teams") ? "No archived teams to purge" : result.startsWith("Purge preview") ? "Purge confirmation required" : "Archived teams purged" : blocked ? "Cleanup blocked — uncommitted changes" : "Team cleaned up";
20299
21612
  ctx.metadata({ title });