@gitterm/sdk 0.11.0 → 0.12.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.
@@ -30,7 +30,7 @@ function normalizeQuestion(question) {
30
30
  }
31
31
  return changed ? { ...question, options, custom } : question;
32
32
  }
33
- // ../../node_modules/.bun/@opencode+client@2.0.19+43902b222b0d7d3e/node_modules/@opencode/client/dist/chunks/rpc-runtime-9rqn6x4v.js
33
+ // ../../node_modules/.bun/@opencode+client@2.2.6+307d8a970cbb91e6/node_modules/@opencode/client/dist/chunks/contract-9rqn6x4v.js
34
34
  var __defProp = Object.defineProperty;
35
35
  var __returnValue = (v) => v;
36
36
  function __exportSetter(name, newValue) {
@@ -46,7 +46,7 @@ var __export = (target, all) => {
46
46
  });
47
47
  };
48
48
 
49
- // ../../node_modules/.bun/@opencode+client@2.0.19+43902b222b0d7d3e/node_modules/@opencode/client/dist/chunks/rpc-runtime-frbwqjmf.js
49
+ // ../../node_modules/.bun/@opencode+client@2.2.6+307d8a970cbb91e6/node_modules/@opencode/client/dist/chunks/contract-gecjxyvt.js
50
50
  var exports_shared_events = {};
