@codemem/core 0.46.0 → 0.46.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.
@@ -0,0 +1,1998 @@
1
+ import { t as e } from "./service-contender-9rqn6x4v-pocTjwT1.js";
2
+ //#region ../../node_modules/.pnpm/@opencode+client@2.0.12_effect@4.0.0-rc.112/node_modules/@opencode/client/dist/chunks/service-contender-frbwqjmf.js
3
+ var t = {};
4
+ e(t, {
5
+ SharedEvents: () => t,
6
+ make: () => n
7
+ });
8
+ function n(e) {
9
+ let t, n = 4096;
10
+ function r(e) {
11
+ e.connected = void 0, e.controller.abort(), t === e && (t = void 0);
12
+ }
13
+ async function i(t) {
14
+ let n, i = {};
15
+ try {
16
+ if (t.controller.signal.aborted) return;
17
+ for (n = e(t.controller.signal, () => {
18
+ t.subscribers.forEach((e) => e.activity?.());
19
+ })[Symbol.asyncIterator](); !t.controller.signal.aborted;) {
20
+ let e = await n.next();
21
+ if (e.done || t.controller.signal.aborted) break;
22
+ e.value.type === "server.connected" && (t.connected = e.value), t.subscribers.forEach((t) => t.push(e.value));
23
+ }
24
+ } catch (e) {
25
+ i = { error: e };
26
+ } finally {
27
+ r(t);
28
+ try {
29
+ await n?.return?.();
30
+ } catch (e) {
31
+ "error" in i || (i = { error: e });
32
+ }
33
+ t.subscribers.forEach((e) => e.finish(i));
34
+ }
35
+ }
36
+ return { subscribe(e) {
37
+ return { [Symbol.asyncIterator]() {
38
+ let a = [], o = [], s = !1, c, l;
39
+ function u(t, n = !0) {
40
+ c = t, n && (o.length = 0), e?.signal?.removeEventListener("abort", d), l?.subscribers.delete(f) && !l.subscribers.size && r(l), a.splice(0).forEach((e) => {
41
+ "error" in t ? e.reject(t.error) : e.resolve({
42
+ done: !0,
43
+ value: void 0
44
+ });
45
+ });
46
+ }
47
+ function d() {
48
+ u({});
49
+ }
50
+ let f = {
51
+ activity: e?.onActivity,
52
+ finish(e) {
53
+ u(e, !1);
54
+ },
55
+ push(e) {
56
+ if (c) return;
57
+ let t = a.shift();
58
+ if (t) {
59
+ t.resolve({
60
+ done: !1,
61
+ value: e
62
+ });
63
+ return;
64
+ }
65
+ if (o.length === n) {
66
+ u({ error: /* @__PURE__ */ Error(`Event subscriber exceeded its ${n}-event capacity`) });
67
+ return;
68
+ }
69
+ o.push(e);
70
+ }
71
+ };
72
+ function p() {
73
+ if (c) return;
74
+ let e = !t;
75
+ l = t ?? {
76
+ controller: new AbortController(),
77
+ subscribers: /* @__PURE__ */ new Set()
78
+ }, t = l, l.subscribers.add(f), l.connected && f.push(l.connected), e && i(l);
79
+ }
80
+ return {
81
+ next() {
82
+ let t = o.shift();
83
+ if (t) return Promise.resolve({
84
+ done: !1,
85
+ value: t
86
+ });
87
+ if (c) return "error" in c ? Promise.reject(c.error) : Promise.resolve({
88
+ done: !0,
89
+ value: void 0
90
+ });
91
+ if (e?.signal?.aborted) return d(), Promise.resolve({
92
+ done: !0,
93
+ value: void 0
94
+ });
95
+ let n = Promise.withResolvers();
96
+ return a.push(n), s || (s = !0, e?.signal?.addEventListener("abort", d, { once: !0 }), p()), n.promise;
97
+ },
98
+ return() {
99
+ return u({}), Promise.resolve({
100
+ done: !0,
101
+ value: void 0
102
+ });
103
+ }
104
+ };
105
+ } };
106
+ } };
107
+ }
108
+ //#endregion
109
+ //#region ../../node_modules/.pnpm/@opencode+client@2.0.12_effect@4.0.0-rc.112/node_modules/@opencode/client/dist/chunks/service-contender-qc0tvgb4.js
110
+ var r = class extends Error {
111
+ reason;
112
+ name = "ClientError";
113
+ constructor(e, t) {
114
+ super(e, t), this.reason = e;
115
+ }
116
+ };
117
+ e({}, { make: () => a });
118
+ var i = 16777216;
119
+ function a(e) {
120
+ let t = e.fetch ?? globalThis.fetch, n = (t, n) => {
121
+ let r = new URL(t.path, e.baseUrl);
122
+ for (let [e, n] of Object.entries(t.query ?? {})) s(r.searchParams, e, n);
123
+ let i = new Headers(e.headers);
124
+ for (let [e, n] of Object.entries(t.headers ?? {})) n != null && i.set(e, String(n));
125
+ for (let [e, t] of new Headers(n?.headers)) i.set(e, t);
126
+ return t.body !== void 0 && !i.has("content-type") && i.set("content-type", t.binaryBody ? "application/octet-stream" : "application/json"), {
127
+ url: r,
128
+ init: {
129
+ method: t.method,
130
+ signal: n?.signal,
131
+ headers: i,
132
+ body: t.body === void 0 ? void 0 : t.binaryBody ? t.body : JSON.stringify(t.body)
133
+ }
134
+ };
135
+ }, a = async (e, i) => {
136
+ try {
137
+ let r = n(e, i);
138
+ return await t(r.url, r.init);
139
+ } catch (e) {
140
+ throw new r("Transport", { cause: e });
141
+ }
142
+ }, u = async (e, t) => {
143
+ if (t.declaredStatuses.includes(e.status)) throw await c(e);
144
+ try {
145
+ await e.body?.cancel();
146
+ } catch {}
147
+ throw new r("UnexpectedStatus", { cause: { status: e.status } });
148
+ }, d = async (e, t) => {
149
+ let n = await a(e, t);
150
+ if (n.status !== e.successStatus) return u(n, e);
151
+ if (e.binary) return new Uint8Array(await n.arrayBuffer());
152
+ if (e.empty) {
153
+ try {
154
+ await n.body?.cancel();
155
+ } catch {}
156
+ return;
157
+ }
158
+ return await c(n);
159
+ }, f = (e, t) => ({ async *[Symbol.asyncIterator]() {
160
+ let n = await a(e, t);
161
+ if (n.status !== e.successStatus && await u(n, e), !l(n, "text/event-stream")) {
162
+ try {
163
+ await n.body?.cancel();
164
+ } catch {}
165
+ throw new r("UnsupportedContentType");
166
+ }
167
+ if (n.body === null) throw new r("MalformedResponse");
168
+ let o = n.body.getReader(), s = new TextDecoder(), c = "";
169
+ try {
170
+ for (;;) {
171
+ let e;
172
+ try {
173
+ e = await o.read();
174
+ } catch (e) {
175
+ throw new r("Transport", { cause: e });
176
+ }
177
+ if (e.done || t?.onActivity?.(), c += s.decode(e.value, { stream: !e.done }), c.length > i) throw new r("SseEventTooLarge");
178
+ let n = !e.done && c.endsWith("\r");
179
+ n && (c = c.slice(0, -1)), c = c.replaceAll("\r\n", "\n").replaceAll("\r", "\n"), n && (c += "\r"), e.done && c !== "" && (c += "\n\n");
180
+ let a = c.indexOf("\n\n");
181
+ for (; a >= 0;) {
182
+ let e = c.slice(0, a);
183
+ c = c.slice(a + 2);
184
+ let t = e.split("\n").flatMap((e) => e.startsWith("data:") ? [e.slice(5).trimStart()] : []).join("\n");
185
+ if (t !== "") try {
186
+ yield JSON.parse(t);
187
+ } catch (e) {
188
+ throw new r("MalformedResponse", { cause: e });
189
+ }
190
+ a = c.indexOf("\n\n");
191
+ }
192
+ if (e.done) return;
193
+ }
194
+ } finally {
195
+ try {
196
+ await o.cancel();
197
+ } catch {}
198
+ o.releaseLock();
199
+ }
200
+ } });
201
+ return {
202
+ server: { info: (e) => d({
203
+ method: "GET",
204
+ path: "/api/info",
205
+ successStatus: 200,
206
+ declaredStatuses: [400, 401],
207
+ empty: !1
208
+ }, e) },
209
+ location: {
210
+ get: (e, t) => d({
211
+ method: "GET",
212
+ path: "/api/location",
213
+ query: { location: e?.location },
214
+ successStatus: 200,
215
+ declaredStatuses: [400, 401],
216
+ empty: !1
217
+ }, t),
218
+ reload: (e) => d({
219
+ method: "POST",
220
+ path: "/api/location/reload",
221
+ successStatus: 204,
222
+ declaredStatuses: [
223
+ 400,
224
+ 401,
225
+ 503
226
+ ],
227
+ empty: !0
228
+ }, e)
229
+ },
230
+ agent: {
231
+ list: (e, t) => d({
232
+ method: "GET",
233
+ path: "/api/agent",
234
+ query: { location: e?.location },
235
+ successStatus: 200,
236
+ declaredStatuses: [400, 401],
237
+ empty: !1
238
+ }, t),
239
+ get: (e, t) => d({
240
+ method: "GET",
241
+ path: `/api/agent/${encodeURIComponent(e.agentID)}`,
242
+ query: { location: e.location },
243
+ successStatus: 200,
244
+ declaredStatuses: [
245
+ 400,
246
+ 401,
247
+ 404
248
+ ],
249
+ empty: !1
250
+ }, t)
251
+ },
252
+ plugin: {
253
+ list: (e, t) => d({
254
+ method: "GET",
255
+ path: "/api/plugin",
256
+ query: { location: e?.location },
257
+ successStatus: 200,
258
+ declaredStatuses: [400, 401],
259
+ empty: !1
260
+ }, t),
261
+ check: (e, t) => d({
262
+ method: "POST",
263
+ path: "/api/plugin/check",
264
+ query: { location: e?.location },
265
+ body: { target: e?.target },
266
+ successStatus: 200,
267
+ declaredStatuses: [400, 401],
268
+ empty: !1
269
+ }, t),
270
+ update: (e, t) => d({
271
+ method: "POST",
272
+ path: "/api/plugin/update",
273
+ query: { location: e.location },
274
+ body: { targets: e.targets },
275
+ successStatus: 204,
276
+ declaredStatuses: [
277
+ 400,
278
+ 401,
279
+ 503
280
+ ],
281
+ empty: !0
282
+ }, t)
283
+ },
284
+ session: {
285
+ list: (e, t) => d({
286
+ method: "GET",
287
+ path: "/api/session",
288
+ query: {
289
+ limit: e?.limit,
290
+ order: e?.order,
291
+ search: e?.search,
292
+ parentID: e?.parentID,
293
+ directory: e?.directory,
294
+ project: e?.project,
295
+ subpath: e?.subpath,
296
+ cursor: e?.cursor
297
+ },
298
+ successStatus: 200,
299
+ declaredStatuses: [400, 401],
300
+ empty: !1
301
+ }, t),
302
+ stats: (e, t) => d({
303
+ method: "GET",
304
+ path: "/api/experimental/session/stats",
305
+ query: {
306
+ from: e?.from,
307
+ to: e?.to,
308
+ project: e?.project,
309
+ timezone: e?.timezone,
310
+ tools: e?.tools
311
+ },
312
+ successStatus: 200,
313
+ declaredStatuses: [400, 401],
314
+ empty: !1
315
+ }, t).then((e) => e.data),
316
+ create: (e, t) => d({
317
+ method: "POST",
318
+ path: "/api/session",
319
+ body: {
320
+ id: e?.id,
321
+ title: e?.title,
322
+ agent: e?.agent,
323
+ model: e?.model,
324
+ location: e?.location,
325
+ metadata: e?.metadata,
326
+ permissions: e?.permissions
327
+ },
328
+ successStatus: 200,
329
+ declaredStatuses: [400, 401],
330
+ empty: !1
331
+ }, t).then((e) => e.data),
332
+ import: (e, t) => d({
333
+ method: "POST",
334
+ path: "/api/experimental/session/import",
335
+ body: {
336
+ info: e.info,
337
+ messages: e.messages,
338
+ location: e.location
339
+ },
340
+ successStatus: 200,
341
+ declaredStatuses: [
342
+ 400,
343
+ 401,
344
+ 404,
345
+ 409
346
+ ],
347
+ empty: !1
348
+ }, t).then((e) => e.data),
349
+ export: (e, t) => d({
350
+ method: "GET",
351
+ path: `/api/experimental/session/${encodeURIComponent(e.sessionID)}/export`,
352
+ query: { sanitize: e.sanitize },
353
+ successStatus: 200,
354
+ declaredStatuses: [
355
+ 400,
356
+ 401,
357
+ 404,
358
+ 500
359
+ ],
360
+ empty: !1
361
+ }, t).then((e) => e.data),
362
+ active: (e) => d({
363
+ method: "GET",
364
+ path: "/api/session/active",
365
+ successStatus: 200,
366
+ declaredStatuses: [400, 401],
367
+ empty: !1
368
+ }, e).then((e) => e.data),
369
+ get: (e, t) => d({
370
+ method: "GET",
371
+ path: `/api/session/${encodeURIComponent(e.sessionID)}`,
372
+ successStatus: 200,
373
+ declaredStatuses: [
374
+ 400,
375
+ 401,
376
+ 404
377
+ ],
378
+ empty: !1
379
+ }, t).then((e) => e.data),
380
+ remove: (e, t) => d({
381
+ method: "DELETE",
382
+ path: `/api/session/${encodeURIComponent(e.sessionID)}`,
383
+ successStatus: 204,
384
+ declaredStatuses: [
385
+ 400,
386
+ 401,
387
+ 404
388
+ ],
389
+ empty: !0
390
+ }, t),
391
+ fork: (e, t) => d({
392
+ method: "POST",
393
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/fork`,
394
+ body: { before: e.before },
395
+ successStatus: 200,
396
+ declaredStatuses: [
397
+ 400,
398
+ 401,
399
+ 404
400
+ ],
401
+ empty: !1
402
+ }, t).then((e) => e.data),
403
+ switchAgent: (e, t) => d({
404
+ method: "POST",
405
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/agent`,
406
+ body: { agent: e.agent },
407
+ successStatus: 204,
408
+ declaredStatuses: [
409
+ 400,
410
+ 401,
411
+ 404
412
+ ],
413
+ empty: !0
414
+ }, t),
415
+ switchModel: (e, t) => d({
416
+ method: "POST",
417
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/model`,
418
+ body: { model: e.model },
419
+ successStatus: 204,
420
+ declaredStatuses: [
421
+ 400,
422
+ 401,
423
+ 404
424
+ ],
425
+ empty: !0
426
+ }, t),
427
+ update: (e, t) => d({
428
+ method: "PATCH",
429
+ path: `/api/session/${encodeURIComponent(e.sessionID)}`,
430
+ body: {
431
+ title: e.title,
432
+ permissions: e.permissions
433
+ },
434
+ successStatus: 204,
435
+ declaredStatuses: [
436
+ 400,
437
+ 401,
438
+ 404
439
+ ],
440
+ empty: !0
441
+ }, t),
442
+ move: (e, t) => d({
443
+ method: "POST",
444
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/move`,
445
+ body: {
446
+ directory: e.directory,
447
+ delivery: e.delivery
448
+ },
449
+ successStatus: 204,
450
+ declaredStatuses: [
451
+ 400,
452
+ 401,
453
+ 404
454
+ ],
455
+ empty: !0
456
+ }, t),
457
+ prompt: (e, t) => d({
458
+ method: "POST",
459
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/prompt`,
460
+ body: {
461
+ id: e.id,
462
+ text: e.text,
463
+ files: e.files,
464
+ agents: e.agents,
465
+ skills: e.skills,
466
+ metadata: e.metadata,
467
+ delivery: e.delivery,
468
+ resume: e.resume
469
+ },
470
+ successStatus: 200,
471
+ declaredStatuses: [
472
+ 400,
473
+ 401,
474
+ 404,
475
+ 409
476
+ ],
477
+ empty: !1
478
+ }, t).then((e) => e.data),
479
+ command: (e, t) => d({
480
+ method: "POST",
481
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/command`,
482
+ body: {
483
+ name: e.name,
484
+ text: e.text,
485
+ files: e.files,
486
+ agents: e.agents,
487
+ skills: e.skills,
488
+ delivery: e.delivery
489
+ },
490
+ successStatus: 204,
491
+ declaredStatuses: [
492
+ 400,
493
+ 401,
494
+ 404,
495
+ 500
496
+ ],
497
+ empty: !0
498
+ }, t),
499
+ skill: (e, t) => d({
500
+ method: "POST",
501
+ path: `/api/experimental/session/${encodeURIComponent(e.sessionID)}/skill`,
502
+ body: {
503
+ id: e.id,
504
+ resume: e.resume
505
+ },
506
+ successStatus: 204,
507
+ declaredStatuses: [
508
+ 400,
509
+ 401,
510
+ 404
511
+ ],
512
+ empty: !0
513
+ }, t),
514
+ synthetic: (e, t) => d({
515
+ method: "POST",
516
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/synthetic`,
517
+ body: {
518
+ id: e.id,
519
+ text: e.text,
520
+ description: e.description,
521
+ metadata: e.metadata,
522
+ delivery: e.delivery,
523
+ resume: e.resume
524
+ },
525
+ successStatus: 200,
526
+ declaredStatuses: [
527
+ 400,
528
+ 401,
529
+ 404,
530
+ 409
531
+ ],
532
+ empty: !1
533
+ }, t).then((e) => e.data),
534
+ shell: (e, t) => d({
535
+ method: "POST",
536
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/shell`,
537
+ body: {
538
+ id: e.id,
539
+ command: e.command
540
+ },
541
+ successStatus: 204,
542
+ declaredStatuses: [
543
+ 400,
544
+ 401,
545
+ 404
546
+ ],
547
+ empty: !0
548
+ }, t),
549
+ compact: (e, t) => d({
550
+ method: "POST",
551
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/compact`,
552
+ body: {
553
+ id: e.id,
554
+ delivery: e.delivery
555
+ },
556
+ successStatus: 200,
557
+ declaredStatuses: [
558
+ 400,
559
+ 401,
560
+ 404,
561
+ 409
562
+ ],
563
+ empty: !1
564
+ }, t).then((e) => e.data),
565
+ wait: (e, t) => d({
566
+ method: "POST",
567
+ path: `/api/experimental/session/${encodeURIComponent(e.sessionID)}/wait`,
568
+ successStatus: 204,
569
+ declaredStatuses: [
570
+ 400,
571
+ 401,
572
+ 404,
573
+ 503
574
+ ],
575
+ empty: !0
576
+ }, t),
577
+ revert: {
578
+ stage: (e, t) => d({
579
+ method: "POST",
580
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/revert/stage`,
581
+ body: {
582
+ messageID: e.messageID,
583
+ files: e.files
584
+ },
585
+ successStatus: 200,
586
+ declaredStatuses: [
587
+ 400,
588
+ 401,
589
+ 404,
590
+ 409,
591
+ 500
592
+ ],
593
+ empty: !1
594
+ }, t).then((e) => e.data),
595
+ clear: (e, t) => d({
596
+ method: "DELETE",
597
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/revert`,
598
+ successStatus: 204,
599
+ declaredStatuses: [
600
+ 400,
601
+ 401,
602
+ 404,
603
+ 409,
604
+ 500
605
+ ],
606
+ empty: !0
607
+ }, t),
608
+ commit: (e, t) => d({
609
+ method: "POST",
610
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/revert/commit`,
611
+ successStatus: 204,
612
+ declaredStatuses: [
613
+ 400,
614
+ 401,
615
+ 404,
616
+ 409
617
+ ],
618
+ empty: !0
619
+ }, t)
620
+ },
621
+ context: (e, t) => d({
622
+ method: "GET",
623
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/context`,
624
+ successStatus: 200,
625
+ declaredStatuses: [
626
+ 400,
627
+ 401,
628
+ 404,
629
+ 500
630
+ ],
631
+ empty: !1
632
+ }, t).then((e) => e.data),
633
+ diff: (e, t) => d({
634
+ method: "GET",
635
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/diff`,
636
+ query: {
637
+ from: e.from,
638
+ to: e.to,
639
+ context: e.context
640
+ },
641
+ successStatus: 200,
642
+ declaredStatuses: [
643
+ 400,
644
+ 401,
645
+ 404,
646
+ 500
647
+ ],
648
+ empty: !1
649
+ }, t).then((e) => e.data),
650
+ inbox: {
651
+ list: (e, t) => d({
652
+ method: "GET",
653
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/inbox`,
654
+ successStatus: 200,
655
+ declaredStatuses: [
656
+ 400,
657
+ 401,
658
+ 404
659
+ ],
660
+ empty: !1
661
+ }, t).then((e) => e.data),
662
+ cancel: (e, t) => d({
663
+ method: "DELETE",
664
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/inbox/${encodeURIComponent(e.inboxID)}`,
665
+ successStatus: 204,
666
+ declaredStatuses: [
667
+ 400,
668
+ 401,
669
+ 404
670
+ ],
671
+ empty: !0
672
+ }, t),
673
+ update: (e, t) => d({
674
+ method: "PATCH",
675
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/inbox/${encodeURIComponent(e.inboxID)}`,
676
+ body: { delivery: e.delivery },
677
+ successStatus: 204,
678
+ declaredStatuses: [
679
+ 400,
680
+ 401,
681
+ 404,
682
+ 409
683
+ ],
684
+ empty: !0
685
+ }, t)
686
+ },
687
+ instructions: { entry: {
688
+ list: (e, t) => d({
689
+ method: "GET",
690
+ path: `/api/experimental/session/${encodeURIComponent(e.sessionID)}/instructions/entries`,
691
+ successStatus: 200,
692
+ declaredStatuses: [
693
+ 400,
694
+ 401,
695
+ 404
696
+ ],
697
+ empty: !1
698
+ }, t).then((e) => e.data),
699
+ put: (e, t) => d({
700
+ method: "PUT",
701
+ path: `/api/experimental/session/${encodeURIComponent(e.sessionID)}/instructions/entries/${encodeURIComponent(e.key)}`,
702
+ body: { value: e.value },
703
+ successStatus: 204,
704
+ declaredStatuses: [
705
+ 400,
706
+ 401,
707
+ 404,
708
+ 413
709
+ ],
710
+ empty: !0
711
+ }, t),
712
+ remove: (e, t) => d({
713
+ method: "DELETE",
714
+ path: `/api/experimental/session/${encodeURIComponent(e.sessionID)}/instructions/entries/${encodeURIComponent(e.key)}`,
715
+ successStatus: 204,
716
+ declaredStatuses: [
717
+ 400,
718
+ 401,
719
+ 404
720
+ ],
721
+ empty: !0
722
+ }, t)
723
+ } },
724
+ generate: (e, t) => d({
725
+ method: "POST",
726
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/generate`,
727
+ body: { prompt: e.prompt },
728
+ successStatus: 200,
729
+ declaredStatuses: [
730
+ 400,
731
+ 401,
732
+ 404,
733
+ 503
734
+ ],
735
+ empty: !1
736
+ }, t).then((e) => e.data),
737
+ log: (e, t) => f({
738
+ method: "GET",
739
+ path: `/api/experimental/session/${encodeURIComponent(e.sessionID)}/log`,
740
+ query: {
741
+ after: e.after,
742
+ follow: e.follow
743
+ },
744
+ successStatus: 200,
745
+ declaredStatuses: [
746
+ 400,
747
+ 401,
748
+ 404
749
+ ],
750
+ empty: !1
751
+ }, t),
752
+ interrupt: (e, t) => d({
753
+ method: "POST",
754
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/interrupt`,
755
+ query: { resume: e.resume },
756
+ successStatus: 200,
757
+ declaredStatuses: [
758
+ 400,
759
+ 401,
760
+ 404
761
+ ],
762
+ empty: !1
763
+ }, t),
764
+ background: (e, t) => d({
765
+ method: "POST",
766
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/background`,
767
+ successStatus: 204,
768
+ declaredStatuses: [
769
+ 400,
770
+ 401,
771
+ 404
772
+ ],
773
+ empty: !0
774
+ }, t),
775
+ message: { get: (e, t) => d({
776
+ method: "GET",
777
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/message/${encodeURIComponent(e.messageID)}`,
778
+ successStatus: 200,
779
+ declaredStatuses: [
780
+ 400,
781
+ 401,
782
+ 404
783
+ ],
784
+ empty: !1
785
+ }, t).then((e) => e.data) },
786
+ form: {
787
+ list: (e, t) => d({
788
+ method: "GET",
789
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/form`,
790
+ successStatus: 200,
791
+ declaredStatuses: [
792
+ 400,
793
+ 401,
794
+ 404
795
+ ],
796
+ empty: !1
797
+ }, t).then((e) => e.data),
798
+ create: (e, t) => d({
799
+ method: "POST",
800
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/form`,
801
+ body: {
802
+ id: e.id,
803
+ title: e.title,
804
+ metadata: e.metadata,
805
+ fields: e.fields
806
+ },
807
+ successStatus: 200,
808
+ declaredStatuses: [
809
+ 400,
810
+ 401,
811
+ 404,
812
+ 409
813
+ ],
814
+ empty: !1
815
+ }, t).then((e) => e.data),
816
+ get: (e, t) => d({
817
+ method: "GET",
818
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/form/${encodeURIComponent(e.formID)}`,
819
+ successStatus: 200,
820
+ declaredStatuses: [
821
+ 400,
822
+ 401,
823
+ 404
824
+ ],
825
+ empty: !1
826
+ }, t).then((e) => e.data),
827
+ reply: (e, t) => d({
828
+ method: "POST",
829
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/form/${encodeURIComponent(e.formID)}/reply`,
830
+ body: { answer: e.answer },
831
+ successStatus: 204,
832
+ declaredStatuses: [
833
+ 400,
834
+ 401,
835
+ 404,
836
+ 409
837
+ ],
838
+ empty: !0
839
+ }, t),
840
+ cancel: (e, t) => d({
841
+ method: "DELETE",
842
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/form/${encodeURIComponent(e.formID)}`,
843
+ successStatus: 204,
844
+ declaredStatuses: [
845
+ 400,
846
+ 401,
847
+ 404,
848
+ 409
849
+ ],
850
+ empty: !0
851
+ }, t)
852
+ },
853
+ environment: (e, t) => d({
854
+ method: "PUT",
855
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/environment`,
856
+ body: { variables: e.variables },
857
+ successStatus: 204,
858
+ declaredStatuses: [
859
+ 400,
860
+ 401,
861
+ 404
862
+ ],
863
+ empty: !0
864
+ }, t),
865
+ view: (e, t) => d({
866
+ method: "POST",
867
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/view`,
868
+ body: { idle: e.idle },
869
+ successStatus: 204,
870
+ declaredStatuses: [
871
+ 400,
872
+ 401,
873
+ 404
874
+ ],
875
+ empty: !0
876
+ }, t)
877
+ },
878
+ message: { list: (e, t) => d({
879
+ method: "GET",
880
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/message`,
881
+ query: {
882
+ limit: e.limit,
883
+ order: e.order,
884
+ cursor: e.cursor,
885
+ type: e.type
886
+ },
887
+ successStatus: 200,
888
+ declaredStatuses: [
889
+ 400,
890
+ 401,
891
+ 404,
892
+ 500
893
+ ],
894
+ empty: !1
895
+ }, t) },
896
+ model: {
897
+ list: (e, t) => d({
898
+ method: "GET",
899
+ path: "/api/model",
900
+ query: { location: e?.location },
901
+ successStatus: 200,
902
+ declaredStatuses: [
903
+ 400,
904
+ 401,
905
+ 503
906
+ ],
907
+ empty: !1
908
+ }, t),
909
+ default: (e, t) => d({
910
+ method: "GET",
911
+ path: "/api/model/default",
912
+ query: { location: e?.location },
913
+ successStatus: 200,
914
+ declaredStatuses: [
915
+ 400,
916
+ 401,
917
+ 503
918
+ ],
919
+ empty: !1
920
+ }, t)
921
+ },
922
+ generate: { text: (e, t) => d({
923
+ method: "POST",
924
+ path: "/api/experimental/generate",
925
+ body: {
926
+ prompt: e.prompt,
927
+ model: e.model
928
+ },
929
+ successStatus: 200,
930
+ declaredStatuses: [
931
+ 400,
932
+ 401,
933
+ 503
934
+ ],
935
+ empty: !1
936
+ }, t).then((e) => e.data) },
937
+ provider: {
938
+ list: (e, t) => d({
939
+ method: "GET",
940
+ path: "/api/provider",
941
+ query: { location: e?.location },
942
+ successStatus: 200,
943
+ declaredStatuses: [
944
+ 400,
945
+ 401,
946
+ 503
947
+ ],
948
+ empty: !1
949
+ }, t),
950
+ get: (e, t) => d({
951
+ method: "GET",
952
+ path: `/api/provider/${encodeURIComponent(e.providerID)}`,
953
+ query: { location: e.location },
954
+ successStatus: 200,
955
+ declaredStatuses: [
956
+ 400,
957
+ 401,
958
+ 404,
959
+ 503
960
+ ],
961
+ empty: !1
962
+ }, t)
963
+ },
964
+ integration: {
965
+ list: (e, t) => d({
966
+ method: "GET",
967
+ path: "/api/integration",
968
+ query: { location: e?.location },
969
+ successStatus: 200,
970
+ declaredStatuses: [400, 401],
971
+ empty: !1
972
+ }, t),
973
+ get: (e, t) => d({
974
+ method: "GET",
975
+ path: `/api/integration/${encodeURIComponent(e.integrationID)}`,
976
+ query: { location: e.location },
977
+ successStatus: 200,
978
+ declaredStatuses: [
979
+ 400,
980
+ 401,
981
+ 404
982
+ ],
983
+ empty: !1
984
+ }, t),
985
+ wellknown: { add: (e, t) => d({
986
+ method: "POST",
987
+ path: "/api/experimental/integration/wellknown",
988
+ query: { location: e.location },
989
+ body: { url: e.url },
990
+ successStatus: 204,
991
+ declaredStatuses: [400, 401],
992
+ empty: !0
993
+ }, t) },
994
+ connect: { key: (e, t) => d({
995
+ method: "POST",
996
+ path: `/api/integration/${encodeURIComponent(e.integrationID)}/connect/key`,
997
+ query: { location: e.location },
998
+ body: {
999
+ key: e.key,
1000
+ answer: e.answer,
1001
+ label: e.label
1002
+ },
1003
+ successStatus: 204,
1004
+ declaredStatuses: [
1005
+ 400,
1006
+ 401,
1007
+ 404
1008
+ ],
1009
+ empty: !0
1010
+ }, t) },
1011
+ oauth: {
1012
+ connect: (e, t) => d({
1013
+ method: "POST",
1014
+ path: `/api/integration/${encodeURIComponent(e.integrationID)}/connect/oauth`,
1015
+ query: { location: e.location },
1016
+ body: {
1017
+ methodID: e.methodID,
1018
+ answer: e.answer,
1019
+ label: e.label
1020
+ },
1021
+ successStatus: 200,
1022
+ declaredStatuses: [400, 401],
1023
+ empty: !1
1024
+ }, t),
1025
+ status: (e, t) => d({
1026
+ method: "GET",
1027
+ path: `/api/integration/${encodeURIComponent(e.integrationID)}/connect/oauth/${encodeURIComponent(e.attemptID)}`,
1028
+ query: { location: e.location },
1029
+ successStatus: 200,
1030
+ declaredStatuses: [
1031
+ 400,
1032
+ 401,
1033
+ 404
1034
+ ],
1035
+ empty: !1
1036
+ }, t),
1037
+ complete: (e, t) => d({
1038
+ method: "POST",
1039
+ path: `/api/integration/${encodeURIComponent(e.integrationID)}/connect/oauth/${encodeURIComponent(e.attemptID)}/complete`,
1040
+ query: { location: e.location },
1041
+ body: { code: e.code },
1042
+ successStatus: 204,
1043
+ declaredStatuses: [
1044
+ 400,
1045
+ 401,
1046
+ 404
1047
+ ],
1048
+ empty: !0
1049
+ }, t),
1050
+ cancel: (e, t) => d({
1051
+ method: "DELETE",
1052
+ path: `/api/integration/${encodeURIComponent(e.integrationID)}/connect/oauth/${encodeURIComponent(e.attemptID)}`,
1053
+ query: { location: e.location },
1054
+ successStatus: 204,
1055
+ declaredStatuses: [400, 401],
1056
+ empty: !0
1057
+ }, t)
1058
+ },
1059
+ command: {
1060
+ connect: (e, t) => d({
1061
+ method: "POST",
1062
+ path: `/api/integration/${encodeURIComponent(e.integrationID)}/connect/command`,
1063
+ query: { location: e.location },
1064
+ body: {
1065
+ methodID: e.methodID,
1066
+ label: e.label
1067
+ },
1068
+ successStatus: 200,
1069
+ declaredStatuses: [
1070
+ 400,
1071
+ 401,
1072
+ 404
1073
+ ],
1074
+ empty: !1
1075
+ }, t),
1076
+ status: (e, t) => d({
1077
+ method: "GET",
1078
+ path: `/api/integration/${encodeURIComponent(e.integrationID)}/connect/command/${encodeURIComponent(e.attemptID)}`,
1079
+ query: { location: e.location },
1080
+ successStatus: 200,
1081
+ declaredStatuses: [
1082
+ 400,
1083
+ 401,
1084
+ 404
1085
+ ],
1086
+ empty: !1
1087
+ }, t),
1088
+ cancel: (e, t) => d({
1089
+ method: "DELETE",
1090
+ path: `/api/integration/${encodeURIComponent(e.integrationID)}/connect/command/${encodeURIComponent(e.attemptID)}`,
1091
+ query: { location: e.location },
1092
+ successStatus: 204,
1093
+ declaredStatuses: [400, 401],
1094
+ empty: !0
1095
+ }, t)
1096
+ }
1097
+ },
1098
+ mcp: {
1099
+ list: (e, t) => d({
1100
+ method: "GET",
1101
+ path: "/api/mcp",
1102
+ query: { location: e?.location },
1103
+ successStatus: 200,
1104
+ declaredStatuses: [400, 401],
1105
+ empty: !1
1106
+ }, t),
1107
+ add: (e, t) => d({
1108
+ method: "PUT",
1109
+ path: `/api/experimental/mcp/${encodeURIComponent(e.server)}`,
1110
+ query: { location: e.location },
1111
+ body: { config: e.config },
1112
+ successStatus: 204,
1113
+ declaredStatuses: [400, 401],
1114
+ empty: !0
1115
+ }, t),
1116
+ remove: (e, t) => d({
1117
+ method: "DELETE",
1118
+ path: `/api/experimental/mcp/${encodeURIComponent(e.server)}`,
1119
+ query: { location: e.location },
1120
+ successStatus: 204,
1121
+ declaredStatuses: [
1122
+ 400,
1123
+ 401,
1124
+ 404
1125
+ ],
1126
+ empty: !0
1127
+ }, t),
1128
+ connect: (e, t) => d({
1129
+ method: "POST",
1130
+ path: `/api/experimental/mcp/${encodeURIComponent(e.server)}/connect`,
1131
+ query: { location: e.location },
1132
+ successStatus: 204,
1133
+ declaredStatuses: [
1134
+ 400,
1135
+ 401,
1136
+ 404
1137
+ ],
1138
+ empty: !0
1139
+ }, t),
1140
+ disconnect: (e, t) => d({
1141
+ method: "POST",
1142
+ path: `/api/experimental/mcp/${encodeURIComponent(e.server)}/disconnect`,
1143
+ query: { location: e.location },
1144
+ successStatus: 204,
1145
+ declaredStatuses: [
1146
+ 400,
1147
+ 401,
1148
+ 404
1149
+ ],
1150
+ empty: !0
1151
+ }, t),
1152
+ resource: { catalog: (e, t) => d({
1153
+ method: "GET",
1154
+ path: "/api/mcp/resource",
1155
+ query: { location: e?.location },
1156
+ successStatus: 200,
1157
+ declaredStatuses: [400, 401],
1158
+ empty: !1
1159
+ }, t) }
1160
+ },
1161
+ credential: {
1162
+ update: (e, t) => d({
1163
+ method: "PATCH",
1164
+ path: `/api/credential/${encodeURIComponent(e.credentialID)}`,
1165
+ body: { label: e.label },
1166
+ successStatus: 204,
1167
+ declaredStatuses: [400, 401],
1168
+ empty: !0
1169
+ }, t),
1170
+ activate: (e, t) => d({
1171
+ method: "POST",
1172
+ path: `/api/credential/${encodeURIComponent(e.credentialID)}/activate`,
1173
+ successStatus: 204,
1174
+ declaredStatuses: [400, 401],
1175
+ empty: !0
1176
+ }, t),
1177
+ remove: (e, t) => d({
1178
+ method: "DELETE",
1179
+ path: `/api/credential/${encodeURIComponent(e.credentialID)}`,
1180
+ successStatus: 204,
1181
+ declaredStatuses: [400, 401],
1182
+ empty: !0
1183
+ }, t)
1184
+ },
1185
+ project: {
1186
+ list: (e) => d({
1187
+ method: "GET",
1188
+ path: "/api/project",
1189
+ successStatus: 200,
1190
+ declaredStatuses: [400, 401],
1191
+ empty: !1
1192
+ }, e),
1193
+ update: (e, t) => d({
1194
+ method: "PATCH",
1195
+ path: `/api/project/${encodeURIComponent(e.projectID)}`,
1196
+ body: {
1197
+ canonical: e.canonical,
1198
+ name: e.name,
1199
+ icon: e.icon,
1200
+ commands: e.commands
1201
+ },
1202
+ successStatus: 200,
1203
+ declaredStatuses: [
1204
+ 400,
1205
+ 401,
1206
+ 404
1207
+ ],
1208
+ empty: !1
1209
+ }, t)
1210
+ },
1211
+ form: { list: (e, t) => d({
1212
+ method: "GET",
1213
+ path: "/api/form",
1214
+ query: { location: e?.location },
1215
+ successStatus: 200,
1216
+ declaredStatuses: [400, 401],
1217
+ empty: !1
1218
+ }, t) },
1219
+ permission: {
1220
+ request: { list: (e, t) => d({
1221
+ method: "GET",
1222
+ path: "/api/permission/request",
1223
+ query: { location: e?.location },
1224
+ successStatus: 200,
1225
+ declaredStatuses: [400, 401],
1226
+ empty: !1
1227
+ }, t) },
1228
+ saved: {
1229
+ list: (e, t) => d({
1230
+ method: "GET",
1231
+ path: "/api/permission/saved",
1232
+ query: { projectID: e?.projectID },
1233
+ successStatus: 200,
1234
+ declaredStatuses: [400, 401],
1235
+ empty: !1
1236
+ }, t).then((e) => e.data),
1237
+ remove: (e, t) => d({
1238
+ method: "DELETE",
1239
+ path: `/api/permission/saved/${encodeURIComponent(e.id)}`,
1240
+ successStatus: 204,
1241
+ declaredStatuses: [400, 401],
1242
+ empty: !0
1243
+ }, t)
1244
+ },
1245
+ create: (e, t) => d({
1246
+ method: "POST",
1247
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/permission`,
1248
+ body: {
1249
+ id: e.id,
1250
+ action: e.action,
1251
+ resources: e.resources,
1252
+ save: e.save,
1253
+ metadata: e.metadata,
1254
+ source: e.source,
1255
+ agent: e.agent
1256
+ },
1257
+ successStatus: 200,
1258
+ declaredStatuses: [
1259
+ 400,
1260
+ 401,
1261
+ 404
1262
+ ],
1263
+ empty: !1
1264
+ }, t).then((e) => e.data),
1265
+ list: (e, t) => d({
1266
+ method: "GET",
1267
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/permission`,
1268
+ successStatus: 200,
1269
+ declaredStatuses: [
1270
+ 400,
1271
+ 401,
1272
+ 404
1273
+ ],
1274
+ empty: !1
1275
+ }, t).then((e) => e.data),
1276
+ get: (e, t) => d({
1277
+ method: "GET",
1278
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/permission/${encodeURIComponent(e.requestID)}`,
1279
+ successStatus: 200,
1280
+ declaredStatuses: [
1281
+ 400,
1282
+ 401,
1283
+ 404
1284
+ ],
1285
+ empty: !1
1286
+ }, t).then((e) => e.data),
1287
+ reply: (e, t) => d({
1288
+ method: "POST",
1289
+ path: `/api/session/${encodeURIComponent(e.sessionID)}/permission/${encodeURIComponent(e.requestID)}/reply`,
1290
+ body: {
1291
+ decision: e.decision,
1292
+ message: e.message
1293
+ },
1294
+ successStatus: 204,
1295
+ declaredStatuses: [
1296
+ 400,
1297
+ 401,
1298
+ 404
1299
+ ],
1300
+ empty: !0
1301
+ }, t)
1302
+ },
1303
+ file: {
1304
+ read: (e, t) => d({
1305
+ method: "GET",
1306
+ path: `/api/fs/read/${o(e.path)}`,
1307
+ query: { location: e.location },
1308
+ successStatus: 200,
1309
+ declaredStatuses: [
1310
+ 400,
1311
+ 401,
1312
+ 404
1313
+ ],
1314
+ empty: !1,
1315
+ binary: !0
1316
+ }, t),
1317
+ list: (e, t) => d({
1318
+ method: "GET",
1319
+ path: "/api/fs/list",
1320
+ query: {
1321
+ location: e?.location,
1322
+ path: e?.path
1323
+ },
1324
+ successStatus: 200,
1325
+ declaredStatuses: [400, 401],
1326
+ empty: !1
1327
+ }, t),
1328
+ find: (e, t) => d({
1329
+ method: "GET",
1330
+ path: "/api/fs/find",
1331
+ query: {
1332
+ location: e.location,
1333
+ query: e.query,
1334
+ type: e.type,
1335
+ limit: e.limit
1336
+ },
1337
+ successStatus: 200,
1338
+ declaredStatuses: [400, 401],
1339
+ empty: !1
1340
+ }, t),
1341
+ write: (e, t) => d({
1342
+ method: "POST",
1343
+ path: "/api/experimental/fs/write",
1344
+ query: {
1345
+ location: e.location,
1346
+ path: e.path
1347
+ },
1348
+ body: e.payload,
1349
+ successStatus: 200,
1350
+ declaredStatuses: [400, 401],
1351
+ empty: !1,
1352
+ binaryBody: !0
1353
+ }, t)
1354
+ },
1355
+ command: { list: (e, t) => d({
1356
+ method: "GET",
1357
+ path: "/api/command",
1358
+ query: { location: e?.location },
1359
+ successStatus: 200,
1360
+ declaredStatuses: [400, 401],
1361
+ empty: !1
1362
+ }, t) },
1363
+ skill: { list: (e, t) => d({
1364
+ method: "GET",
1365
+ path: "/api/skill",
1366
+ query: { location: e?.location },
1367
+ successStatus: 200,
1368
+ declaredStatuses: [400, 401],
1369
+ empty: !1
1370
+ }, t) },
1371
+ rpc: { call: (e, t) => d({
1372
+ method: "POST",
1373
+ path: `/api/rpc/${encodeURIComponent(e.rpcID)}/${encodeURIComponent(e.method)}`,
1374
+ query: { location: e.location },
1375
+ body: { input: e.input },
1376
+ successStatus: 200,
1377
+ declaredStatuses: [
1378
+ 400,
1379
+ 401,
1380
+ 500
1381
+ ],
1382
+ empty: !1
1383
+ }, t) },
1384
+ event: { subscribe: (e) => f({
1385
+ method: "GET",
1386
+ path: "/api/event",
1387
+ successStatus: 200,
1388
+ declaredStatuses: [400, 401],
1389
+ empty: !1
1390
+ }, e) },
1391
+ pty: {
1392
+ list: (e, t) => d({
1393
+ method: "GET",
1394
+ path: "/api/pty",
1395
+ query: { location: e?.location },
1396
+ successStatus: 200,
1397
+ declaredStatuses: [400, 401],
1398
+ empty: !1
1399
+ }, t),
1400
+ create: (e, t) => d({
1401
+ method: "POST",
1402
+ path: "/api/pty",
1403
+ query: { location: e?.location },
1404
+ body: {
1405
+ command: e?.command,
1406
+ args: e?.args,
1407
+ cwd: e?.cwd,
1408
+ title: e?.title,
1409
+ env: e?.env
1410
+ },
1411
+ successStatus: 200,
1412
+ declaredStatuses: [400, 401],
1413
+ empty: !1
1414
+ }, t),
1415
+ get: (e, t) => d({
1416
+ method: "GET",
1417
+ path: `/api/pty/${encodeURIComponent(e.ptyID)}`,
1418
+ query: { location: e.location },
1419
+ successStatus: 200,
1420
+ declaredStatuses: [
1421
+ 400,
1422
+ 401,
1423
+ 404
1424
+ ],
1425
+ empty: !1
1426
+ }, t),
1427
+ update: (e, t) => d({
1428
+ method: "PUT",
1429
+ path: `/api/pty/${encodeURIComponent(e.ptyID)}`,
1430
+ query: { location: e.location },
1431
+ body: {
1432
+ title: e.title,
1433
+ size: e.size
1434
+ },
1435
+ successStatus: 200,
1436
+ declaredStatuses: [
1437
+ 400,
1438
+ 401,
1439
+ 404
1440
+ ],
1441
+ empty: !1
1442
+ }, t),
1443
+ remove: (e, t) => d({
1444
+ method: "DELETE",
1445
+ path: `/api/pty/${encodeURIComponent(e.ptyID)}`,
1446
+ query: { location: e.location },
1447
+ successStatus: 204,
1448
+ declaredStatuses: [
1449
+ 400,
1450
+ 401,
1451
+ 404
1452
+ ],
1453
+ empty: !0
1454
+ }, t),
1455
+ connect: { token: (e, t) => d({
1456
+ method: "POST",
1457
+ path: `/api/pty/${encodeURIComponent(e.ptyID)}/connect-token`,
1458
+ query: { location: e.location },
1459
+ headers: { "x-opencode-ticket": e["x-opencode-ticket"] },
1460
+ successStatus: 200,
1461
+ declaredStatuses: [
1462
+ 400,
1463
+ 401,
1464
+ 403,
1465
+ 404
1466
+ ],
1467
+ empty: !1
1468
+ }, t) }
1469
+ },
1470
+ experimental: { persistentPty: {
1471
+ read: (e, t) => d({
1472
+ method: "GET",
1473
+ path: `/api/experimental/session/${encodeURIComponent(e.sessionID)}/terminal/read`,
1474
+ query: { lines: e.lines },
1475
+ successStatus: 200,
1476
+ declaredStatuses: [
1477
+ 400,
1478
+ 401,
1479
+ 503
1480
+ ],
1481
+ empty: !1
1482
+ }, t).then((e) => e.data),
1483
+ list: (e, t) => d({
1484
+ method: "GET",
1485
+ path: `/api/experimental/session/${encodeURIComponent(e.sessionID)}/terminal`,
1486
+ successStatus: 200,
1487
+ declaredStatuses: [
1488
+ 400,
1489
+ 401,
1490
+ 503
1491
+ ],
1492
+ empty: !1
1493
+ }, t).then((e) => e.data),
1494
+ create: (e, t) => d({
1495
+ method: "POST",
1496
+ path: `/api/experimental/session/${encodeURIComponent(e.sessionID)}/terminal`,
1497
+ body: {
1498
+ command: e.command,
1499
+ args: e.args,
1500
+ cwd: e.cwd,
1501
+ title: e.title,
1502
+ env: e.env,
1503
+ size: e.size
1504
+ },
1505
+ successStatus: 200,
1506
+ declaredStatuses: [
1507
+ 400,
1508
+ 401,
1509
+ 503
1510
+ ],
1511
+ empty: !1
1512
+ }, t).then((e) => e.data),
1513
+ shutdown: (e) => d({
1514
+ method: "POST",
1515
+ path: "/api/experimental/persistent-pty/shutdown",
1516
+ successStatus: 204,
1517
+ declaredStatuses: [
1518
+ 400,
1519
+ 401,
1520
+ 503
1521
+ ],
1522
+ empty: !0
1523
+ }, e),
1524
+ handoff: (e) => d({
1525
+ method: "POST",
1526
+ path: "/api/experimental/persistent-pty/handoff",
1527
+ successStatus: 200,
1528
+ declaredStatuses: [
1529
+ 400,
1530
+ 401,
1531
+ 503
1532
+ ],
1533
+ empty: !1
1534
+ }, e),
1535
+ get: (e, t) => d({
1536
+ method: "GET",
1537
+ path: `/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}`,
1538
+ successStatus: 200,
1539
+ declaredStatuses: [
1540
+ 400,
1541
+ 401,
1542
+ 404,
1543
+ 503
1544
+ ],
1545
+ empty: !1
1546
+ }, t).then((e) => e.data),
1547
+ update: (e, t) => d({
1548
+ method: "PUT",
1549
+ path: `/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}`,
1550
+ body: {
1551
+ attachmentID: e.attachmentID,
1552
+ size: e.size
1553
+ },
1554
+ successStatus: 200,
1555
+ declaredStatuses: [
1556
+ 400,
1557
+ 401,
1558
+ 404,
1559
+ 503
1560
+ ],
1561
+ empty: !1
1562
+ }, t).then((e) => e.data),
1563
+ snapshot: (e, t) => d({
1564
+ method: "GET",
1565
+ path: `/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}/snapshot`,
1566
+ successStatus: 200,
1567
+ declaredStatuses: [
1568
+ 400,
1569
+ 401,
1570
+ 404,
1571
+ 503
1572
+ ],
1573
+ empty: !1
1574
+ }, t).then((e) => e.data),
1575
+ remove: (e, t) => d({
1576
+ method: "DELETE",
1577
+ path: `/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}`,
1578
+ successStatus: 204,
1579
+ declaredStatuses: [
1580
+ 400,
1581
+ 401,
1582
+ 404,
1583
+ 503
1584
+ ],
1585
+ empty: !0
1586
+ }, t),
1587
+ connectToken: (e, t) => d({
1588
+ method: "POST",
1589
+ path: `/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}/connect-token`,
1590
+ headers: { "x-opencode-ticket": e["x-opencode-ticket"] },
1591
+ successStatus: 200,
1592
+ declaredStatuses: [
1593
+ 400,
1594
+ 401,
1595
+ 403,
1596
+ 404,
1597
+ 503
1598
+ ],
1599
+ empty: !1
1600
+ }, t).then((e) => e.data)
1601
+ } },
1602
+ shell: {
1603
+ list: (e, t) => d({
1604
+ method: "GET",
1605
+ path: "/api/shell",
1606
+ query: { location: e?.location },
1607
+ successStatus: 200,
1608
+ declaredStatuses: [400, 401],
1609
+ empty: !1
1610
+ }, t),
1611
+ create: (e, t) => d({
1612
+ method: "POST",
1613
+ path: "/api/shell",
1614
+ query: { location: e.location },
1615
+ body: {
1616
+ command: e.command,
1617
+ cwd: e.cwd,
1618
+ timeout: e.timeout,
1619
+ metadata: e.metadata
1620
+ },
1621
+ successStatus: 200,
1622
+ declaredStatuses: [400, 401],
1623
+ empty: !1
1624
+ }, t),
1625
+ get: (e, t) => d({
1626
+ method: "GET",
1627
+ path: `/api/shell/${encodeURIComponent(e.id)}`,
1628
+ query: { location: e.location },
1629
+ successStatus: 200,
1630
+ declaredStatuses: [
1631
+ 400,
1632
+ 401,
1633
+ 404
1634
+ ],
1635
+ empty: !1
1636
+ }, t),
1637
+ output: (e, t) => d({
1638
+ method: "GET",
1639
+ path: `/api/shell/${encodeURIComponent(e.id)}/output`,
1640
+ query: {
1641
+ location: e.location,
1642
+ cursor: e.cursor,
1643
+ limit: e.limit
1644
+ },
1645
+ successStatus: 200,
1646
+ declaredStatuses: [
1647
+ 400,
1648
+ 401,
1649
+ 404
1650
+ ],
1651
+ empty: !1
1652
+ }, t),
1653
+ remove: (e, t) => d({
1654
+ method: "DELETE",
1655
+ path: `/api/shell/${encodeURIComponent(e.id)}`,
1656
+ query: { location: e.location },
1657
+ successStatus: 204,
1658
+ declaredStatuses: [400, 401],
1659
+ empty: !0
1660
+ }, t)
1661
+ },
1662
+ reference: { list: (e, t) => d({
1663
+ method: "GET",
1664
+ path: "/api/reference",
1665
+ query: { location: e?.location },
1666
+ successStatus: 200,
1667
+ declaredStatuses: [400, 401],
1668
+ empty: !1
1669
+ }, t) },
1670
+ worktree: {
1671
+ list: (e, t) => d({
1672
+ method: "GET",
1673
+ path: "/api/worktree",
1674
+ query: { projectID: e.projectID },
1675
+ successStatus: 200,
1676
+ declaredStatuses: [
1677
+ 400,
1678
+ 401,
1679
+ 404
1680
+ ],
1681
+ empty: !1
1682
+ }, t),
1683
+ create: (e, t) => d({
1684
+ method: "POST",
1685
+ path: "/api/worktree",
1686
+ body: {
1687
+ projectID: e.projectID,
1688
+ from: e.from,
1689
+ branch: e.branch,
1690
+ directory: e.directory,
1691
+ name: e.name
1692
+ },
1693
+ successStatus: 200,
1694
+ declaredStatuses: [
1695
+ 400,
1696
+ 401,
1697
+ 404
1698
+ ],
1699
+ empty: !1
1700
+ }, t),
1701
+ remove: (e, t) => d({
1702
+ method: "DELETE",
1703
+ path: "/api/worktree",
1704
+ body: {
1705
+ projectID: e.projectID,
1706
+ directory: e.directory,
1707
+ force: e.force
1708
+ },
1709
+ successStatus: 204,
1710
+ declaredStatuses: [
1711
+ 400,
1712
+ 401,
1713
+ 404
1714
+ ],
1715
+ empty: !0
1716
+ }, t),
1717
+ refresh: (e, t) => d({
1718
+ method: "POST",
1719
+ path: "/api/worktree/refresh",
1720
+ body: { projectID: e.projectID },
1721
+ successStatus: 204,
1722
+ declaredStatuses: [
1723
+ 400,
1724
+ 401,
1725
+ 404
1726
+ ],
1727
+ empty: !0
1728
+ }, t)
1729
+ },
1730
+ vcs: {
1731
+ get: (e, t) => d({
1732
+ method: "GET",
1733
+ path: "/api/vcs",
1734
+ query: { location: e?.location },
1735
+ successStatus: 200,
1736
+ declaredStatuses: [400, 401],
1737
+ empty: !1
1738
+ }, t),
1739
+ base: (e, t) => d({
1740
+ method: "GET",
1741
+ path: "/api/vcs/base",
1742
+ query: { location: e?.location },
1743
+ successStatus: 200,
1744
+ declaredStatuses: [
1745
+ 400,
1746
+ 401,
1747
+ 503
1748
+ ],
1749
+ empty: !1
1750
+ }, t),
1751
+ status: (e, t) => d({
1752
+ method: "GET",
1753
+ path: "/api/vcs/status",
1754
+ query: { location: e?.location },
1755
+ successStatus: 200,
1756
+ declaredStatuses: [400, 401],
1757
+ empty: !1
1758
+ }, t),
1759
+ branch: { list: (e, t) => d({
1760
+ method: "GET",
1761
+ path: "/api/vcs/branch",
1762
+ query: {
1763
+ location: e?.location,
1764
+ search: e?.search,
1765
+ limit: e?.limit
1766
+ },
1767
+ successStatus: 200,
1768
+ declaredStatuses: [400, 401],
1769
+ empty: !1
1770
+ }, t) },
1771
+ diff: (e, t) => d({
1772
+ method: "GET",
1773
+ path: "/api/vcs/diff",
1774
+ query: {
1775
+ location: e.location,
1776
+ mode: e.mode,
1777
+ base: e.base,
1778
+ context: e.context
1779
+ },
1780
+ successStatus: 200,
1781
+ declaredStatuses: [
1782
+ 400,
1783
+ 401,
1784
+ 503
1785
+ ],
1786
+ empty: !1
1787
+ }, t)
1788
+ },
1789
+ debug: { location: {
1790
+ list: (e) => d({
1791
+ method: "GET",
1792
+ path: "/api/debug/location",
1793
+ successStatus: 200,
1794
+ declaredStatuses: [400, 401],
1795
+ empty: !1
1796
+ }, e),
1797
+ evict: (e, t) => d({
1798
+ method: "DELETE",
1799
+ path: "/api/debug/location",
1800
+ query: { location: e?.location },
1801
+ successStatus: 204,
1802
+ declaredStatuses: [400, 401],
1803
+ empty: !0
1804
+ }, t)
1805
+ } },
1806
+ migration: { v1: { status: (e) => d({
1807
+ method: "GET",
1808
+ path: "/api/experimental/migration/v1",
1809
+ successStatus: 200,
1810
+ declaredStatuses: [400, 401],
1811
+ empty: !1
1812
+ }, e) } },
1813
+ websearch: {
1814
+ providers: (e, t) => d({
1815
+ method: "GET",
1816
+ path: "/api/websearch/provider",
1817
+ query: { location: e?.location },
1818
+ successStatus: 200,
1819
+ declaredStatuses: [
1820
+ 400,
1821
+ 401,
1822
+ 503
1823
+ ],
1824
+ empty: !1
1825
+ }, t),
1826
+ query: (e, t) => d({
1827
+ method: "POST",
1828
+ path: "/api/websearch",
1829
+ query: { location: e.location },
1830
+ body: {
1831
+ query: e.query,
1832
+ providerID: e.providerID
1833
+ },
1834
+ successStatus: 200,
1835
+ declaredStatuses: [
1836
+ 400,
1837
+ 401,
1838
+ 503
1839
+ ],
1840
+ empty: !1
1841
+ }, t)
1842
+ },
1843
+ config: {
1844
+ get: (e, t) => d({
1845
+ method: "GET",
1846
+ path: "/api/config",
1847
+ query: { location: e?.location },
1848
+ successStatus: 200,
1849
+ declaredStatuses: [400, 401],
1850
+ empty: !1
1851
+ }, t),
1852
+ shells: (e) => d({
1853
+ method: "GET",
1854
+ path: "/api/config/shell",
1855
+ successStatus: 200,
1856
+ declaredStatuses: [400, 401],
1857
+ empty: !1
1858
+ }, e),
1859
+ update: (e, t) => d({
1860
+ method: "PATCH",
1861
+ path: "/api/experimental/config",
1862
+ body: { shell: e.shell },
1863
+ successStatus: 204,
1864
+ declaredStatuses: [400, 401],
1865
+ empty: !0
1866
+ }, t)
1867
+ }
1868
+ };
1869
+ }
1870
+ function o(e) {
1871
+ return e.split("/").map(encodeURIComponent).join("/");
1872
+ }
1873
+ function s(e, t, n) {
1874
+ if (n !== void 0) {
1875
+ if (n === null) {
1876
+ e.append(t, "null");
1877
+ return;
1878
+ }
1879
+ if (Array.isArray(n)) {
1880
+ for (let r of n) s(e, t, r);
1881
+ return;
1882
+ }
1883
+ if (typeof n == "object") {
1884
+ for (let [r, i] of Object.entries(n)) s(e, `${t}[${r}]`, i);
1885
+ return;
1886
+ }
1887
+ e.append(t, String(n));
1888
+ }
1889
+ }
1890
+ async function c(e) {
1891
+ if (!l(e, "application/json") && !e.headers.get("content-type")?.includes("+json")) {
1892
+ try {
1893
+ await e.body?.cancel();
1894
+ } catch {}
1895
+ throw new r("UnsupportedContentType");
1896
+ }
1897
+ let t;
1898
+ try {
1899
+ t = await e.text();
1900
+ } catch (e) {
1901
+ throw new r("Transport", { cause: e });
1902
+ }
1903
+ if (t === "") throw new r("MalformedResponse");
1904
+ try {
1905
+ return JSON.parse(t);
1906
+ } catch (e) {
1907
+ throw new r("MalformedResponse", { cause: e });
1908
+ }
1909
+ }
1910
+ function l(e, t) {
1911
+ return e.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase() === t;
1912
+ }
1913
+ //#endregion
1914
+ //#region ../../node_modules/.pnpm/@opencode+client@2.0.12_effect@4.0.0-rc.112/node_modules/@opencode/client/dist/chunks/service-contender-4tveyqeh.js
1915
+ var u = (e) => typeof e == "object" && !!e && "_tag" in e && e._tag === "RpcError", d = (e) => typeof e == "object" && !!e && "_tag" in e && e._tag === "RpcInternalError";
1916
+ //#endregion
1917
+ //#region ../../node_modules/.pnpm/@opencode+client@2.0.12_effect@4.0.0-rc.112/node_modules/@opencode/client/dist/chunks/service-contender-1tbj6z39.js
1918
+ function f(e, t) {
1919
+ return (n) => {
1920
+ let r = (e, r) => {
1921
+ if (!Object.hasOwn(n.events, e)) throw Error(`Unknown RPC event: ${n.id}.${e}`);
1922
+ let i = p(n, e);
1923
+ return { [Symbol.asyncIterator]() {
1924
+ let e = new AbortController(), n = r?.signal ? AbortSignal.any([e.signal, r.signal]) : e.signal, a = async function* () {
1925
+ try {
1926
+ for await (let e of t.subscribe({ signal: n })) {
1927
+ if (n.aborted) return;
1928
+ e.type === i && (yield e);
1929
+ }
1930
+ } catch (e) {
1931
+ if (!n.aborted) throw e;
1932
+ } finally {
1933
+ e.abort();
1934
+ }
1935
+ }();
1936
+ return {
1937
+ next: () => a.next(),
1938
+ return: () => (e.abort(), a.return())
1939
+ };
1940
+ } };
1941
+ };
1942
+ return Object.assign(Object.fromEntries(Object.keys(n.methods).map((t) => [t, async (r, i) => {
1943
+ try {
1944
+ return (await e.rpc.call({
1945
+ rpcID: n.id,
1946
+ method: t,
1947
+ input: r,
1948
+ location: i?.location
1949
+ }, {
1950
+ signal: i?.signal,
1951
+ headers: i?.headers
1952
+ })).output;
1953
+ } catch (e) {
1954
+ throw !u(e) && !d(e) ? e : e.data === void 0 ? {
1955
+ type: e.type,
1956
+ message: e.message
1957
+ } : {
1958
+ type: e.type,
1959
+ message: e.message,
1960
+ data: e.data
1961
+ };
1962
+ }
1963
+ }])), { events: {
1964
+ subscribe: r,
1965
+ on: (e, t, n) => {
1966
+ let i = new AbortController(), a = n?.signal ? AbortSignal.any([i.signal, n.signal]) : i.signal, o = r(e, { signal: a });
1967
+ return (async () => {
1968
+ for await (let e of o) await t(e);
1969
+ })().catch((e) => console.error(e)), () => i.abort();
1970
+ }
1971
+ } });
1972
+ };
1973
+ }
1974
+ function p(e, t) {
1975
+ return `rpc.${e.id}.${t}`;
1976
+ }
1977
+ //#endregion
1978
+ //#region ../../node_modules/.pnpm/@opencode+client@2.0.12_effect@4.0.0-rc.112/node_modules/@opencode/client/dist/chunks/service-contender-sehc34my.js
1979
+ var m = {};
1980
+ e(m, {
1981
+ OpenCode: () => m,
1982
+ make: () => h
1983
+ });
1984
+ function h(e) {
1985
+ let t = a(e), r = n((e, n) => t.event.subscribe({
1986
+ signal: e,
1987
+ onActivity: n
1988
+ }));
1989
+ return {
1990
+ ...t,
1991
+ rpc: Object.assign(f(t, r), t.rpc),
1992
+ event: r
1993
+ };
1994
+ }
1995
+ //#endregion
1996
+ export { r as ClientError, m as OpenCode };
1997
+
1998
+ //# sourceMappingURL=promise-B3UhYSzv.js.map