@zyraxon-ai/client 19.0.3 → 19.0.5

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.
Files changed (56) hide show
  1. package/dist/contract.d.ts +35 -0
  2. package/dist/contract.d.ts.map +1 -0
  3. package/dist/contract.js +45 -0
  4. package/dist/contract.js.map +1 -0
  5. package/dist/effect.d.ts +24 -0
  6. package/dist/effect.d.ts.map +1 -0
  7. package/dist/effect.js +25 -0
  8. package/dist/effect.js.map +1 -0
  9. package/dist/generated/client-error.d.ts +7 -0
  10. package/dist/generated/client-error.d.ts.map +1 -0
  11. package/dist/generated/client-error.js +9 -0
  12. package/dist/generated/client-error.js.map +1 -0
  13. package/dist/generated/client.d.ts +791 -0
  14. package/dist/generated/client.d.ts.map +1 -0
  15. package/dist/generated/client.js +679 -0
  16. package/dist/generated/client.js.map +1 -0
  17. package/dist/generated/index.d.ts +4 -0
  18. package/dist/generated/index.d.ts.map +1 -0
  19. package/dist/generated/index.js +4 -0
  20. package/dist/generated/index.js.map +1 -0
  21. package/dist/generated/types.d.ts +4228 -0
  22. package/dist/generated/types.d.ts.map +1 -0
  23. package/dist/generated/types.js +14 -0
  24. package/dist/generated/types.js.map +1 -0
  25. package/dist/generated-effect/client-error.d.ts +8 -0
  26. package/dist/generated-effect/client-error.d.ts.map +1 -0
  27. package/dist/generated-effect/client-error.js +6 -0
  28. package/dist/generated-effect/client-error.js.map +1 -0
  29. package/dist/generated-effect/client.d.ts +401 -0
  30. package/dist/generated-effect/client.d.ts.map +1 -0
  31. package/dist/generated-effect/client.js +253 -0
  32. package/dist/generated-effect/client.js.map +1 -0
  33. package/dist/generated-effect/index.d.ts +3 -0
  34. package/dist/generated-effect/index.d.ts.map +1 -0
  35. package/dist/generated-effect/index.js +3 -0
  36. package/dist/generated-effect/index.js.map +1 -0
  37. package/dist/index.d.ts +3 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +2 -0
  40. package/dist/index.js.map +1 -0
  41. package/package.json +25 -14
  42. package/script/build.ts +0 -30
  43. package/src/contract.ts +0 -53
  44. package/src/effect.ts +0 -25
  45. package/src/generated/.httpapi-codegen.json +0 -6
  46. package/src/generated/client-error.ts +0 -11
  47. package/src/generated/client.ts +0 -1029
  48. package/src/generated/index.ts +0 -3
  49. package/src/generated/types.ts +0 -2807
  50. package/src/generated-effect/.httpapi-codegen.json +0 -5
  51. package/src/generated-effect/client-error.ts +0 -5
  52. package/src/generated-effect/client.ts +0 -706
  53. package/src/generated-effect/index.ts +0 -2
  54. package/src/index.ts +0 -2
  55. package/sst-env.d.ts +0 -10
  56. package/tsconfig.json +0 -9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/generated/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EAGnB,gBAAgB,EAEhB,wBAAwB,EAExB,wBAAwB,EAExB,mBAAmB,EAEnB,oBAAoB,EAEpB,iBAAiB,EAEjB,kBAAkB,EAElB,kBAAkB,EAElB,mBAAmB,EAEnB,oBAAoB,EAEpB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EAEtB,oBAAoB,EAEpB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,2BAA2B,EAE3B,6BAA6B,EAC7B,8BAA8B,EAC9B,8BAA8B,EAC9B,+BAA+B,EAC/B,gCAAgC,EAEhC,8BAA8B,EAE9B,sBAAsB,EAEtB,sBAAsB,EAEtB,4BAA4B,EAC5B,6BAA6B,EAC7B,yBAAyB,EAEzB,2BAA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4BAA4B,mBAAmB,cAAc;4BAYhE,yBAAyB,mBAAmB,cAAc;;;;;;6BAYzD,2BAA2B,mBAAmB,cAAc;wBAWjE,sBAAsB,mBAAmB,cAAc;;;;sBAoBzD,oBAAoB,mBAAmB,cAAc;;;;;;;;;;;;;;;qBAWtD,mBAAmB,mBAAmB,cAAc;;;;;;;;;;;;;;;uBAWlD,qBAAqB,mBAAmB,cAAc;;;uBActD,cAAc,mBAAmB,cAAc;sBAYhD,cAAc,mBAAmB,cAAc;;;uBAc9C,iBAAiB,mBAAmB,cAAc;;;uBAclD,eAAe,mBAAmB,cAAc;;;qCAclC,cAAc,KAAG,aAAa,CAAC,qBAAqB,CAAC;;;uBAOnE,aAAa,mBAAmB,cAAc;yBAY5C,eAAe,mBAAmB,cAAc;qBAmBpD,YAAY,mBAAmB,cAAc;wBAY1C,eAAe,mBAAmB,cAAc;wBAahD,eAAe,mBAAmB,cAAc;;;+BAczC,0BAA0B,mBAAmB,cAAc;sBAYpE,kBAAkB,mBAAmB,cAAc;;;;;;;;;;iCAiI6opE,CAAC;+BAA+B,CAAC;;;;;;;uBAtHhupE,mBAAmB,mBAAmB,cAAc;wBAYnD,oBAAoB,mBAAmB,cAAc;;;uBAatD,mBAAmB,mBAAmB,cAAc;;;wBAcnD,wBAAwB,mBAAmB,cAAc;wBAazD,wBAAwB,mBAAmB,cAAc;yBAaxD,yBAAyB,mBAAmB,cAAc;;EAchF"}