51
51
  __export(exports_shared_events, {
52
52
  SharedEvents: () => exports_shared_events,
@@ -100,6 +100,8 @@ function make7(connect) {
100
100
  let started = false;
101
101
  let completion;
102
102
  let connection;
103
+ const types = options?.types?.length ? new Set(options.types) : undefined;
104
+ const selected = (value) => !types || value.type === "server.connected" || types.has(value.type);
103
105
  function finish(result, discard = true) {
104
106
  completion = result;
105
107
  if (discard)
@@ -125,6 +127,8 @@ function make7(connect) {
125
127
  push(value) {
126
128
  if (completion)
127
129
  return;
130
+ if (!selected(value))
131
+ return;
128
132
  const request = pending.shift();
129
133
  if (request) {
130
134
  request.resolve({ done: false, value });
@@ -186,8 +190,8 @@ function make7(connect) {
186
190
  };
187
191
  }
188
192
 
189
- // ../../node_modules/.bun/@opencode+client@2.0.19+43902b222b0d7d3e/node_modules/@opencode/client/dist/chunks/rpc-runtime-js54wxgp.js
190
- class ClientError2 extends Error {
193
+ // ../../node_modules/.bun/@opencode+client@2.2.6+307d8a970cbb91e6/node_modules/@opencode/client/dist/chunks/contract-nwcpakzx.js
194
+ class ClientError3 extends Error {
191
195
  reason;
192
196
  name = "ClientError";
193
197
  constructor(reason, options) {
@@ -197,13 +201,13 @@ class ClientError2 extends Error {
197
201
  }
198
202
  }
199
203
 
200
- // ../../node_modules/.bun/@opencode+client@2.0.19+43902b222b0d7d3e/node_modules/@opencode/client/dist/chunks/rpc-runtime-h9cy5hnk.js
201
- var exports_client2 = {};
202
- __export(exports_client2, {
203
- make: () => make3
204
+ // ../../node_modules/.bun/@opencode+client@2.2.6+307d8a970cbb91e6/node_modules/@opencode/client/dist/chunks/contract-vxrn9xjg.js
205
+ var exports_client4 = {};
206
+ __export(exports_client4, {
207
+ make: () => make6
204
208
  });
205
209
  var maxSseEventBytes = 16 * 1024 * 1024;
206
- function make3(options) {
210
+ function make6(options) {
207
211
  const fetch2 = options.fetch ?? globalThis.fetch;
208
212
  const prepare = (descriptor, requestOptions) => {
209
213
  const baseUrl = new URL(options.baseUrl);
@@ -236,7 +240,7 @@ function make3(options) {
236
240
  const prepared = prepare(descriptor, requestOptions);
237
241
  return await fetch2(prepared.url, prepared.init);
238
242
  } catch (cause) {
239
- throw new ClientError2("Transport", { cause });
243
+ throw new ClientError3("Transport", { cause });
240
244
  }
241
245
  };
242
246
  const responseError = async (response, descriptor) => {
@@ -245,7 +249,7 @@ function make3(options) {
245
249
  try {
246
250
  await response.body?.cancel();
247
251
  } catch {}
248
- throw new ClientError2("UnexpectedStatus", { cause: { status: response.status }, detail: String(response.status) });
252
+ throw new ClientError3("UnexpectedStatus", { cause: { status: response.status }, detail: String(response.status) });
249
253
  };
250
254
  const request = async (descriptor, requestOptions) => {
251
255
  const response = await execute(descriptor, requestOptions);
@@ -270,10 +274,10 @@ function make3(options) {
270
274
  try {
271
275
  await response.body?.cancel();
272
276
  } catch {}
273
- throw new ClientError2("UnsupportedContentType", { detail: response.headers.get("content-type") });
277
+ throw new ClientError3("UnsupportedContentType", { detail: response.headers.get("content-type") });
274
278
  }
275
279
  if (response.body === null)
276
- throw new ClientError2("MalformedResponse");
280
+ throw new ClientError3("MalformedResponse");
277
281
  const reader = response.body.getReader();
278
282
  const decoder = new TextDecoder;
279
283
  let buffer = "";
@@ -283,13 +287,13 @@ function make3(options) {
283
287
  try {
284
288
  next = await reader.read();
285
289
  } catch (cause) {
286
- throw new ClientError2("Transport", { cause });
290
+ throw new ClientError3("Transport", { cause });
287
291
  }
288
292
  if (!next.done)
289
293
  requestOptions?.onActivity?.();
290
294
  buffer += decoder.decode(next.value, { stream: !next.done });
291
295
  if (buffer.length > maxSseEventBytes)
292
- throw new ClientError2("SseEventTooLarge");
296
+ throw new ClientError3("SseEventTooLarge");
293
297
  const trailingCarriageReturn = !next.done && buffer.endsWith("\r");
294
298
  if (trailingCarriageReturn)
295
299
  buffer = buffer.slice(0, -1);
@@ -316,7 +320,7 @@ function make3(options) {
316
320
  try {
317
321
  yield JSON.parse(data);
318
322
  } catch (cause) {
319
- throw new ClientError2("MalformedResponse", { cause });
323
+ throw new ClientError3("MalformedResponse", { cause });
320
324
  }
321
325
  }
322
326
  boundary = buffer.indexOf(`
@@ -334,7 +338,7 @@ function make3(options) {
334
338
  }
335
339
  }
336
340
  });
337
- return {
341
+ const client = {
338
342
  server: {
339
343
  info: (requestOptions) => request({ method: "GET", path: `/api/info`, successStatus: 200, declaredStatuses: [400, 401], empty: false }, requestOptions),
340
344
  pair: (requestOptions) => request({ method: "POST", path: `/api/pair`, successStatus: 200, declaredStatuses: [400, 401], empty: false }, requestOptions),
@@ -352,7 +356,7 @@ function make3(options) {
352
356
  path: `/api/location`,
353
357
  query: { location: input?.["location"] },
354
358
  successStatus: 200,
355
- declaredStatuses: [400, 401],
359
+ declaredStatuses: [400, 401, 404],
356
360
  empty: false
357
361
  }, requestOptions),
358
362
  reload: (requestOptions) => request({
@@ -369,7 +373,7 @@ function make3(options) {
369
373
  path: `/api/agent`,
370
374
  query: { location: input?.["location"] },
371
375
  successStatus: 200,
372
- declaredStatuses: [400, 401],
376
+ declaredStatuses: [400, 401, 404, 503],
373
377
  empty: false
374
378
  }, requestOptions),
375
379
  get: (input, requestOptions) => request({
@@ -387,7 +391,15 @@ function make3(options) {
387
391
  path: `/api/plugin`,
388
392
  query: { location: input?.["location"] },
389
393
  successStatus: 200,
390
- declaredStatuses: [400, 401],
394
+ declaredStatuses: [400, 401, 404],
395
+ empty: false
396
+ }, requestOptions),
397
+ gui: (input, requestOptions) => request({
398
+ method: "GET",
399
+ path: `/api/plugin/gui`,
400
+ query: { location: input["location"], id: input["id"] },
401
+ successStatus: 200,
402
+ declaredStatuses: [400, 401, 404],
391
403
  empty: false
392
404
  }, requestOptions),
393
405
  check: (input, requestOptions) => request({
@@ -396,7 +408,7 @@ function make3(options) {
396
408
  query: { location: input?.["location"] },
397
409
  body: { target: input?.["target"] },
398
410
  successStatus: 200,
399
- declaredStatuses: [400, 401],
411
+ declaredStatuses: [400, 401, 404],
400
412
  empty: false
401
413
  }, requestOptions),
402
414
  update: (input, requestOptions) => request({
@@ -405,7 +417,7 @@ function make3(options) {
405
417
  query: { location: input["location"] },
406
418
  body: { targets: input["targets"] },
407
419
  successStatus: 204,
408
- declaredStatuses: [400, 401, 503],
420
+ declaredStatuses: [400, 401, 404, 503],
409
421
  empty: true
410
422
  }, requestOptions)
411
423
  },
@@ -418,6 +430,7 @@ function make3(options) {
418
430
  order: input?.["order"],
419
431
  search: input?.["search"],
420
432
  parentID: input?.["parentID"],
433
+ archived: input?.["archived"],
421
434
  directory: input?.["directory"],
422
435
  project: input?.["project"],
423
436
  subpath: input?.["subpath"],
@@ -427,25 +440,12 @@ function make3(options) {
427
440
  declaredStatuses: [400, 401],
428
441
  empty: false
429
442
  }, requestOptions),
430
- stats: (input, requestOptions) => request({
431
- method: "GET",
432
- path: `/api/experimental/session/stats`,
433
- query: {
434
- from: input?.["from"],
435
- to: input?.["to"],
436
- project: input?.["project"],
437
- timezone: input?.["timezone"],
438
- tools: input?.["tools"]
439
- },
440
- successStatus: 200,
441
- declaredStatuses: [400, 401],
442
- empty: false
443
- }, requestOptions).then((value) => value.data),
444
443
  create: (input, requestOptions) => request({
445
444
  method: "POST",
446
445
  path: `/api/session`,
447
446
  body: {
448
447
  id: input?.["id"],
448
+ parentID: input?.["parentID"],
449
449
  title: input?.["title"],
450
450
  agent: input?.["agent"],
451
451
  model: input?.["model"],
@@ -454,23 +454,7 @@ function make3(options) {
454
454
  permissions: input?.["permissions"]
455
455
  },
456
456
  successStatus: 200,
457
- declaredStatuses: [400, 401],
458
- empty: false
459
- }, requestOptions).then((value) => value.data),
460
- import: (input, requestOptions) => request({
461
- method: "POST",
462
- path: `/api/experimental/session/import`,
463
- body: { info: input["info"], messages: input["messages"], location: input["location"] },
464
- successStatus: 200,
465
- declaredStatuses: [400, 401, 404, 409],
466
- empty: false
467
- }, requestOptions).then((value) => value.data),
468
- export: (input, requestOptions) => request({
469
- method: "GET",
470
- path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/export`,
471
- query: { sanitize: input["sanitize"] },
472
- successStatus: 200,
473
- declaredStatuses: [400, 401, 404, 500],
457
+ declaredStatuses: [400, 401, 404],
474
458
  empty: false
475
459
  }, requestOptions).then((value) => value.data),
476
460
  active: (requestOptions) => request({
@@ -521,7 +505,12 @@ function make3(options) {
521
505
  update: (input, requestOptions) => request({
522
506
  method: "PATCH",
523
507
  path: `/api/session/${encodeURIComponent(input.sessionID)}`,
524
- body: { title: input["title"], metadata: input["metadata"], permissions: input["permissions"] },
508
+ body: {
509
+ title: input["title"],
510
+ metadata: input["metadata"],
511
+ permissions: input["permissions"],
512
+ archived: input["archived"]
513
+ },
525
514
  successStatus: 204,
526
515
  declaredStatuses: [400, 401, 404],
527
516
  empty: true
@@ -566,14 +555,6 @@ function make3(options) {
566
555
  declaredStatuses: [400, 401, 404, 500],
567
556
  empty: true
568
557
  }, requestOptions),
569
- skill: (input, requestOptions) => request({
570
- method: "POST",
571
- path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/skill`,
572
- body: { id: input["id"], resume: input["resume"] },
573
- successStatus: 204,
574
- declaredStatuses: [400, 401, 404],
575
- empty: true
576
- }, requestOptions),
577
558
  synthetic: (input, requestOptions) => request({
578
559
  method: "POST",
579
560
  path: `/api/session/${encodeURIComponent(input.sessionID)}/synthetic`,
@@ -605,13 +586,6 @@ function make3(options) {
605
586
  declaredStatuses: [400, 401, 404, 409],
606
587
  empty: false
607
588
  }, requestOptions).then((value) => value.data),
608
- wait: (input, requestOptions) => request({
609
- method: "POST",
610
- path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/wait`,
611
- successStatus: 204,
612
- declaredStatuses: [400, 401, 404, 503],
613
- empty: true
614
- }, requestOptions),
615
589
  revert: {
616
590
  stage: (input, requestOptions) => request({
617
591
  method: "POST",
@@ -675,32 +649,6 @@ function make3(options) {
675
649
  empty: true
676
650
  }, requestOptions)
677
651
  },
678
- instructions: {
679
- entry: {
680
- list: (input, requestOptions) => request({
681
- method: "GET",
682
- path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/instructions/entries`,
683
- successStatus: 200,
684
- declaredStatuses: [400, 401, 404],
685
- empty: false
686
- }, requestOptions).then((value) => value.data),
687
- put: (input, requestOptions) => request({
688
- method: "PUT",
689
- path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/instructions/entries/${encodeURIComponent(input.key)}`,
690
- body: { value: input["value"] },
691
- successStatus: 204,
692
- declaredStatuses: [400, 401, 404, 413],
693
- empty: true
694
- }, requestOptions),
695
- remove: (input, requestOptions) => request({
696
- method: "DELETE",
697
- path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/instructions/entries/${encodeURIComponent(input.key)}`,
698
- successStatus: 204,
699
- declaredStatuses: [400, 401, 404],
700
- empty: true
701
- }, requestOptions)
702
- }
703
- },
704
652
  generate: (input, requestOptions) => request({
705
653
  method: "POST",
706
654
  path: `/api/session/${encodeURIComponent(input.sessionID)}/generate`,
@@ -709,14 +657,6 @@ function make3(options) {
709
657
  declaredStatuses: [400, 401, 404, 503],
710
658
  empty: false
711
659
  }, requestOptions).then((value) => value.data),
712
- log: (input, requestOptions) => sse({
713
- method: "GET",
714
- path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/log`,
715
- query: { after: input["after"], follow: input["follow"] },
716
- successStatus: 200,
717
- declaredStatuses: [400, 401, 404],
718
- empty: false
719
- }, requestOptions),
720
660
  interrupt: (input, requestOptions) => request({
721
661
  method: "POST",
722
662
  path: `/api/session/${encodeURIComponent(input.sessionID)}/interrupt`,
@@ -775,6 +715,7 @@ function make3(options) {
775
715
  cancel: (input, requestOptions) => request({
776
716
  method: "DELETE",
777
717
  path: `/api/session/${encodeURIComponent(input.sessionID)}/form/${encodeURIComponent(input.formID)}`,
718
+ query: { message: input["message"] },
778
719
  successStatus: 204,
779
720
  declaredStatuses: [400, 401, 404, 409],
780
721
  empty: true
@@ -797,6 +738,493 @@ function make3(options) {
797
738
  empty: true
798
739
  }, requestOptions)
799
740
  },
741
+ experimental: {
742
+ session: {
743
+ stats: (input, requestOptions) => request({
744
+ method: "GET",
745
+ path: `/api/experimental/session/stats`,
746
+ query: {
747
+ from: input?.["from"],
748
+ to: input?.["to"],
749
+ project: input?.["project"],
750
+ timezone: input?.["timezone"],
751
+ tools: input?.["tools"]
752
+ },
753
+ successStatus: 200,
754
+ declaredStatuses: [400, 401],
755
+ empty: false
756
+ }, requestOptions).then((value) => value.data),
757
+ import: (input, requestOptions) => request({
758
+ method: "POST",
759
+ path: `/api/experimental/session/import`,
760
+ body: { info: input["info"], messages: input["messages"], location: input["location"] },
761
+ successStatus: 200,
762
+ declaredStatuses: [400, 401, 404, 409],
763
+ empty: false
764
+ }, requestOptions).then((value) => value.data),
765
+ export: (input, requestOptions) => request({
766
+ method: "GET",
767
+ path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/export`,
768
+ query: { sanitize: input["sanitize"] },
769
+ successStatus: 200,
770
+ declaredStatuses: [400, 401, 404, 500],
771
+ empty: false
772
+ }, requestOptions).then((value) => value.data),
773
+ skill: (input, requestOptions) => request({
774
+ method: "POST",
775
+ path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/skill`,
776
+ body: { id: input["id"], resume: input["resume"] },
777
+ successStatus: 204,
778
+ declaredStatuses: [400, 401, 404],
779
+ empty: true
780
+ }, requestOptions),
781
+ wait: (input, requestOptions) => request({
782
+ method: "POST",
783
+ path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/wait`,
784
+ successStatus: 204,
785
+ declaredStatuses: [400, 401, 404, 503],
786
+ empty: true
787
+ }, requestOptions),
788
+ instructions: {
789
+ entry: {
790
+ list: (input, requestOptions) => request({
791
+ method: "GET",
792
+ path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/instructions/entries`,
793
+ successStatus: 200,
794
+ declaredStatuses: [400, 401, 404],
795
+ empty: false
796
+ }, requestOptions).then((value) => value.data),
797
+ put: (input, requestOptions) => request({
798
+ method: "PUT",
799
+ path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/instructions/entries/${encodeURIComponent(input.key)}`,
800
+ body: { value: input["value"] },
801
+ successStatus: 204,
802
+ declaredStatuses: [400, 401, 404, 413],
803
+ empty: true
804
+ }, requestOptions),
805
+ remove: (input, requestOptions) => request({
806
+ method: "DELETE",
807
+ path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/instructions/entries/${encodeURIComponent(input.key)}`,
808
+ successStatus: 204,
809
+ declaredStatuses: [400, 401, 404],
810
+ empty: true
811
+ }, requestOptions)
812
+ }
813
+ },
814
+ log: (input, requestOptions) => sse({
815
+ method: "GET",
816
+ path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/log`,
817
+ query: { after: input["after"], follow: input["follow"] },
818
+ successStatus: 200,
819
+ declaredStatuses: [400, 401, 404],
820
+ empty: false
821
+ }, requestOptions)
822
+ },
823
+ generate: {
824
+ text: (input, requestOptions) => request({
825
+ method: "POST",
826
+ path: `/api/experimental/generate/text`,
827
+ body: { prompt: input["prompt"], model: input["model"] },
828
+ successStatus: 200,
829
+ declaredStatuses: [400, 401, 404, 422, 502, 503],
830
+ empty: false
831
+ }, requestOptions).then((value) => value.data),
832
+ image: (input, requestOptions) => request({
833
+ method: "POST",
834
+ path: `/api/experimental/generate/image`,
835
+ body: {
836
+ model: input["model"],
837
+ prompt: input["prompt"],
838
+ images: input["images"],
839
+ n: input["n"],
840
+ aspect: input["aspect"],
841
+ resolution: input["resolution"]
842
+ },
843
+ successStatus: 200,
844
+ declaredStatuses: [400, 401, 404, 422, 502, 503],
845
+ empty: false
846
+ }, requestOptions).then((value) => value.data),
847
+ decisions: (input, requestOptions) => request({
848
+ method: "POST",
849
+ path: `/api/experimental/generate/decisions`,
850
+ body: { model: input["model"], input: input["input"], questions: input["questions"] },
851
+ successStatus: 200,
852
+ declaredStatuses: [400, 401, 404, 422, 502, 503],
853
+ empty: false
854
+ }, requestOptions).then((value) => value.data)
855
+ },
856
+ voice: {
857
+ models: (requestOptions) => request({
858
+ method: "GET",
859
+ path: `/api/experimental/voice/models`,
860
+ successStatus: 200,
861
+ declaredStatuses: [400, 401, 404, 503],
862
+ empty: false
863
+ }, requestOptions).then((value) => value.data),
864
+ session: (input, requestOptions) => request({
865
+ method: "POST",
866
+ path: `/api/experimental/voice/session`,
867
+ body: { model: input["model"], session: input["session"], transport: input["transport"] },
868
+ successStatus: 200,
869
+ declaredStatuses: [400, 401, 404, 503],
870
+ empty: false
871
+ }, requestOptions).then((value) => value.data)
872
+ },
873
+ integration: {
874
+ wellknown: {
875
+ add: (input, requestOptions) => request({
876
+ method: "POST",
877
+ path: `/api/experimental/integration/wellknown`,
878
+ query: { location: input["location"] },
879
+ body: { url: input["url"] },
880
+ successStatus: 204,
881
+ declaredStatuses: [400, 401, 404],
882
+ empty: true
883
+ }, requestOptions)
884
+ }
885
+ },
886
+ mcp: {
887
+ add: (input, requestOptions) => request({
888
+ method: "PUT",
889
+ path: `/api/experimental/mcp/${encodeURIComponent(input.server)}`,
890
+ query: { location: input["location"] },
891
+ body: { config: input["config"] },
892
+ successStatus: 204,
893
+ declaredStatuses: [400, 401, 404],
894
+ empty: true
895
+ }, requestOptions),
896
+ remove: (input, requestOptions) => request({
897
+ method: "DELETE",
898
+ path: `/api/experimental/mcp/${encodeURIComponent(input.server)}`,
899
+ query: { location: input["location"] },
900
+ successStatus: 204,
901
+ declaredStatuses: [400, 401, 404],
902
+ empty: true
903
+ }, requestOptions),
904
+ connect: (input, requestOptions) => request({
905
+ method: "POST",
906
+ path: `/api/experimental/mcp/${encodeURIComponent(input.server)}/connect`,
907
+ query: { location: input["location"] },
908
+ successStatus: 204,
909
+ declaredStatuses: [400, 401, 404],
910
+ empty: true
911
+ }, requestOptions),
912
+ disconnect: (input, requestOptions) => request({
913
+ method: "POST",
914
+ path: `/api/experimental/mcp/${encodeURIComponent(input.server)}/disconnect`,
915
+ query: { location: input["location"] },
916
+ successStatus: 204,
917
+ declaredStatuses: [400, 401, 404],
918
+ empty: true
919
+ }, requestOptions),
920
+ client: {
921
+ token: (input, requestOptions) => request({
922
+ method: "POST",
923
+ path: `/api/experimental/client-mcp/token`,
924
+ query: { location: input["location"], name: input["name"] },
925
+ headers: { "x-opencode-ticket": input["x-opencode-ticket"] },
926
+ successStatus: 200,
927
+ declaredStatuses: [400, 401, 403, 404],
928
+ empty: false
929
+ }, requestOptions)
930
+ }
931
+ },
932
+ file: {
933
+ write: (input, requestOptions) => request({
934
+ method: "POST",
935
+ path: `/api/experimental/fs/write`,
936
+ query: { location: input["location"], path: input["path"] },
937
+ body: input["payload"],
938
+ successStatus: 200,
939
+ declaredStatuses: [400, 401, 404],
940
+ empty: false,
941
+ binaryBody: true
942
+ }, requestOptions),
943
+ watch: (input, requestOptions) => request({
944
+ method: "POST",
945
+ path: `/api/experimental/fs/watch`,
946
+ query: { location: input["location"] },
947
+ body: { path: input["path"] },
948
+ successStatus: 204,
949
+ declaredStatuses: [400, 401, 404, 503],
950
+ empty: true
951
+ }, requestOptions),
952
+ unwatch: (input, requestOptions) => request({
953
+ method: "DELETE",
954
+ path: `/api/experimental/fs/watch`,
955
+ query: { location: input["location"] },
956
+ body: { path: input["path"] },
957
+ successStatus: 204,
958
+ declaredStatuses: [400, 401, 404],
959
+ empty: true
960
+ }, requestOptions)
961
+ },
962
+ persistentPty: {
963
+ read: (input, requestOptions) => request({
964
+ method: "GET",
965
+ path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/terminal/read`,
966
+ query: { lines: input["lines"] },
967
+ successStatus: 200,
968
+ declaredStatuses: [400, 401, 503],
969
+ empty: false
970
+ }, requestOptions).then((value) => value.data),
971
+ list: (input, requestOptions) => request({
972
+ method: "GET",
973
+ path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/terminal`,
974
+ successStatus: 200,
975
+ declaredStatuses: [400, 401, 503],
976
+ empty: false
977
+ }, requestOptions).then((value) => value.data),
978
+ create: (input, requestOptions) => request({
979
+ method: "POST",
980
+ path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/terminal`,
981
+ body: {
982
+ command: input["command"],
983
+ args: input["args"],
984
+ cwd: input["cwd"],
985
+ title: input["title"],
986
+ env: input["env"],
987
+ size: input["size"]
988
+ },
989
+ successStatus: 200,
990
+ declaredStatuses: [400, 401, 503],
991
+ empty: false
992
+ }, requestOptions).then((value) => value.data),
993
+ shutdown: (requestOptions) => request({
994
+ method: "POST",
995
+ path: `/api/experimental/persistent-pty/shutdown`,
996
+ successStatus: 204,
997
+ declaredStatuses: [400, 401, 503],
998
+ empty: true
999
+ }, requestOptions),
1000
+ handoff: (requestOptions) => request({
1001
+ method: "POST",
1002
+ path: `/api/experimental/persistent-pty/handoff`,
1003
+ successStatus: 200,
1004
+ declaredStatuses: [400, 401, 503],
1005
+ empty: false
1006
+ }, requestOptions),
1007
+ get: (input, requestOptions) => request({
1008
+ method: "GET",
1009
+ path: `/api/experimental/persistent-pty/${encodeURIComponent(input.ptyID)}`,
1010
+ successStatus: 200,
1011
+ declaredStatuses: [400, 401, 404, 503],
1012
+ empty: false
1013
+ }, requestOptions).then((value) => value.data),
1014
+ update: (input, requestOptions) => request({
1015
+ method: "PUT",
1016
+ path: `/api/experimental/persistent-pty/${encodeURIComponent(input.ptyID)}`,
1017
+ body: { attachmentID: input["attachmentID"], size: input["size"], title: input["title"] },
1018
+ successStatus: 200,
1019
+ declaredStatuses: [400, 401, 404, 501, 503],
1020
+ empty: false
1021
+ }, requestOptions).then((value) => value.data),
1022
+ snapshot: (input, requestOptions) => request({
1023
+ method: "GET",
1024
+ path: `/api/experimental/persistent-pty/${encodeURIComponent(input.ptyID)}/snapshot`,
1025
+ successStatus: 200,
1026
+ declaredStatuses: [400, 401, 404, 503],
1027
+ empty: false
1028
+ }, requestOptions).then((value) => value.data),
1029
+ remove: (input, requestOptions) => request({
1030
+ method: "DELETE",
1031
+ path: `/api/experimental/persistent-pty/${encodeURIComponent(input.ptyID)}`,
1032
+ successStatus: 204,
1033
+ declaredStatuses: [400, 401, 404, 503],
1034
+ empty: true
1035
+ }, requestOptions),
1036
+ connectToken: (input, requestOptions) => request({
1037
+ method: "POST",
1038
+ path: `/api/experimental/persistent-pty/${encodeURIComponent(input.ptyID)}/connect-token`,
1039
+ headers: { "x-opencode-ticket": input["x-opencode-ticket"] },
1040
+ successStatus: 200,
1041
+ declaredStatuses: [400, 401, 403, 404, 503],
1042
+ empty: false
1043
+ }, requestOptions).then((value) => value.data)
1044
+ },
1045
+ media: {
1046
+ get: (input, requestOptions) => request({
1047
+ method: "GET",
1048
+ path: `/api/experimental/media/${encodeURIComponent(input.hash)}`,
1049
+ successStatus: 200,
1050
+ declaredStatuses: [400, 401, 404],
1051
+ empty: false,
1052
+ binary: true
1053
+ }, requestOptions)
1054
+ },
1055
+ schedule: {
1056
+ create: (input, requestOptions) => request({
1057
+ method: "POST",
1058
+ path: `/api/experimental/schedule`,
1059
+ body: {
1060
+ sessionID: input["sessionID"],
1061
+ name: input["name"],
1062
+ when: input["when"],
1063
+ if: input["if"],
1064
+ until: input["until"],
1065
+ ends: input["ends"],
1066
+ prompt: input["prompt"]
1067
+ },
1068
+ successStatus: 200,
1069
+ declaredStatuses: [400, 401, 403, 404],
1070
+ empty: false
1071
+ }, requestOptions).then((value) => value.data),
1072
+ list: (input, requestOptions) => request({
1073
+ method: "GET",
1074
+ path: `/api/experimental/schedule`,
1075
+ query: { sessionID: input["sessionID"] },
1076
+ successStatus: 200,
1077
+ declaredStatuses: [400, 401, 403, 404],
1078
+ empty: false
1079
+ }, requestOptions).then((value) => value.data),
1080
+ get: (input, requestOptions) => request({
1081
+ method: "GET",
1082
+ path: `/api/experimental/schedule/${encodeURIComponent(input.scheduleID)}`,
1083
+ successStatus: 200,
1084
+ declaredStatuses: [400, 401, 403, 404],
1085
+ empty: false
1086
+ }, requestOptions).then((value) => value.data),
1087
+ pause: (input, requestOptions) => request({
1088
+ method: "POST",
1089
+ path: `/api/experimental/schedule/${encodeURIComponent(input.scheduleID)}/pause`,
1090
+ successStatus: 200,
1091
+ declaredStatuses: [400, 401, 403, 404],
1092
+ empty: false
1093
+ }, requestOptions).then((value) => value.data),
1094
+ resume: (input, requestOptions) => request({
1095
+ method: "POST",
1096
+ path: `/api/experimental/schedule/${encodeURIComponent(input.scheduleID)}/resume`,
1097
+ successStatus: 200,
1098
+ declaredStatuses: [400, 401, 403, 404],
1099
+ empty: false
1100
+ }, requestOptions).then((value) => value.data),
1101
+ delete: (input, requestOptions) => request({
1102
+ method: "DELETE",
1103
+ path: `/api/experimental/schedule/${encodeURIComponent(input.scheduleID)}`,
1104
+ successStatus: 204,
1105
+ declaredStatuses: [400, 401, 403, 404],
1106
+ empty: true
1107
+ }, requestOptions)
1108
+ },
1109
+ artifacts: {
1110
+ providers: (input, requestOptions) => request({
1111
+ method: "GET",
1112
+ path: `/api/experimental/artifacts/providers`,
1113
+ query: { location: input?.["location"] },
1114
+ successStatus: 200,
1115
+ declaredStatuses: [400, 401, 403, 404, 503],
1116
+ empty: false
1117
+ }, requestOptions),
1118
+ list: (input, requestOptions) => request({
1119
+ method: "GET",
1120
+ path: `/api/experimental/artifacts`,
1121
+ query: { location: input?.["location"], sessionID: input?.["sessionID"], provider: input?.["provider"] },
1122
+ successStatus: 200,
1123
+ declaredStatuses: [400, 401, 403, 404, 503],
1124
+ empty: false
1125
+ }, requestOptions),
1126
+ create: (input, requestOptions) => request({
1127
+ method: "POST",
1128
+ path: `/api/experimental/artifacts`,
1129
+ query: { location: input["location"] },
1130
+ body: {
1131
+ title: input["title"],
1132
+ files: input["files"],
1133
+ entry: input["entry"],
1134
+ provider: input["provider"],
1135
+ sessionID: input["sessionID"]
1136
+ },
1137
+ successStatus: 200,
1138
+ declaredStatuses: [400, 401, 403, 404, 503],
1139
+ empty: false
1140
+ }, requestOptions),
1141
+ get: (input, requestOptions) => request({
1142
+ method: "GET",
1143
+ path: `/api/experimental/artifacts/${encodeURIComponent(input.artifactID)}`,
1144
+ query: { location: input["location"] },
1145
+ successStatus: 200,
1146
+ declaredStatuses: [400, 401, 403, 404, 503],
1147
+ empty: false
1148
+ }, requestOptions),
1149
+ update: (input, requestOptions) => request({
1150
+ method: "PATCH",
1151
+ path: `/api/experimental/artifacts/${encodeURIComponent(input.artifactID)}`,
1152
+ query: { location: input["location"] },
1153
+ body: {
1154
+ title: input["title"],
1155
+ files: input["files"],
1156
+ entry: input["entry"],
1157
+ sessionID: input["sessionID"]
1158
+ },
1159
+ successStatus: 200,
1160
+ declaredStatuses: [400, 401, 403, 404, 503],
1161
+ empty: false
1162
+ }, requestOptions),
1163
+ delete: (input, requestOptions) => request({
1164
+ method: "DELETE",
1165
+ path: `/api/experimental/artifacts/${encodeURIComponent(input.artifactID)}`,
1166
+ query: { location: input["location"] },
1167
+ successStatus: 204,
1168
+ declaredStatuses: [400, 401, 403, 404, 503],
1169
+ empty: true
1170
+ }, requestOptions),
1171
+ view: (input, requestOptions) => request({
1172
+ method: "GET",
1173
+ path: `/api/experimental/artifacts/${encodeURIComponent(input.artifactID)}/view/${encodePath(input.path)}`,
1174
+ query: { location: input["location"] },
1175
+ successStatus: 200,
1176
+ declaredStatuses: [400, 401, 403, 404, 503],
1177
+ empty: false,
1178
+ binary: true
1179
+ }, requestOptions)
1180
+ },
1181
+ job: {
1182
+ list: (input, requestOptions) => request({
1183
+ method: "GET",
1184
+ path: `/api/experimental/job`,
1185
+ query: {
1186
+ sessionID: input?.["sessionID"],
1187
+ kind: input?.["kind"],
1188
+ status: input?.["status"],
1189
+ descendants: input?.["descendants"]
1190
+ },
1191
+ successStatus: 200,
1192
+ declaredStatuses: [400, 401, 404],
1193
+ empty: false
1194
+ }, requestOptions).then((value) => value.data)
1195
+ },
1196
+ migration: {
1197
+ v1: {
1198
+ status: (requestOptions) => request({
1199
+ method: "GET",
1200
+ path: `/api/experimental/migration/v1`,
1201
+ successStatus: 200,
1202
+ declaredStatuses: [400, 401],
1203
+ empty: false
1204
+ }, requestOptions)
1205
+ }
1206
+ },
1207
+ usage: {
1208
+ limits: (input, requestOptions) => request({
1209
+ method: "GET",
1210
+ path: `/api/experimental/usage/limits`,
1211
+ query: { location: input?.["location"] },
1212
+ successStatus: 200,
1213
+ declaredStatuses: [400, 401, 404, 503],
1214
+ empty: false
1215
+ }, requestOptions)
1216
+ },
1217
+ config: {
1218
+ update: (input, requestOptions) => request({
1219
+ method: "PATCH",
1220
+ path: `/api/experimental/config`,
1221
+ body: { shell: input["shell"] },
1222
+ successStatus: 204,
1223
+ declaredStatuses: [400, 401, 404],
1224
+ empty: true
1225
+ }, requestOptions)
1226
+ }
1227
+ },
800
1228
  message: {
801
1229
  list: (input, requestOptions) => request({
802
1230
  method: "GET",
@@ -811,9 +1239,9 @@ function make3(options) {
811
1239
  list: (input, requestOptions) => request({
812
1240
  method: "GET",
813
1241
  path: `/api/model`,
814
- query: { location: input?.["location"] },
1242
+ query: { location: input?.["location"], types: input?.["types"] },
815
1243
  successStatus: 200,
816
- declaredStatuses: [400, 401, 503],
1244
+ declaredStatuses: [400, 401, 404, 503],
817
1245
  empty: false
818
1246
  }, requestOptions),
819
1247
  default: (input, requestOptions) => request({
@@ -821,27 +1249,17 @@ function make3(options) {
821
1249
  path: `/api/model/default`,
822
1250
  query: { location: input?.["location"] },
823
1251
  successStatus: 200,
824
- declaredStatuses: [400, 401, 503],
1252
+ declaredStatuses: [400, 401, 404, 503],
825
1253
  empty: false
826
1254
  }, requestOptions)
827
1255
  },
828
- generate: {
829
- text: (input, requestOptions) => request({
830
- method: "POST",
831
- path: `/api/experimental/generate`,
832
- body: { prompt: input["prompt"], model: input["model"] },
833
- successStatus: 200,
834
- declaredStatuses: [400, 401, 503],
835
- empty: false
836
- }, requestOptions).then((value) => value.data)
837
- },
838
1256
  provider: {
839
1257
  list: (input, requestOptions) => request({
840
1258
  method: "GET",
841
1259
  path: `/api/provider`,
842
1260
  query: { location: input?.["location"] },
843
1261
  successStatus: 200,
844
- declaredStatuses: [400, 401, 503],
1262
+ declaredStatuses: [400, 401, 404, 503],
845
1263
  empty: false
846
1264
  }, requestOptions),
847
1265
  get: (input, requestOptions) => request({
@@ -859,7 +1277,7 @@ function make3(options) {
859
1277
  path: `/api/integration`,
860
1278
  query: { location: input?.["location"] },
861
1279
  successStatus: 200,
862
- declaredStatuses: [400, 401],
1280
+ declaredStatuses: [400, 401, 404],
863
1281
  empty: false
864
1282
  }, requestOptions),
865
1283
  get: (input, requestOptions) => request({
@@ -870,17 +1288,6 @@ function make3(options) {
870
1288
  declaredStatuses: [400, 401, 404],
871
1289
  empty: false
872
1290
  }, requestOptions),
873
- wellknown: {
874
- add: (input, requestOptions) => request({
875
- method: "POST",
876
- path: `/api/experimental/integration/wellknown`,
877
- query: { location: input["location"] },
878
- body: { url: input["url"] },
879
- successStatus: 204,
880
- declaredStatuses: [400, 401],
881
- empty: true
882
- }, requestOptions)
883
- },
884
1291
  connect: {
885
1292
  key: (input, requestOptions) => request({
886
1293
  method: "POST",
@@ -890,6 +1297,15 @@ function make3(options) {
890
1297
  successStatus: 204,
891
1298
  declaredStatuses: [400, 401, 404],
892
1299
  empty: true
1300
+ }, requestOptions),
1301
+ external: (input, requestOptions) => request({
1302
+ method: "POST",
1303
+ path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/external`,
1304
+ query: { location: input["location"] },
1305
+ body: { methodID: input["methodID"], answer: input["answer"], label: input["label"] },
1306
+ successStatus: 204,
1307
+ declaredStatuses: [400, 401, 404],
1308
+ empty: true
893
1309
  }, requestOptions)
894
1310
  },
895
1311
  oauth: {
@@ -899,7 +1315,7 @@ function make3(options) {
899
1315
  query: { location: input["location"] },
900
1316
  body: { methodID: input["methodID"], answer: input["answer"], label: input["label"] },
901
1317
  successStatus: 200,
902
- declaredStatuses: [400, 401],
1318
+ declaredStatuses: [400, 401, 404],
903
1319
  empty: false
904
1320
  }, requestOptions),
905
1321
  status: (input, requestOptions) => request({
@@ -924,7 +1340,7 @@ function make3(options) {
924
1340
  path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/oauth/${encodeURIComponent(input.attemptID)}`,
925
1341
  query: { location: input["location"] },
926
1342
  successStatus: 204,
927
- declaredStatuses: [400, 401],
1343
+ declaredStatuses: [400, 401, 404],
928
1344
  empty: true
929
1345
  }, requestOptions)
930
1346
  },
@@ -946,57 +1362,24 @@ function make3(options) {
946
1362
  declaredStatuses: [400, 401, 404],
947
1363
  empty: false
948
1364
  }, requestOptions),
949
- cancel: (input, requestOptions) => request({
950
- method: "DELETE",
951
- path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/command/${encodeURIComponent(input.attemptID)}`,
952
- query: { location: input["location"] },
953
- successStatus: 204,
954
- declaredStatuses: [400, 401],
955
- empty: true
956
- }, requestOptions)
957
- }
958
- },
959
- mcp: {
960
- list: (input, requestOptions) => request({
961
- method: "GET",
962
- path: `/api/mcp`,
963
- query: { location: input?.["location"] },
964
- successStatus: 200,
965
- declaredStatuses: [400, 401],
966
- empty: false
967
- }, requestOptions),
968
- add: (input, requestOptions) => request({
969
- method: "PUT",
970
- path: `/api/experimental/mcp/${encodeURIComponent(input.server)}`,
971
- query: { location: input["location"] },
972
- body: { config: input["config"] },
973
- successStatus: 204,
974
- declaredStatuses: [400, 401],
975
- empty: true
976
- }, requestOptions),
977
- remove: (input, requestOptions) => request({
978
- method: "DELETE",
979
- path: `/api/experimental/mcp/${encodeURIComponent(input.server)}`,
980
- query: { location: input["location"] },
981
- successStatus: 204,
982
- declaredStatuses: [400, 401, 404],
983
- empty: true
984
- }, requestOptions),
985
- connect: (input, requestOptions) => request({
986
- method: "POST",
987
- path: `/api/experimental/mcp/${encodeURIComponent(input.server)}/connect`,
988
- query: { location: input["location"] },
989
- successStatus: 204,
990
- declaredStatuses: [400, 401, 404],
991
- empty: true
992
- }, requestOptions),
993
- disconnect: (input, requestOptions) => request({
994
- method: "POST",
995
- path: `/api/experimental/mcp/${encodeURIComponent(input.server)}/disconnect`,
996
- query: { location: input["location"] },
997
- successStatus: 204,
1365
+ cancel: (input, requestOptions) => request({
1366
+ method: "DELETE",
1367
+ path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/command/${encodeURIComponent(input.attemptID)}`,
1368
+ query: { location: input["location"] },
1369
+ successStatus: 204,
1370
+ declaredStatuses: [400, 401, 404],
1371
+ empty: true
1372
+ }, requestOptions)
1373
+ }
1374
+ },
1375
+ mcp: {
1376
+ list: (input, requestOptions) => request({
1377
+ method: "GET",
1378
+ path: `/api/mcp`,
1379
+ query: { location: input?.["location"] },
1380
+ successStatus: 200,
998
1381
  declaredStatuses: [400, 401, 404],
999
- empty: true
1382
+ empty: false
1000
1383
  }, requestOptions),
1001
1384
  resource: {
1002
1385
  catalog: (input, requestOptions) => request({
@@ -1004,12 +1387,27 @@ function make3(options) {
1004
1387
  path: `/api/mcp/resource`,
1005
1388
  query: { location: input?.["location"] },
1006
1389
  successStatus: 200,
1007
- declaredStatuses: [400, 401],
1390
+ declaredStatuses: [400, 401, 404],
1008
1391
  empty: false
1009
1392
  }, requestOptions)
1010
1393
  }
1011
1394
  },
1012
1395
  credential: {
1396
+ list: (requestOptions) => request({ method: "GET", path: `/api/credential`, successStatus: 200, declaredStatuses: [400, 401], empty: false }, requestOptions).then((value) => value.data),
1397
+ create: (input, requestOptions) => request({
1398
+ method: "POST",
1399
+ path: `/api/credential`,
1400
+ body: {
1401
+ id: input["id"],
1402
+ integrationID: input["integrationID"],
1403
+ label: input["label"],
1404
+ value: input["value"],
1405
+ activate: input["activate"]
1406
+ },
1407
+ successStatus: 200,
1408
+ declaredStatuses: [400, 401, 409],
1409
+ empty: false
1410
+ }, requestOptions).then((value) => value.data),
1013
1411
  update: (input, requestOptions) => request({
1014
1412
  method: "PATCH",
1015
1413
  path: `/api/credential/${encodeURIComponent(input.credentialID)}`,
@@ -1034,7 +1432,14 @@ function make3(options) {
1034
1432
  }, requestOptions)
1035
1433
  },
1036
1434
  project: {
1037
- list: (requestOptions) => request({ method: "GET", path: `/api/project`, successStatus: 200, declaredStatuses: [400, 401], empty: false }, requestOptions),
1435
+ list: (input, requestOptions) => request({
1436
+ method: "GET",
1437
+ path: `/api/project`,
1438
+ query: { archived: input?.["archived"] },
1439
+ successStatus: 200,
1440
+ declaredStatuses: [400, 401],
1441
+ empty: false
1442
+ }, requestOptions),
1038
1443
  update: (input, requestOptions) => request({
1039
1444
  method: "PATCH",
1040
1445
  path: `/api/project/${encodeURIComponent(input.projectID)}`,
@@ -1055,7 +1460,7 @@ function make3(options) {
1055
1460
  path: `/api/form`,
1056
1461
  query: { location: input?.["location"] },
1057
1462
  successStatus: 200,
1058
- declaredStatuses: [400, 401],
1463
+ declaredStatuses: [400, 401, 404],
1059
1464
  empty: false
1060
1465
  }, requestOptions)
1061
1466
  },
@@ -1066,7 +1471,7 @@ function make3(options) {
1066
1471
  path: `/api/permission/request`,
1067
1472
  query: { location: input?.["location"] },
1068
1473
  successStatus: 200,
1069
- declaredStatuses: [400, 401],
1474
+ declaredStatuses: [400, 401, 404],
1070
1475
  empty: false
1071
1476
  }, requestOptions)
1072
1477
  },
@@ -1076,7 +1481,15 @@ function make3(options) {
1076
1481
  path: `/api/permission/saved`,
1077
1482
  query: { projectID: input?.["projectID"] },
1078
1483
  successStatus: 200,
1079
- declaredStatuses: [400, 401],
1484
+ declaredStatuses: [400, 401, 404],
1485
+ empty: false
1486
+ }, requestOptions).then((value) => value.data),
1487
+ update: (input, requestOptions) => request({
1488
+ method: "PATCH",
1489
+ path: `/api/permission/saved/${encodeURIComponent(input.id)}`,
1490
+ body: { action: input["action"], resource: input["resource"] },
1491
+ successStatus: 200,
1492
+ declaredStatuses: [400, 401, 404, 409],
1080
1493
  empty: false
1081
1494
  }, requestOptions).then((value) => value.data),
1082
1495
  remove: (input, requestOptions) => request({
@@ -1141,7 +1554,7 @@ function make3(options) {
1141
1554
  path: `/api/fs/list`,
1142
1555
  query: { location: input?.["location"], path: input?.["path"] },
1143
1556
  successStatus: 200,
1144
- declaredStatuses: [400, 401],
1557
+ declaredStatuses: [400, 401, 404],
1145
1558
  empty: false
1146
1559
  }, requestOptions),
1147
1560
  find: (input, requestOptions) => request({
@@ -1149,18 +1562,8 @@ function make3(options) {
1149
1562
  path: `/api/fs/find`,
1150
1563
  query: { location: input["location"], query: input["query"], type: input["type"], limit: input["limit"] },
1151
1564
  successStatus: 200,
1152
- declaredStatuses: [400, 401],
1565
+ declaredStatuses: [400, 401, 404],
1153
1566
  empty: false
1154
- }, requestOptions),
1155
- write: (input, requestOptions) => request({
1156
- method: "POST",
1157
- path: `/api/experimental/fs/write`,
1158
- query: { location: input["location"], path: input["path"] },
1159
- body: input["payload"],
1160
- successStatus: 200,
1161
- declaredStatuses: [400, 401],
1162
- empty: false,
1163
- binaryBody: true
1164
1567
  }, requestOptions)
1165
1568
  },
1166
1569
  command: {
@@ -1169,7 +1572,7 @@ function make3(options) {
1169
1572
  path: `/api/command`,
1170
1573
  query: { location: input?.["location"] },
1171
1574
  successStatus: 200,
1172
- declaredStatuses: [400, 401],
1575
+ declaredStatuses: [400, 401, 404],
1173
1576
  empty: false
1174
1577
  }, requestOptions)
1175
1578
  },
@@ -1179,7 +1582,7 @@ function make3(options) {
1179
1582
  path: `/api/skill`,
1180
1583
  query: { location: input?.["location"] },
1181
1584
  successStatus: 200,
1182
- declaredStatuses: [400, 401],
1585
+ declaredStatuses: [400, 401, 404],
1183
1586
  empty: false
1184
1587
  }, requestOptions)
1185
1588
  },
@@ -1190,12 +1593,19 @@ function make3(options) {
1190
1593
  query: { location: input["location"] },
1191
1594
  body: { input: input["input"] },
1192
1595
  successStatus: 200,
1193
- declaredStatuses: [400, 401, 500],
1596
+ declaredStatuses: [400, 401, 404, 500],
1194
1597
  empty: false
1195
1598
  }, requestOptions)
1196
1599
  },
1197
1600
  event: {
1198
- subscribe: (requestOptions) => sse({ method: "GET", path: `/api/event`, successStatus: 200, declaredStatuses: [400, 401], empty: false }, requestOptions)
1601
+ subscribe: (input, requestOptions) => sse({
1602
+ method: "GET",
1603
+ path: `/api/event`,
1604
+ query: { types: input?.["types"] },
1605
+ successStatus: 200,
1606
+ declaredStatuses: [400, 401],
1607
+ empty: false
1608
+ }, requestOptions)
1199
1609
  },
1200
1610
  pty: {
1201
1611
  list: (input, requestOptions) => request({
@@ -1203,7 +1613,7 @@ function make3(options) {
1203
1613
  path: `/api/pty`,
1204
1614
  query: { location: input?.["location"] },
1205
1615
  successStatus: 200,
1206
- declaredStatuses: [400, 401],
1616
+ declaredStatuses: [400, 401, 404],
1207
1617
  empty: false
1208
1618
  }, requestOptions),
1209
1619
  create: (input, requestOptions) => request({
@@ -1218,7 +1628,7 @@ function make3(options) {
1218
1628
  env: input?.["env"]
1219
1629
  },
1220
1630
  successStatus: 200,
1221
- declaredStatuses: [400, 401],
1631
+ declaredStatuses: [400, 401, 404],
1222
1632
  empty: false
1223
1633
  }, requestOptions),
1224
1634
  get: (input, requestOptions) => request({
@@ -1258,98 +1668,13 @@ function make3(options) {
1258
1668
  }, requestOptions)
1259
1669
  }
1260
1670
  },
1261
- experimental: {
1262
- persistentPty: {
1263
- read: (input, requestOptions) => request({
1264
- method: "GET",
1265
- path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/terminal/read`,
1266
- query: { lines: input["lines"] },
1267
- successStatus: 200,
1268
- declaredStatuses: [400, 401, 503],
1269
- empty: false
1270
- }, requestOptions).then((value) => value.data),
1271
- list: (input, requestOptions) => request({
1272
- method: "GET",
1273
- path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/terminal`,
1274
- successStatus: 200,
1275
- declaredStatuses: [400, 401, 503],
1276
- empty: false
1277
- }, requestOptions).then((value) => value.data),
1278
- create: (input, requestOptions) => request({
1279
- method: "POST",
1280
- path: `/api/experimental/session/${encodeURIComponent(input.sessionID)}/terminal`,
1281
- body: {
1282
- command: input["command"],
1283
- args: input["args"],
1284
- cwd: input["cwd"],
1285
- title: input["title"],
1286
- env: input["env"],
1287
- size: input["size"]
1288
- },
1289
- successStatus: 200,
1290
- declaredStatuses: [400, 401, 503],
1291
- empty: false
1292
- }, requestOptions).then((value) => value.data),
1293
- shutdown: (requestOptions) => request({
1294
- method: "POST",
1295
- path: `/api/experimental/persistent-pty/shutdown`,
1296
- successStatus: 204,
1297
- declaredStatuses: [400, 401, 503],
1298
- empty: true
1299
- }, requestOptions),
1300
- handoff: (requestOptions) => request({
1301
- method: "POST",
1302
- path: `/api/experimental/persistent-pty/handoff`,
1303
- successStatus: 200,
1304
- declaredStatuses: [400, 401, 503],
1305
- empty: false
1306
- }, requestOptions),
1307
- get: (input, requestOptions) => request({
1308
- method: "GET",
1309
- path: `/api/experimental/persistent-pty/${encodeURIComponent(input.ptyID)}`,
1310
- successStatus: 200,
1311
- declaredStatuses: [400, 401, 404, 503],
1312
- empty: false
1313
- }, requestOptions).then((value) => value.data),
1314
- update: (input, requestOptions) => request({
1315
- method: "PUT",
1316
- path: `/api/experimental/persistent-pty/${encodeURIComponent(input.ptyID)}`,
1317
- body: { attachmentID: input["attachmentID"], size: input["size"] },
1318
- successStatus: 200,
1319
- declaredStatuses: [400, 401, 404, 503],
1320
- empty: false
1321
- }, requestOptions).then((value) => value.data),
1322
- snapshot: (input, requestOptions) => request({
1323
- method: "GET",
1324
- path: `/api/experimental/persistent-pty/${encodeURIComponent(input.ptyID)}/snapshot`,
1325
- successStatus: 200,
1326
- declaredStatuses: [400, 401, 404, 503],
1327
- empty: false
1328
- }, requestOptions).then((value) => value.data),
1329
- remove: (input, requestOptions) => request({
1330
- method: "DELETE",
1331
- path: `/api/experimental/persistent-pty/${encodeURIComponent(input.ptyID)}`,
1332
- successStatus: 204,
1333
- declaredStatuses: [400, 401, 404, 503],
1334
- empty: true
1335
- }, requestOptions),
1336
- connectToken: (input, requestOptions) => request({
1337
- method: "POST",
1338
- path: `/api/experimental/persistent-pty/${encodeURIComponent(input.ptyID)}/connect-token`,
1339
- headers: { "x-opencode-ticket": input["x-opencode-ticket"] },
1340
- successStatus: 200,
1341
- declaredStatuses: [400, 401, 403, 404, 503],
1342
- empty: false
1343
- }, requestOptions).then((value) => value.data)
1344
- }
1345
- },
1346
1671
  shell: {
1347
1672
  list: (input, requestOptions) => request({
1348
1673
  method: "GET",
1349
1674
  path: `/api/shell`,
1350
1675
  query: { location: input?.["location"] },
1351
1676
  successStatus: 200,
1352
- declaredStatuses: [400, 401],
1677
+ declaredStatuses: [400, 401, 404],
1353
1678
  empty: false
1354
1679
  }, requestOptions),
1355
1680
  create: (input, requestOptions) => request({
@@ -1363,7 +1688,7 @@ function make3(options) {
1363
1688
  metadata: input["metadata"]
1364
1689
  },
1365
1690
  successStatus: 200,
1366
- declaredStatuses: [400, 401],
1691
+ declaredStatuses: [400, 401, 404],
1367
1692
  empty: false
1368
1693
  }, requestOptions),
1369
1694
  get: (input, requestOptions) => request({
@@ -1387,7 +1712,7 @@ function make3(options) {
1387
1712
  path: `/api/shell/${encodeURIComponent(input.id)}`,
1388
1713
  query: { location: input["location"] },
1389
1714
  successStatus: 204,
1390
- declaredStatuses: [400, 401],
1715
+ declaredStatuses: [400, 401, 404],
1391
1716
  empty: true
1392
1717
  }, requestOptions)
1393
1718
  },
@@ -1397,7 +1722,7 @@ function make3(options) {
1397
1722
  path: `/api/reference`,
1398
1723
  query: { location: input?.["location"] },
1399
1724
  successStatus: 200,
1400
- declaredStatuses: [400, 401],
1725
+ declaredStatuses: [400, 401, 404],
1401
1726
  empty: false
1402
1727
  }, requestOptions)
1403
1728
  },
@@ -1442,12 +1767,20 @@ function make3(options) {
1442
1767
  }, requestOptions)
1443
1768
  },
1444
1769
  vcs: {
1770
+ init: (input, requestOptions) => request({
1771
+ method: "POST",
1772
+ path: `/api/vcs/init`,
1773
+ query: { location: input?.["location"], provider: input?.["provider"] },
1774
+ successStatus: 204,
1775
+ declaredStatuses: [400, 401, 404, 409, 501, 503],
1776
+ empty: true
1777
+ }, requestOptions),
1445
1778
  get: (input, requestOptions) => request({
1446
1779
  method: "GET",
1447
1780
  path: `/api/vcs`,
1448
1781
  query: { location: input?.["location"] },
1449
1782
  successStatus: 200,
1450
- declaredStatuses: [400, 401],
1783
+ declaredStatuses: [400, 401, 404],
1451
1784
  empty: false
1452
1785
  }, requestOptions),
1453
1786
  base: (input, requestOptions) => request({
@@ -1455,7 +1788,7 @@ function make3(options) {
1455
1788
  path: `/api/vcs/base`,
1456
1789
  query: { location: input?.["location"] },
1457
1790
  successStatus: 200,
1458
- declaredStatuses: [400, 401, 503],
1791
+ declaredStatuses: [400, 401, 404, 503],
1459
1792
  empty: false
1460
1793
  }, requestOptions),
1461
1794
  status: (input, requestOptions) => request({
@@ -1463,7 +1796,7 @@ function make3(options) {
1463
1796
  path: `/api/vcs/status`,
1464
1797
  query: { location: input?.["location"] },
1465
1798
  successStatus: 200,
1466
- declaredStatuses: [400, 401],
1799
+ declaredStatuses: [400, 401, 404],
1467
1800
  empty: false
1468
1801
  }, requestOptions),
1469
1802
  branch: {
@@ -1472,20 +1805,34 @@ function make3(options) {
1472
1805
  path: `/api/vcs/branch`,
1473
1806
  query: { location: input?.["location"], search: input?.["search"], limit: input?.["limit"] },
1474
1807
  successStatus: 200,
1475
- declaredStatuses: [400, 401],
1808
+ declaredStatuses: [400, 401, 404],
1476
1809
  empty: false
1477
1810
  }, requestOptions)
1478
1811
  },
1479
1812
  diff: (input, requestOptions) => request({
1480
1813
  method: "GET",
1481
1814
  path: `/api/vcs/diff`,
1482
- query: { location: input["location"], mode: input["mode"], base: input["base"], context: input["context"] },
1815
+ query: {
1816
+ location: input["location"],
1817
+ mode: input["mode"],
1818
+ base: input["base"],
1819
+ context: input["context"],
1820
+ untracked: input["untracked"]
1821
+ },
1483
1822
  successStatus: 200,
1484
- declaredStatuses: [400, 401, 503],
1823
+ declaredStatuses: [400, 401, 404, 503],
1485
1824
  empty: false
1486
1825
  }, requestOptions)
1487
1826
  },
1488
1827
  debug: {
1828
+ heapDump: (input, requestOptions) => request({
1829
+ method: "POST",
1830
+ path: `/api/debug/heap-dump`,
1831
+ query: { directory: input?.["directory"] },
1832
+ successStatus: 200,
1833
+ declaredStatuses: [400, 401, 500],
1834
+ empty: false
1835
+ }, requestOptions),
1489
1836
  location: {
1490
1837
  list: (requestOptions) => request({
1491
1838
  method: "GET",
@@ -1504,24 +1851,13 @@ function make3(options) {
1504
1851
  }, requestOptions)
1505
1852
  }
1506
1853
  },
1507
- migration: {
1508
- v1: {
1509
- status: (requestOptions) => request({
1510
- method: "GET",
1511
- path: `/api/experimental/migration/v1`,
1512
- successStatus: 200,
1513
- declaredStatuses: [400, 401],
1514
- empty: false
1515
- }, requestOptions)
1516
- }
1517
- },
1518
1854
  websearch: {
1519
1855
  providers: (input, requestOptions) => request({
1520
1856
  method: "GET",
1521
1857
  path: `/api/websearch/provider`,
1522
1858
  query: { location: input?.["location"] },
1523
1859
  successStatus: 200,
1524
- declaredStatuses: [400, 401, 503],
1860
+ declaredStatuses: [400, 401, 404, 503],
1525
1861
  empty: false
1526
1862
  }, requestOptions),
1527
1863
  query: (input, requestOptions) => request({
@@ -1530,7 +1866,7 @@ function make3(options) {
1530
1866
  query: { location: input["location"] },
1531
1867
  body: { query: input["query"], providerID: input["providerID"] },
1532
1868
  successStatus: 200,
1533
- declaredStatuses: [400, 401, 503],
1869
+ declaredStatuses: [400, 401, 404, 503],
1534
1870
  empty: false
1535
1871
  }, requestOptions)
1536
1872
  },
@@ -1540,20 +1876,80 @@ function make3(options) {
1540
1876
  path: `/api/config`,
1541
1877
  query: { location: input?.["location"] },
1542
1878
  successStatus: 200,
1543
- declaredStatuses: [400, 401],
1879
+ declaredStatuses: [400, 401, 404],
1544
1880
  empty: false
1545
1881
  }, requestOptions),
1546
- shells: (requestOptions) => request({ method: "GET", path: `/api/config/shell`, successStatus: 200, declaredStatuses: [400, 401], empty: false }, requestOptions),
1547
- update: (input, requestOptions) => request({
1548
- method: "PATCH",
1549
- path: `/api/experimental/config`,
1550
- body: { shell: input["shell"] },
1551
- successStatus: 204,
1552
- declaredStatuses: [400, 401],
1553
- empty: true
1882
+ shells: (requestOptions) => request({
1883
+ method: "GET",
1884
+ path: `/api/config/shell`,
1885
+ successStatus: 200,
1886
+ declaredStatuses: [400, 401, 404],
1887
+ empty: false
1554
1888
  }, requestOptions)
1555
1889
  }
1556
1890
  };
1891
+ return {
1892
+ ...client,
1893
+ session: {
1894
+ ...client.session,
1895
+ stats: client.experimental.session.stats,
1896
+ import: client.experimental.session.import,
1897
+ export: client.experimental.session.export,
1898
+ skill: client.experimental.session.skill,
1899
+ wait: client.experimental.session.wait,
1900
+ instructions: {
1901
+ entry: {
1902
+ list: client.experimental.session.instructions.entry.list,
1903
+ put: client.experimental.session.instructions.entry.put,
1904
+ remove: client.experimental.session.instructions.entry.remove
1905
+ }
1906
+ },
1907
+ log: client.experimental.session.log
1908
+ },
1909
+ generate: {
1910
+ text: client.experimental.generate.text,
1911
+ image: client.experimental.generate.image,
1912
+ decisions: client.experimental.generate.decisions
1913
+ },
1914
+ voice: {
1915
+ models: client.experimental.voice.models,
1916
+ session: client.experimental.voice.session
1917
+ },
1918
+ integration: {
1919
+ ...client.integration,
1920
+ wellknown: {
1921
+ add: client.experimental.integration.wellknown.add
1922
+ }
1923
+ },
1924
+ mcp: {
1925
+ ...client.mcp,
1926
+ add: client.experimental.mcp.add,
1927
+ remove: client.experimental.mcp.remove,
1928
+ connect: client.experimental.mcp.connect,
1929
+ disconnect: client.experimental.mcp.disconnect,
1930
+ client: {
1931
+ token: client.experimental.mcp.client.token
1932
+ }
1933
+ },
1934
+ file: {
1935
+ ...client.file,
1936
+ write: client.experimental.file.write,
1937
+ watch: client.experimental.file.watch,
1938
+ unwatch: client.experimental.file.unwatch
1939
+ },
1940
+ migration: {
1941
+ v1: {
1942
+ status: client.experimental.migration.v1.status
1943
+ }
1944
+ },
1945
+ usage: {
1946
+ limits: client.experimental.usage.limits
1947
+ },
1948
+ config: {
1949
+ ...client.config,
1950
+ update: client.experimental.config.update
1951
+ }
1952
+ };
1557
1953
  }
1558
1954
  function encodePath(value) {
1559
1955
  return value.split("/").map(encodeURIComponent).join("/");
@@ -1582,20 +1978,20 @@ async function json(response) {
1582
1978
  try {
1583
1979
  await response.body?.cancel();
1584
1980
  } catch {}
1585
- throw new ClientError2("UnsupportedContentType", { detail: response.headers.get("content-type") });
1981
+ throw new ClientError3("UnsupportedContentType", { detail: response.headers.get("content-type") });
1586
1982
  }
1587
1983
  let text;
1588
1984
  try {
1589
1985
  text = await response.text();
1590
1986
  } catch (cause) {
1591
- throw new ClientError2("Transport", { cause });
1987
+ throw new ClientError3("Transport", { cause });
1592
1988
  }
1593
1989
  if (text === "")
1594
- throw new ClientError2("MalformedResponse");
1990
+ throw new ClientError3("MalformedResponse");
1595
1991
  try {
1596
1992
  return JSON.parse(text);
1597
1993
  } catch (cause) {
1598
- throw new ClientError2("MalformedResponse", { cause });
1994
+ throw new ClientError3("MalformedResponse", { cause });
1599
1995
  }
1600
1996
  }
1601
1997
  function declared(body) {
@@ -1608,11 +2004,11 @@ function isContentType(response, expected) {
1608
2004
  return response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase() === expected;
1609
2005
  }
1610
2006
 
1611
- // ../../node_modules/.bun/@opencode+client@2.0.19+43902b222b0d7d3e/node_modules/@opencode/client/dist/chunks/rpc-runtime-4tveyqeh.js
2007
+ // ../../node_modules/.bun/@opencode+client@2.2.6+307d8a970cbb91e6/node_modules/@opencode/client/dist/chunks/contract-sdjh9vmn.js
1612
2008
  var isRpcError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "RpcError";
1613
2009
  var isRpcInternalError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "RpcInternalError";
1614
2010
 
1615
- // ../../node_modules/.bun/@opencode+client@2.0.19+43902b222b0d7d3e/node_modules/@opencode/client/dist/chunks/rpc-runtime-1tbj6z39.js
2011
+ // ../../node_modules/.bun/@opencode+client@2.2.6+307d8a970cbb91e6/node_modules/@opencode/client/dist/chunks/contract-xqwq6bgr.js
1616
2012
  function makeRpc2(raw, events) {
1617
2013
  return (definition) => {
1618
2014
  const subscribe = (name, options) => {
@@ -1687,15 +2083,15 @@ function eventType(definition, name) {
1687
2083
  return `rpc.${definition.id}.${name}`;
1688
2084
  }
1689
2085
 
1690
- // ../../node_modules/.bun/@opencode+client@2.0.19+43902b222b0d7d3e/node_modules/@opencode/client/dist/chunks/rpc-runtime-gc472t4a.js
1691
- var exports_client = {};
1692
- __export(exports_client, {
1693
- OpenCode: () => exports_client,
1694
- make: () => make2
2086
+ // ../../node_modules/.bun/@opencode+client@2.2.6+307d8a970cbb91e6/node_modules/@opencode/client/dist/chunks/contract-xby11z3y.js
2087
+ var exports_client3 = {};
2088
+ __export(exports_client3, {
2089
+ OpenCode: () => exports_client3,
2090
+ make: () => make5
1695
2091
  });
1696
- function make2(options) {
1697
- const raw = make3(options);
1698
- const events = make7((signal, onActivity) => raw.event.subscribe({ signal, onActivity }));
2092
+ function make5(options) {
2093
+ const raw = make6(options);
2094
+ const events = make7((signal, onActivity) => raw.event.subscribe(undefined, { signal, onActivity }));
1699
2095
  return {
1700
2096
  ...raw,
1701
2097
  rpc: Object.assign(makeRpc2(raw, events), raw.rpc),
@@ -1722,7 +2118,7 @@ function authorizationHeader(password) {
1722
2118
  }
1723
2119
  function createOpencodeClient(target) {
1724
2120
  const send = target.fetch ?? fetch;
1725
- return exports_client.make({
2121
+ return exports_client3.make({
1726
2122
  baseUrl: target.url,
1727
2123
  headers: { ...target.headers, ...authorizationHeader(target.password) },
1728
2124
  fetch: async (input, init) => {
@@ -1735,7 +2131,7 @@ function createOpencodeClient(target) {
1735
2131
  });
1736
2132
  }
1737
2133
  function unwrapClientError(error) {
1738
- return error instanceof ClientError2 && error.reason === "Transport" && error.cause !== undefined ? error.cause : error;
2134
+ return error instanceof ClientError3 && error.reason === "Transport" && error.cause !== undefined ? error.cause : error;
1739
2135
  }
1740
2136
  async function call(operation) {
1741
2137
  try {
@@ -1773,11 +2169,10 @@ function asStringArray(value) {
1773
2169
  function parseModelRef(model) {
1774
2170
  if (!model)
1775
2171
  return;
1776
- const separator = model.indexOf("/");
1777
- if (separator <= 0 || separator === model.length - 1) {
1778
- throw new Error('model must use the "provider/model" format');
1779
- }
1780
- return { providerID: model.slice(0, separator), modelID: model.slice(separator + 1) };
2172
+ const match = /^([^/#]+)\/([^#]+)(?:#([^#]+))?$/.exec(model);
2173
+ if (!match)
2174
+ throw new Error('model must use the "provider/model" format with an optional #variant');
2175
+ return { providerID: match[1], modelID: match[2], ...match[3] ? { variant: match[3] } : {} };
1781
2176
  }
1782
2177
  function permissionTitle(permission, patterns) {
1783
2178
  return patterns.length > 0 ? `${permission}: ${patterns.join(", ")}` : permission;
@@ -1803,29 +2198,51 @@ function truncateToolOutput(value) {
1803
2198
  }
1804
2199
 
1805
2200
  // ../agent-runtime/src/v2.ts
2201
+ var MODEL_READY_MS = 30000;
1806
2202
  function createV2Runtime(target) {
1807
2203
  const client = createOpencodeClient(target);
1808
2204
  const options = () => requestTimeout(target.signal);
1809
2205
  async function switchSessionOptions(sessionID, agent, model) {
1810
2206
  const modelRef = parseModelRef(model);
1811
2207
  if (modelRef) {
1812
- await call(client.session.switchModel({ sessionID, model: { providerID: modelRef.providerID, id: modelRef.modelID } }, options()));
2208
+ await call(client.session.switchModel({
2209
+ sessionID,
2210
+ model: {
2211
+ providerID: modelRef.providerID,
2212
+ id: modelRef.modelID,
2213
+ variant: modelRef.variant
2214
+ }
2215
+ }, options()));
1813
2216
  }
1814
2217
  if (agent)
1815
2218
  await call(client.session.switchAgent({ sessionID, agent }, options()));
1816
2219
  }
2220
+ async function modelReady(model) {
2221
+ const deadline = Date.now() + MODEL_READY_MS;
2222
+ for (;; ) {
2223
+ const { data } = await call(client.model.list({ location: { directory: target.directory } }, options()));
2224
+ if (data.some((entry) => entry.providerID === model.providerID && entry.id === model.modelID))
2225
+ return;
2226
+ if (Date.now() >= deadline)
2227
+ throw new Error(`OpenCode does not offer ${model.providerID}/${model.modelID}; check the model ID and its credential`);
2228
+ await new Promise((resolve) => setTimeout(resolve, 500));
2229
+ }
2230
+ }
1817
2231
  return {
1818
2232
  async createSession(input) {
1819
2233
  const modelRef = parseModelRef(input.model);
1820
2234
  const created = await call(client.session.create({
1821
2235
  title: input.title,
1822
2236
  agent: input.agent,
1823
- model: modelRef ? { providerID: modelRef.providerID, id: modelRef.modelID } : undefined,
2237
+ model: modelRef ? { providerID: modelRef.providerID, id: modelRef.modelID, variant: modelRef.variant } : undefined,
1824
2238
  location: { directory: target.directory }
1825
2239
  }, options()));
1826
2240
  return { id: created.id, title: created.title ?? input.title ?? "Agent run" };
1827
2241
  },
1828
2242
  async prompt(input) {
2243
+ const modelRef = parseModelRef(input.model);
2244
+ if (modelRef)
2245
+ await modelReady(modelRef);
1829
2246
  await switchSessionOptions(input.sessionId, input.agent, input.model);
1830
2247
  await call(client.session.prompt({
1831
2248
  sessionID: input.sessionId,
@@ -2542,9 +2959,29 @@ function directRunOperations(assertWorkspace, fetchImpl) {
2542
2959
  };
2543
2960
  }
2544
2961
 
2545
- // src/direct/ascii.ts
2962
+ // src/direct/boat.ts
2546
2963
  import { BoxApi, Configuration, waitUntilReady } from "@asciidev/box-sdk";
2547
2964
 
2965
+ // ../agent-runtime/src/opencode-config.ts
2966
+ function buildOpencodeConfig(input, extraPlugins = []) {
2967
+ const config = { ...input };
2968
+ const configured = Array.isArray(config.plugins) ? config.plugins : [];
2969
+ const names = new Set(configured.map((entry) => typeof entry === "string" ? entry : entry?.package));
2970
+ const plugins = [...configured, ...extraPlugins.filter((name) => !names.has(name))];
2971
+ delete config.theme;
2972
+ return {
2973
+ $schema: "https://opencode.ai/config.json",
2974
+ ...config,
2975
+ ...plugins.length ? { plugins } : {}
2976
+ };
2977
+ }
2978
+ function buildOpencodeCliConfig(input) {
2979
+ return {
2980
+ $schema: "https://opencode.ai/v2/cli.json",
2981
+ theme: { name: typeof input?.theme === "string" ? input.theme : "opencode" }
2982
+ };
2983
+ }
2984
+
2548
2985
  // ../agent-runtime/src/github-auth.ts
2549
2986
  var GITHUB_AUTH_PATH = 'export PATH="$HOME/.gitterm/bin:$PATH"';
2550
2987
  var GITHUB_CLI_INSTRUCTIONS = `GitHub CLI authentication:
@@ -3114,22 +3551,13 @@ function buildDirectProvisioningPlan(input) {
3114
3551
  value: directModelAuth(credential)
3115
3552
  });
3116
3553
  }
3117
- const configuredPlugins = Array.isArray(input.opencode?.config?.plugin) ? input.opencode.config.plugin.filter((plugin) => typeof plugin === "string") : [];
3118
- const plugins = [...new Set([...configuredPlugins, ...input.opencode?.plugins ?? []])];
3119
3554
  const environmentVariables = { ...input.environmentVariables };
3120
3555
  delete environmentVariables.OPENCODE_SERVER_USERNAME;
3121
3556
  delete environmentVariables.GITTERM_DIRECT_PROVIDER;
3122
- const userPermission = input.opencode?.config?.permission && typeof input.opencode.config.permission === "object" && !Array.isArray(input.opencode.config.permission) ? input.opencode.config.permission : {};
3123
3557
  const config = {
3124
- $schema: "https://opencode.ai/config.json",
3125
- ...input.opencode?.config,
3558
+ ...buildOpencodeConfig(input.opencode?.config, input.opencode?.plugins),
3126
3559
  ...input.models?.default ? { model: input.models.default } : {},
3127
- username: "Gitterm direct",
3128
- permission: {
3129
- external_directory: "allow",
3130
- ...userPermission
3131
- },
3132
- ...plugins.length ? { plugin: plugins } : {}
3560
+ username: "Gitterm direct"
3133
3561
  };
3134
3562
  const github = githubAuthProvisioning(input.repo ? {
3135
3563
  url: input.repo,
@@ -3144,6 +3572,10 @@ function buildDirectProvisioningPlan(input) {
3144
3572
  path: "~/.config/opencode/opencode.json",
3145
3573
  contentBase64: base64(JSON.stringify(config))
3146
3574
  },
3575
+ {
3576
+ path: "~/.config/opencode/cli.json",
3577
+ contentBase64: base64(JSON.stringify(buildOpencodeCliConfig(input.opencode?.config)))
3578
+ },
3147
3579
  {
3148
3580
  path: "~/.config/opencode/AGENTS.md",
3149
3581
  contentBase64: base64(buildDirectGittermInstructions(input.additionalAgentInstructions))
@@ -3177,7 +3609,7 @@ function buildDirectProvisioningPlan(input) {
3177
3609
  files,
3178
3610
  environmentVariables: {
3179
3611
  ...environmentVariables,
3180
- OPENCODE_SERVER_PASSWORD: input.password
3612
+ OPENCODE_PASSWORD: input.password
3181
3613
  },
3182
3614
  command: github ? githubAuthCommand(DIRECT_OPENCODE_COMMAND) : DIRECT_OPENCODE_COMMAND,
3183
3615
  port: DIRECT_OPENCODE_PORT
@@ -3288,7 +3720,7 @@ async function waitForDirectRuntime(runtime, timeoutMs = 60000) {
3288
3720
  throw new Error("Timed out waiting for the OpenCode runtime");
3289
3721
  }
3290
3722
 
3291
- // src/direct/ascii.ts
3723
+ // src/direct/boat.ts
3292
3724
  var HOME = "/home/user";
3293
3725
  function serializeHandle(handle) {
3294
3726
  return JSON.stringify(handle);
@@ -3301,12 +3733,12 @@ function parseHandle(value) {
3301
3733
  }
3302
3734
  return handle;
3303
3735
  } catch {
3304
- throw new Error("Invalid Ascii Box direct workspace handle");
3736
+ throw new Error("Invalid Boat direct workspace handle");
3305
3737
  }
3306
3738
  }
3307
- function createAsciiDirectProvider(config) {
3739
+ function createBoatDirectProvider(config) {
3308
3740
  if (!config.apiKey.trim())
3309
- throw new Error("Ascii apiKey is required");
3741
+ throw new Error("Boat apiKey is required");
3310
3742
  const client = new BoxApi(new Configuration({
3311
3743
  basePath: "https://ascii.dev/api/box/v1",
3312
3744
  accessToken: config.apiKey
@@ -3317,10 +3749,10 @@ function createAsciiDirectProvider(config) {
3317
3749
  commandRequest: { command, cwd, timeoutSeconds }
3318
3750
  });
3319
3751
  if (result.type !== "command.finished") {
3320
- throw new Error("Ascii Box command did not finish");
3752
+ throw new Error("Boat command did not finish");
3321
3753
  }
3322
3754
  if (!result.success || result.exitCode !== 0) {
3323
- throw new Error(`Ascii Box command failed: ${result.stderr || result.stdout}`);
3755
+ throw new Error(`Boat command failed: ${result.stderr || result.stdout}`);
3324
3756
  }
3325
3757
  return result.stdout;
3326
3758
  }
@@ -3332,7 +3764,7 @@ function createAsciiDirectProvider(config) {
3332
3764
  const output = await runCommand(handle.boxId, `host url ${handle.serve.port}`);
3333
3765
  const value = output.match(/https:\/\/\S+/)?.[0];
3334
3766
  if (!value) {
3335
- throw new Error(`Ascii Box did not return a hosted URL for port ${handle.serve.port}`);
3767
+ throw new Error(`Boat did not return a hosted URL for port ${handle.serve.port}`);
3336
3768
  }
3337
3769
  const hosted = new URL(value);
3338
3770
  hosted.search = "";
@@ -3344,11 +3776,11 @@ function createAsciiDirectProvider(config) {
3344
3776
  headers: { Authorization: `Bearer ${config.apiKey}`, "X-Ascii-Confirm-Delete": boxId }
3345
3777
  });
3346
3778
  if (!response.ok && response.status !== 404) {
3347
- throw new Error(`Ascii Box deletion failed (${response.status})`);
3779
+ throw new Error(`Boat deletion failed (${response.status})`);
3348
3780
  }
3349
3781
  }
3350
3782
  return {
3351
- name: "ascii",
3783
+ name: "boat",
3352
3784
  capabilities: {
3353
3785
  persistence: "supported",
3354
3786
  recommendedLifecycle: "ephemeral",
@@ -4504,8 +4936,8 @@ function resolveProvider(provider) {
4504
4936
  if ("create" in provider)
4505
4937
  return provider;
4506
4938
  switch (provider.type) {
4507
- case "ascii":
4508
- return createAsciiDirectProvider(provider);
4939
+ case "boat":
4940
+ return createBoatDirectProvider(provider);
4509
4941
  case "daytona":
4510
4942
  return createDaytonaDirectProvider(provider);
4511
4943
  case "e2b":
@@ -4543,7 +4975,7 @@ function validateEnvironmentVariables(values) {
4543
4975
  if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) {
4544
4976
  throw new Error(`Invalid environment variable name: ${key}`);
4545
4977
  }
4546
- if (key === "OPENCODE_SERVER_PASSWORD" || key === "OPENCODE_SERVER_USERNAME" || key === "GITTERM_DIRECT_PROVIDER") {
4978
+ if (key === "OPENCODE_PASSWORD" || key === "OPENCODE_SERVER_PASSWORD" || key === "OPENCODE_SERVER_USERNAME" || key === "GITTERM_DIRECT_PROVIDER") {
4547
4979
  throw new Error(`Environment variable ${key} is managed by Gitterm`);
4548
4980
  }
4549
4981
  }
@@ -4922,7 +5354,7 @@ ${status.log}` : ""}`);
4922
5354
  };
4923
5355
  }
4924
5356
  export {
4925
- createAsciiDirectProvider,
5357
+ createBoatDirectProvider,
4926
5358
  createDaytonaDirectProvider,
4927
5359
  createDirectGittermClient,
4928
5360
  createE2BDirectProvider,