@@ -0,0 +1,679 @@
1
+ import { ClientError } from "./client-error";
2
+ export function make(options) {
3
+ const fetch = options.fetch ?? globalThis.fetch;
4
+ const prepare = (descriptor, requestOptions) => {
5
+ const url = new URL(descriptor.path, options.baseUrl);
6
+ for (const [key, value] of Object.entries(descriptor.query ?? {}))
7
+ appendQuery(url.searchParams, key, value);
8
+ const headers = new Headers(options.headers);
9
+ for (const [key, value] of Object.entries(descriptor.headers ?? {})) {
10
+ if (value !== undefined && value !== null)
11
+ headers.set(key, String(value));
12
+ }
13
+ for (const [key, value] of new Headers(requestOptions?.headers))
14
+ headers.set(key, value);
15
+ if (descriptor.body !== undefined && !headers.has("content-type"))
16
+ headers.set("content-type", "application/json");
17
+ return {
18
+ url,
19
+ init: {
20
+ method: descriptor.method,
21
+ signal: requestOptions?.signal,
22
+ headers,
23
+ body: descriptor.body === undefined ? undefined : JSON.stringify(descriptor.body),
24
+ },
25
+ };
26
+ };
27
+ const execute = async (descriptor, requestOptions) => {
28
+ try {
29
+ const prepared = prepare(descriptor, requestOptions);
30
+ return await fetch(prepared.url, prepared.init);
31
+ }
32
+ catch (cause) {
33
+ throw new ClientError("Transport", { cause });
34
+ }
35
+ };
36
+ const responseError = async (response, descriptor) => {
37
+ if (descriptor.declaredStatuses.includes(response.status))
38
+ throw await json(response);
39
+ try {
40
+ await response.body?.cancel();
41
+ }
42
+ catch { }
43
+ throw new ClientError("UnexpectedStatus", { cause: { status: response.status } });
44
+ };
45
+ const request = async (descriptor, requestOptions) => {
46
+ const response = await execute(descriptor, requestOptions);
47
+ if (response.status !== descriptor.successStatus)
48
+ return responseError(response, descriptor);
49
+ if (descriptor.empty) {
50
+ try {
51
+ await response.body?.cancel();
52
+ }
53
+ catch { }
54
+ return undefined;
55
+ }
56
+ return (await json(response));
57
+ };
58
+ const sse = (descriptor, requestOptions) => ({
59
+ async *[Symbol.asyncIterator]() {
60
+ const response = await execute(descriptor, requestOptions);
61
+ if (response.status !== descriptor.successStatus)
62
+ await responseError(response, descriptor);
63
+ if (!isContentType(response, "text/event-stream")) {
64
+ try {
65
+ await response.body?.cancel();
66
+ }
67
+ catch { }
68
+ throw new ClientError("UnsupportedContentType");
69
+ }
70
+ if (response.body === null)
71
+ throw new ClientError("MalformedResponse");
72
+ const reader = response.body.getReader();
73
+ const decoder = new TextDecoder();
74
+ let buffer = "";
75
+ try {
76
+ while (true) {
77
+ let next;
78
+ try {
79
+ next = await reader.read();
80
+ }
81
+ catch (cause) {
82
+ throw new ClientError("Transport", { cause });
83
+ }
84
+ buffer += decoder.decode(next.value, { stream: !next.done });
85
+ if (buffer.length > 1_048_576)
86
+ throw new ClientError("MalformedResponse");
87
+ const trailingCarriageReturn = !next.done && buffer.endsWith("\r");
88
+ if (trailingCarriageReturn)
89
+ buffer = buffer.slice(0, -1);
90
+ buffer = buffer.replaceAll("\r\n", "\n").replaceAll("\r", "\n");
91
+ if (trailingCarriageReturn)
92
+ buffer += "\r";
93
+ if (next.done && buffer !== "")
94
+ buffer += "\n\n";
95
+ let boundary = buffer.indexOf("\n\n");
96
+ while (boundary >= 0) {
97
+ const block = buffer.slice(0, boundary);
98
+ buffer = buffer.slice(boundary + 2);
99
+ const data = block
100
+ .split("\n")
101
+ .flatMap((line) => (line.startsWith("data:") ? [line.slice(5).trimStart()] : []))
102
+ .join("\n");
103
+ if (data !== "") {
104
+ try {
105
+ yield JSON.parse(data);
106
+ }
107
+ catch (cause) {
108
+ throw new ClientError("MalformedResponse", { cause });
109
+ }
110
+ }
111
+ boundary = buffer.indexOf("\n\n");
112
+ }
113
+ if (next.done)
114
+ return;
115
+ }
116
+ }
117
+ finally {
118
+ try {
119
+ await reader.cancel();
120
+ }
121
+ catch { }
122
+ reader.releaseLock();
123
+ }
124
+ },
125
+ });
126
+ return {
127
+ health: {
128
+ get: (requestOptions) => request({ method: "GET", path: `/api/health`, successStatus: 200, declaredStatuses: [401, 400], empty: false }, requestOptions),
129
+ },
130
+ location: {
131
+ get: (input, requestOptions) => request({
132
+ method: "GET",
133
+ path: `/api/location`,
134
+ query: { location: input?.["location"] },
135
+ successStatus: 200,
136
+ declaredStatuses: [401, 400],
137
+ empty: false,
138
+ }, requestOptions),
139
+ },
140
+ agents: {
141
+ list: (input, requestOptions) => request({
142
+ method: "GET",
143
+ path: `/api/agent`,
144
+ query: { location: input?.["location"] },
145
+ successStatus: 200,
146
+ declaredStatuses: [401, 400],
147
+ empty: false,
148
+ }, requestOptions),
149
+ },
150
+ sessions: {
151
+ list: (input, requestOptions) => request({
152
+ method: "GET",
153
+ path: `/api/session`,
154
+ query: {
155
+ workspace: input?.["workspace"],
156
+ limit: input?.["limit"],
157
+ order: input?.["order"],
158
+ search: input?.["search"],
159
+ directory: input?.["directory"],
160
+ project: input?.["project"],
161
+ subpath: input?.["subpath"],
162
+ cursor: input?.["cursor"],
163
+ },
164
+ successStatus: 200,
165
+ declaredStatuses: [400, 401],
166
+ empty: false,
167
+ }, requestOptions),
168
+ create: (input, requestOptions) => request({
169
+ method: "POST",
170
+ path: `/api/session`,
171
+ body: {
172
+ id: input?.["id"],
173
+ agent: input?.["agent"],
174
+ model: input?.["model"],
175
+ location: input?.["location"],
176
+ },
177
+ successStatus: 200,
178
+ declaredStatuses: [401, 400],
179
+ empty: false,
180
+ }, requestOptions).then((value) => value.data),
181
+ active: (requestOptions) => request({
182
+ method: "GET",
183
+ path: `/api/session/active`,
184
+ successStatus: 200,
185
+ declaredStatuses: [401, 400],
186
+ empty: false,
187
+ }, requestOptions).then((value) => value.data),
188
+ get: (input, requestOptions) => request({
189
+ method: "GET",
190
+ path: `/api/session/${encodeURIComponent(input.sessionID)}`,
191
+ successStatus: 200,
192
+ declaredStatuses: [404, 400, 401],
193
+ empty: false,
194
+ }, requestOptions).then((value) => value.data),
195
+ switchAgent: (input, requestOptions) => request({
196
+ method: "POST",
197
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/agent`,
198
+ body: { agent: input["agent"] },
199
+ successStatus: 204,
200
+ declaredStatuses: [404, 400, 401],
201
+ empty: true,
202
+ }, requestOptions),
203
+ switchModel: (input, requestOptions) => request({
204
+ method: "POST",
205
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/model`,
206
+ body: { model: input["model"] },
207
+ successStatus: 204,
208
+ declaredStatuses: [404, 400, 401],
209
+ empty: true,
210
+ }, requestOptions),
211
+ prompt: (input, requestOptions) => request({
212
+ method: "POST",
213
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/prompt`,
214
+ body: { id: input["id"], prompt: input["prompt"], delivery: input["delivery"], resume: input["resume"] },
215
+ successStatus: 200,
216
+ declaredStatuses: [409, 404, 400, 401],
217
+ empty: false,
218
+ }, requestOptions).then((value) => value.data),
219
+ compact: (input, requestOptions) => request({
220
+ method: "POST",
221
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/compact`,
222
+ successStatus: 204,
223
+ declaredStatuses: [404, 503, 400, 401],
224
+ empty: true,
225
+ }, requestOptions),
226
+ wait: (input, requestOptions) => request({
227
+ method: "POST",
228
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/wait`,
229
+ successStatus: 204,
230
+ declaredStatuses: [404, 503, 400, 401],
231
+ empty: true,
232
+ }, requestOptions),
233
+ stage: (input, requestOptions) => request({
234
+ method: "POST",
235
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/revert/stage`,
236
+ body: { messageID: input["messageID"], files: input["files"] },
237
+ successStatus: 200,
238
+ declaredStatuses: [404, 500, 400, 401],
239
+ empty: false,
240
+ }, requestOptions).then((value) => value.data),
241
+ clear: (input, requestOptions) => request({
242
+ method: "POST",
243
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/revert/clear`,
244
+ successStatus: 204,
245
+ declaredStatuses: [404, 500, 400, 401],
246
+ empty: true,
247
+ }, requestOptions),
248
+ commit: (input, requestOptions) => request({
249
+ method: "POST",
250
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/revert/commit`,
251
+ successStatus: 204,
252
+ declaredStatuses: [404, 400, 401],
253
+ empty: true,
254
+ }, requestOptions),
255
+ context: (input, requestOptions) => request({
256
+ method: "GET",
257
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/context`,
258
+ successStatus: 200,
259
+ declaredStatuses: [404, 500, 400, 401],
260
+ empty: false,
261
+ }, requestOptions).then((value) => value.data),
262
+ history: (input, requestOptions) => request({
263
+ method: "GET",
264
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/history`,
265
+ query: { limit: input["limit"], after: input["after"] },
266
+ successStatus: 200,
267
+ declaredStatuses: [404, 400, 401],
268
+ empty: false,
269
+ }, requestOptions),
270
+ events: (input, requestOptions) => sse({
271
+ method: "GET",
272
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/event`,
273
+ query: { after: input["after"] },
274
+ successStatus: 200,
275
+ declaredStatuses: [404, 400, 401],
276
+ empty: false,
277
+ }, requestOptions),
278
+ interrupt: (input, requestOptions) => request({
279
+ method: "POST",
280
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/interrupt`,
281
+ successStatus: 204,
282
+ declaredStatuses: [404, 400, 401],
283
+ empty: true,
284
+ }, requestOptions),
285
+ message: (input, requestOptions) => request({
286
+ method: "GET",
287
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/message/${encodeURIComponent(input.messageID)}`,
288
+ successStatus: 200,
289
+ declaredStatuses: [404, 400, 401],
290
+ empty: false,
291
+ }, requestOptions).then((value) => value.data),
292
+ },
293
+ messages: {
294
+ list: (input, requestOptions) => request({
295
+ method: "GET",
296
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/message`,
297
+ query: { limit: input["limit"], order: input["order"], cursor: input["cursor"] },
298
+ successStatus: 200,
299
+ declaredStatuses: [400, 404, 500, 401],
300
+ empty: false,
301
+ }, requestOptions),
302
+ },
303
+ models: {
304
+ list: (input, requestOptions) => request({
305
+ method: "GET",
306
+ path: `/api/model`,
307
+ query: { location: input?.["location"] },
308
+ successStatus: 200,
309
+ declaredStatuses: [503, 401, 400],
310
+ empty: false,
311
+ }, requestOptions),
312
+ },
313
+ providers: {
314
+ list: (input, requestOptions) => request({
315
+ method: "GET",
316
+ path: `/api/provider`,
317
+ query: { location: input?.["location"] },
318
+ successStatus: 200,
319
+ declaredStatuses: [503, 401, 400],
320
+ empty: false,
321
+ }, requestOptions),
322
+ get: (input, requestOptions) => request({
323
+ method: "GET",
324
+ path: `/api/provider/${encodeURIComponent(input.providerID)}`,
325
+ query: { location: input["location"] },
326
+ successStatus: 200,
327
+ declaredStatuses: [404, 503, 401, 400],
328
+ empty: false,
329
+ }, requestOptions),
330
+ },
331
+ integrations: {
332
+ list: (input, requestOptions) => request({
333
+ method: "GET",
334
+ path: `/api/integration`,
335
+ query: { location: input?.["location"] },
336
+ successStatus: 200,
337
+ declaredStatuses: [401, 400],
338
+ empty: false,
339
+ }, requestOptions),
340
+ get: (input, requestOptions) => request({
341
+ method: "GET",
342
+ path: `/api/integration/${encodeURIComponent(input.integrationID)}`,
343
+ query: { location: input["location"] },
344
+ successStatus: 200,
345
+ declaredStatuses: [401, 400],
346
+ empty: false,
347
+ }, requestOptions),
348
+ connectKey: (input, requestOptions) => request({
349
+ method: "POST",
350
+ path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/key`,
351
+ query: { location: input["location"] },
352
+ body: { key: input["key"], label: input["label"] },
353
+ successStatus: 204,
354
+ declaredStatuses: [400, 401],
355
+ empty: true,
356
+ }, requestOptions),
357
+ connectOauth: (input, requestOptions) => request({
358
+ method: "POST",
359
+ path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/oauth`,
360
+ query: { location: input["location"] },
361
+ body: { methodID: input["methodID"], inputs: input["inputs"], label: input["label"] },
362
+ successStatus: 200,
363
+ declaredStatuses: [400, 401],
364
+ empty: false,
365
+ }, requestOptions),
366
+ attemptStatus: (input, requestOptions) => request({
367
+ method: "GET",
368
+ path: `/api/integration/attempt/${encodeURIComponent(input.attemptID)}`,
369
+ query: { location: input["location"] },
370
+ successStatus: 200,
371
+ declaredStatuses: [401, 400],
372
+ empty: false,
373
+ }, requestOptions),
374
+ attemptComplete: (input, requestOptions) => request({
375
+ method: "POST",
376
+ path: `/api/integration/attempt/${encodeURIComponent(input.attemptID)}/complete`,
377
+ query: { location: input["location"] },
378
+ body: { code: input["code"] },
379
+ successStatus: 204,
380
+ declaredStatuses: [400, 401],
381
+ empty: true,
382
+ }, requestOptions),
383
+ attemptCancel: (input, requestOptions) => request({
384
+ method: "DELETE",
385
+ path: `/api/integration/attempt/${encodeURIComponent(input.attemptID)}`,
386
+ query: { location: input["location"] },
387
+ successStatus: 204,
388
+ declaredStatuses: [401, 400],
389
+ empty: true,
390
+ }, requestOptions),
391
+ },
392
+ credentials: {
393
+ update: (input, requestOptions) => request({
394
+ method: "PATCH",
395
+ path: `/api/credential/${encodeURIComponent(input.credentialID)}`,
396
+ query: { location: input["location"] },
397
+ body: { label: input["label"] },
398
+ successStatus: 204,
399
+ declaredStatuses: [401, 400],
400
+ empty: true,
401
+ }, requestOptions),
402
+ remove: (input, requestOptions) => request({
403
+ method: "DELETE",
404
+ path: `/api/credential/${encodeURIComponent(input.credentialID)}`,
405
+ query: { location: input["location"] },
406
+ successStatus: 204,
407
+ declaredStatuses: [401, 400],
408
+ empty: true,
409
+ }, requestOptions),
410
+ },
411
+ permissions: {
412
+ listRequests: (input, requestOptions) => request({
413
+ method: "GET",
414
+ path: `/api/permission/request`,
415
+ query: { location: input?.["location"] },
416
+ successStatus: 200,
417
+ declaredStatuses: [401, 400],
418
+ empty: false,
419
+ }, requestOptions),
420
+ listSaved: (input, requestOptions) => request({
421
+ method: "GET",
422
+ path: `/api/permission/saved`,
423
+ query: { projectID: input?.["projectID"] },
424
+ successStatus: 200,
425
+ declaredStatuses: [401, 400],
426
+ empty: false,
427
+ }, requestOptions).then((value) => value.data),
428
+ removeSaved: (input, requestOptions) => request({
429
+ method: "DELETE",
430
+ path: `/api/permission/saved/${encodeURIComponent(input.id)}`,
431
+ successStatus: 204,
432
+ declaredStatuses: [401, 400],
433
+ empty: true,
434
+ }, requestOptions),
435
+ create: (input, requestOptions) => request({
436
+ method: "POST",
437
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/permission`,
438
+ body: {
439
+ id: input["id"],
440
+ action: input["action"],
441
+ resources: input["resources"],
442
+ save: input["save"],
443
+ metadata: input["metadata"],
444
+ source: input["source"],
445
+ agent: input["agent"],
446
+ },
447
+ successStatus: 200,
448
+ declaredStatuses: [404, 400, 401],
449
+ empty: false,
450
+ }, requestOptions).then((value) => value.data),
451
+ list: (input, requestOptions) => request({
452
+ method: "GET",
453
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/permission`,
454
+ successStatus: 200,
455
+ declaredStatuses: [404, 400, 401],
456
+ empty: false,
457
+ }, requestOptions).then((value) => value.data),
458
+ get: (input, requestOptions) => request({
459
+ method: "GET",
460
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/permission/${encodeURIComponent(input.requestID)}`,
461
+ successStatus: 200,
462
+ declaredStatuses: [404, 400, 401],
463
+ empty: false,
464
+ }, requestOptions).then((value) => value.data),
465
+ reply: (input, requestOptions) => request({
466
+ method: "POST",
467
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/permission/${encodeURIComponent(input.requestID)}/reply`,
468
+ body: { reply: input["reply"], message: input["message"] },
469
+ successStatus: 204,
470
+ declaredStatuses: [404, 400, 401],
471
+ empty: true,
472
+ }, requestOptions),
473
+ },
474
+ files: {
475
+ list: (input, requestOptions) => request({
476
+ method: "GET",
477
+ path: `/api/fs/list`,
478
+ query: { location: input?.["location"], path: input?.["path"] },
479
+ successStatus: 200,
480
+ declaredStatuses: [401, 400],
481
+ empty: false,
482
+ }, requestOptions),
483
+ find: (input, requestOptions) => request({
484
+ method: "GET",
485
+ path: `/api/fs/find`,
486
+ query: { location: input["location"], query: input["query"], type: input["type"], limit: input["limit"] },
487
+ successStatus: 200,
488
+ declaredStatuses: [401, 400],
489
+ empty: false,
490
+ }, requestOptions),
491
+ },
492
+ commands: {
493
+ list: (input, requestOptions) => request({
494
+ method: "GET",
495
+ path: `/api/command`,
496
+ query: { location: input?.["location"] },
497
+ successStatus: 200,
498
+ declaredStatuses: [401, 400],
499
+ empty: false,
500
+ }, requestOptions),
501
+ },
502
+ skills: {
503
+ list: (input, requestOptions) => request({
504
+ method: "GET",
505
+ path: `/api/skill`,
506
+ query: { location: input?.["location"] },
507
+ successStatus: 200,
508
+ declaredStatuses: [401, 400],
509
+ empty: false,
510
+ }, requestOptions),
511
+ },
512
+ events: {
513
+ subscribe: (requestOptions) => sse({ method: "GET", path: `/api/event`, successStatus: 200, declaredStatuses: [401, 400], empty: false }, requestOptions),
514
+ },
515
+ ptys: {
516
+ list: (input, requestOptions) => request({
517
+ method: "GET",
518
+ path: `/api/pty`,
519
+ query: { location: input?.["location"] },
520
+ successStatus: 200,
521
+ declaredStatuses: [401, 400],
522
+ empty: false,
523
+ }, requestOptions),
524
+ create: (input, requestOptions) => request({
525
+ method: "POST",
526
+ path: `/api/pty`,
527
+ query: { location: input?.["location"] },
528
+ body: {
529
+ command: input?.["command"],
530
+ args: input?.["args"],
531
+ cwd: input?.["cwd"],
532
+ title: input?.["title"],
533
+ env: input?.["env"],
534
+ },
535
+ successStatus: 200,
536
+ declaredStatuses: [401, 400],
537
+ empty: false,
538
+ }, requestOptions),
539
+ get: (input, requestOptions) => request({
540
+ method: "GET",
541
+ path: `/api/pty/${encodeURIComponent(input.ptyID)}`,
542
+ query: { location: input["location"] },
543
+ successStatus: 200,
544
+ declaredStatuses: [404, 401, 400],
545
+ empty: false,
546
+ }, requestOptions),
547
+ update: (input, requestOptions) => request({
548
+ method: "PUT",
549
+ path: `/api/pty/${encodeURIComponent(input.ptyID)}`,
550
+ query: { location: input["location"] },
551
+ body: { title: input["title"], size: input["size"] },
552
+ successStatus: 200,
553
+ declaredStatuses: [404, 401, 400],
554
+ empty: false,
555
+ }, requestOptions),
556
+ remove: (input, requestOptions) => request({
557
+ method: "DELETE",
558
+ path: `/api/pty/${encodeURIComponent(input.ptyID)}`,
559
+ query: { location: input["location"] },
560
+ successStatus: 204,
561
+ declaredStatuses: [404, 401, 400],
562
+ empty: true,
563
+ }, requestOptions),
564
+ },
565
+ questions: {
566
+ listRequests: (input, requestOptions) => request({
567
+ method: "GET",
568
+ path: `/api/question/request`,
569
+ query: { location: input?.["location"] },
570
+ successStatus: 200,
571
+ declaredStatuses: [401, 400],
572
+ empty: false,
573
+ }, requestOptions),
574
+ list: (input, requestOptions) => request({
575
+ method: "GET",
576
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/question`,
577
+ successStatus: 200,
578
+ declaredStatuses: [404, 400, 401],
579
+ empty: false,
580
+ }, requestOptions).then((value) => value.data),
581
+ reply: (input, requestOptions) => request({
582
+ method: "POST",
583
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/question/${encodeURIComponent(input.requestID)}/reply`,
584
+ body: { answers: input["answers"] },
585
+ successStatus: 204,
586
+ declaredStatuses: [404, 400, 401],
587
+ empty: true,
588
+ }, requestOptions),
589
+ reject: (input, requestOptions) => request({
590
+ method: "POST",
591
+ path: `/api/session/${encodeURIComponent(input.sessionID)}/question/${encodeURIComponent(input.requestID)}/reject`,
592
+ successStatus: 204,
593
+ declaredStatuses: [404, 400, 401],
594
+ empty: true,
595
+ }, requestOptions),
596
+ },
597
+ references: {
598
+ list: (input, requestOptions) => request({
599
+ method: "GET",
600
+ path: `/api/reference`,
601
+ query: { location: input?.["location"] },
602
+ successStatus: 200,
603
+ declaredStatuses: [401, 400],
604
+ empty: false,
605
+ }, requestOptions),
606
+ },
607
+ projectCopies: {
608
+ create: (input, requestOptions) => request({
609
+ method: "POST",
610
+ path: `/experimental/project/${encodeURIComponent(input.projectID)}/copy`,
611
+ query: { location: input["location"] },
612
+ body: { strategy: input["strategy"], directory: input["directory"], name: input["name"] },
613
+ successStatus: 200,
614
+ declaredStatuses: [400, 401],
615
+ empty: false,
616
+ }, requestOptions),
617
+ remove: (input, requestOptions) => request({
618
+ method: "DELETE",
619
+ path: `/experimental/project/${encodeURIComponent(input.projectID)}/copy`,
620
+ query: { location: input["location"] },
621
+ body: { directory: input["directory"], force: input["force"] },
622
+ successStatus: 204,
623
+ declaredStatuses: [400, 401],
624
+ empty: true,
625
+ }, requestOptions),
626
+ refresh: (input, requestOptions) => request({
627
+ method: "POST",
628
+ path: `/experimental/project/${encodeURIComponent(input.projectID)}/copy/refresh`,
629
+ query: { location: input["location"] },
630
+ successStatus: 204,
631
+ declaredStatuses: [400, 401],
632
+ empty: true,
633
+ }, requestOptions),
634
+ },
635
+ };
636
+ }
637
+ function appendQuery(params, key, value) {
638
+ if (value === undefined || value === null)
639
+ return;
640
+ if (Array.isArray(value)) {
641
+ for (const item of value)
642
+ appendQuery(params, key, item);
643
+ return;
644
+ }
645
+ if (typeof value === "object") {
646
+ for (const [child, item] of Object.entries(value))
647
+ appendQuery(params, `${key}[${child}]`, item);
648
+ return;
649
+ }
650
+ params.append(key, String(value));
651
+ }
652
+ async function json(response) {
653
+ if (!isContentType(response, "application/json") && !response.headers.get("content-type")?.includes("+json")) {
654
+ try {
655
+ await response.body?.cancel();
656
+ }
657
+ catch { }
658
+ throw new ClientError("UnsupportedContentType");
659
+ }
660
+ let text;
661
+ try {
662
+ text = await response.text();
663
+ }
664
+ catch (cause) {
665
+ throw new ClientError("Transport", { cause });
666
+ }
667
+ if (text === "")
668
+ throw new ClientError("MalformedResponse");
669
+ try {
670
+ return JSON.parse(text);
671
+ }
672
+ catch (cause) {
673
+ throw new ClientError("MalformedResponse", { cause });
674
+ }
675
+ }
676
+ function isContentType(response, expected) {
677
+ return response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase() === expected;
678
+ }
679
+ //# sourceMappingURL=client.js.map