@gitterm/sdk 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/direct/index.js +1811 -271
- package/dist/direct/types.d.ts +59 -21
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +13 -0
- package/package.json +3 -3
package/dist/direct/index.js
CHANGED
|
@@ -30,7 +30,1678 @@ 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
|
|
34
|
+
var __defProp = Object.defineProperty;
|
|
35
|
+
var __returnValue = (v) => v;
|
|
36
|
+
function __exportSetter(name, newValue) {
|
|
37
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
38
|
+
}
|
|
39
|
+
var __export = (target, all) => {
|
|
40
|
+
for (var name in all)
|
|
41
|
+
__defProp(target, name, {
|
|
42
|
+
get: all[name],
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true,
|
|
45
|
+
set: __exportSetter.bind(all, name)
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// ../../node_modules/.bun/@opencode+client@2.0.19+43902b222b0d7d3e/node_modules/@opencode/client/dist/chunks/rpc-runtime-frbwqjmf.js
|
|
50
|
+
var exports_shared_events = {};
|
|
51
|
+
__export(exports_shared_events, {
|
|
52
|
+
SharedEvents: () => exports_shared_events,
|
|
53
|
+
make: () => make7
|
|
54
|
+
});
|
|
55
|
+
function make7(connect) {
|
|
56
|
+
let current;
|
|
57
|
+
const capacity = 4096;
|
|
58
|
+
function stop(connection) {
|
|
59
|
+
connection.connected = undefined;
|
|
60
|
+
connection.controller.abort();
|
|
61
|
+
if (current === connection)
|
|
62
|
+
current = undefined;
|
|
63
|
+
}
|
|
64
|
+
async function run(connection) {
|
|
65
|
+
let iterator;
|
|
66
|
+
let completion = {};
|
|
67
|
+
try {
|
|
68
|
+
if (connection.controller.signal.aborted)
|
|
69
|
+
return;
|
|
70
|
+
iterator = connect(connection.controller.signal, () => {
|
|
71
|
+
connection.subscribers.forEach((subscriber) => subscriber.activity?.());
|
|
72
|
+
})[Symbol.asyncIterator]();
|
|
73
|
+
while (!connection.controller.signal.aborted) {
|
|
74
|
+
const item = await iterator.next();
|
|
75
|
+
if (item.done || connection.controller.signal.aborted)
|
|
76
|
+
break;
|
|
77
|
+
if (item.value.type === "server.connected")
|
|
78
|
+
connection.connected = item.value;
|
|
79
|
+
connection.subscribers.forEach((subscriber) => subscriber.push(item.value));
|
|
80
|
+
}
|
|
81
|
+
} catch (error) {
|
|
82
|
+
completion = { error };
|
|
83
|
+
} finally {
|
|
84
|
+
stop(connection);
|
|
85
|
+
try {
|
|
86
|
+
await iterator?.return?.();
|
|
87
|
+
} catch (error) {
|
|
88
|
+
if (!("error" in completion))
|
|
89
|
+
completion = { error };
|
|
90
|
+
}
|
|
91
|
+
connection.subscribers.forEach((subscriber) => subscriber.finish(completion));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
subscribe(options) {
|
|
96
|
+
return {
|
|
97
|
+
[Symbol.asyncIterator]() {
|
|
98
|
+
const pending = [];
|
|
99
|
+
const queued = [];
|
|
100
|
+
let started = false;
|
|
101
|
+
let completion;
|
|
102
|
+
let connection;
|
|
103
|
+
function finish(result, discard = true) {
|
|
104
|
+
completion = result;
|
|
105
|
+
if (discard)
|
|
106
|
+
queued.length = 0;
|
|
107
|
+
options?.signal?.removeEventListener("abort", abort);
|
|
108
|
+
if (connection?.subscribers.delete(subscriber) && !connection.subscribers.size)
|
|
109
|
+
stop(connection);
|
|
110
|
+
pending.splice(0).forEach((request) => {
|
|
111
|
+
if ("error" in result)
|
|
112
|
+
request.reject(result.error);
|
|
113
|
+
else
|
|
114
|
+
request.resolve({ done: true, value: undefined });
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function abort() {
|
|
118
|
+
finish({});
|
|
119
|
+
}
|
|
120
|
+
const subscriber = {
|
|
121
|
+
activity: options?.onActivity,
|
|
122
|
+
finish(result) {
|
|
123
|
+
finish(result, false);
|
|
124
|
+
},
|
|
125
|
+
push(value) {
|
|
126
|
+
if (completion)
|
|
127
|
+
return;
|
|
128
|
+
const request = pending.shift();
|
|
129
|
+
if (request) {
|
|
130
|
+
request.resolve({ done: false, value });
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (queued.length === capacity) {
|
|
134
|
+
finish({ error: new Error(`Event subscriber exceeded its ${capacity}-event capacity`) });
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
queued.push(value);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
function start() {
|
|
141
|
+
if (completion)
|
|
142
|
+
return;
|
|
143
|
+
const fresh = !current;
|
|
144
|
+
connection = current ?? {
|
|
145
|
+
controller: new AbortController,
|
|
146
|
+
subscribers: new Set
|
|
147
|
+
};
|
|
148
|
+
current = connection;
|
|
149
|
+
connection.subscribers.add(subscriber);
|
|
150
|
+
if (connection.connected)
|
|
151
|
+
subscriber.push(connection.connected);
|
|
152
|
+
if (fresh)
|
|
153
|
+
run(connection);
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
next() {
|
|
157
|
+
const value = queued.shift();
|
|
158
|
+
if (value)
|
|
159
|
+
return Promise.resolve({ done: false, value });
|
|
160
|
+
if (completion) {
|
|
161
|
+
if ("error" in completion)
|
|
162
|
+
return Promise.reject(completion.error);
|
|
163
|
+
return Promise.resolve({ done: true, value: undefined });
|
|
164
|
+
}
|
|
165
|
+
if (options?.signal?.aborted) {
|
|
166
|
+
abort();
|
|
167
|
+
return Promise.resolve({ done: true, value: undefined });
|
|
168
|
+
}
|
|
169
|
+
const request = Promise.withResolvers();
|
|
170
|
+
pending.push(request);
|
|
171
|
+
if (!started) {
|
|
172
|
+
started = true;
|
|
173
|
+
options?.signal?.addEventListener("abort", abort, { once: true });
|
|
174
|
+
start();
|
|
175
|
+
}
|
|
176
|
+
return request.promise;
|
|
177
|
+
},
|
|
178
|
+
return() {
|
|
179
|
+
finish({});
|
|
180
|
+
return Promise.resolve({ done: true, value: undefined });
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
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 {
|
|
191
|
+
reason;
|
|
192
|
+
name = "ClientError";
|
|
193
|
+
constructor(reason, options) {
|
|
194
|
+
const detail = options?.detail ?? (options?.cause instanceof Error ? options.cause.message : undefined);
|
|
195
|
+
super(detail ? `${reason}: ${detail}` : reason, options);
|
|
196
|
+
this.reason = reason;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
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
|
+
});
|
|
205
|
+
var maxSseEventBytes = 16 * 1024 * 1024;
|
|
206
|
+
function make3(options) {
|
|
207
|
+
const fetch2 = options.fetch ?? globalThis.fetch;
|
|
208
|
+
const prepare = (descriptor, requestOptions) => {
|
|
209
|
+
const baseUrl = new URL(options.baseUrl);
|
|
210
|
+
if (!baseUrl.pathname.endsWith("/"))
|
|
211
|
+
baseUrl.pathname += "/";
|
|
212
|
+
const url = new URL(descriptor.path.slice(1), baseUrl);
|
|
213
|
+
for (const [key, value] of Object.entries(descriptor.query ?? {}))
|
|
214
|
+
appendQuery(url.searchParams, key, value);
|
|
215
|
+
const headers = new Headers(options.headers);
|
|
216
|
+
for (const [key, value] of Object.entries(descriptor.headers ?? {})) {
|
|
217
|
+
if (value !== undefined && value !== null)
|
|
218
|
+
headers.set(key, String(value));
|
|
219
|
+
}
|
|
220
|
+
for (const [key, value] of new Headers(requestOptions?.headers))
|
|
221
|
+
headers.set(key, value);
|
|
222
|
+
if (descriptor.body !== undefined && !headers.has("content-type"))
|
|
223
|
+
headers.set("content-type", descriptor.binaryBody ? "application/octet-stream" : "application/json");
|
|
224
|
+
return {
|
|
225
|
+
url,
|
|
226
|
+
init: {
|
|
227
|
+
method: descriptor.method,
|
|
228
|
+
signal: requestOptions?.signal,
|
|
229
|
+
headers,
|
|
230
|
+
body: descriptor.body === undefined ? undefined : descriptor.binaryBody ? descriptor.body : JSON.stringify(descriptor.body)
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
const execute = async (descriptor, requestOptions) => {
|
|
235
|
+
try {
|
|
236
|
+
const prepared = prepare(descriptor, requestOptions);
|
|
237
|
+
return await fetch2(prepared.url, prepared.init);
|
|
238
|
+
} catch (cause) {
|
|
239
|
+
throw new ClientError2("Transport", { cause });
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
const responseError = async (response, descriptor) => {
|
|
243
|
+
if (descriptor.declaredStatuses.includes(response.status))
|
|
244
|
+
throw declared(await json(response));
|
|
245
|
+
try {
|
|
246
|
+
await response.body?.cancel();
|
|
247
|
+
} catch {}
|
|
248
|
+
throw new ClientError2("UnexpectedStatus", { cause: { status: response.status }, detail: String(response.status) });
|
|
249
|
+
};
|
|
250
|
+
const request = async (descriptor, requestOptions) => {
|
|
251
|
+
const response = await execute(descriptor, requestOptions);
|
|
252
|
+
if (response.status !== descriptor.successStatus)
|
|
253
|
+
return responseError(response, descriptor);
|
|
254
|
+
if (descriptor.binary)
|
|
255
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
256
|
+
if (descriptor.empty) {
|
|
257
|
+
try {
|
|
258
|
+
await response.body?.cancel();
|
|
259
|
+
} catch {}
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
return await json(response);
|
|
263
|
+
};
|
|
264
|
+
const sse = (descriptor, requestOptions) => ({
|
|
265
|
+
async* [Symbol.asyncIterator]() {
|
|
266
|
+
const response = await execute(descriptor, requestOptions);
|
|
267
|
+
if (response.status !== descriptor.successStatus)
|
|
268
|
+
await responseError(response, descriptor);
|
|
269
|
+
if (!isContentType(response, "text/event-stream")) {
|
|
270
|
+
try {
|
|
271
|
+
await response.body?.cancel();
|
|
272
|
+
} catch {}
|
|
273
|
+
throw new ClientError2("UnsupportedContentType", { detail: response.headers.get("content-type") });
|
|
274
|
+
}
|
|
275
|
+
if (response.body === null)
|
|
276
|
+
throw new ClientError2("MalformedResponse");
|
|
277
|
+
const reader = response.body.getReader();
|
|
278
|
+
const decoder = new TextDecoder;
|
|
279
|
+
let buffer = "";
|
|
280
|
+
try {
|
|
281
|
+
while (true) {
|
|
282
|
+
let next;
|
|
283
|
+
try {
|
|
284
|
+
next = await reader.read();
|
|
285
|
+
} catch (cause) {
|
|
286
|
+
throw new ClientError2("Transport", { cause });
|
|
287
|
+
}
|
|
288
|
+
if (!next.done)
|
|
289
|
+
requestOptions?.onActivity?.();
|
|
290
|
+
buffer += decoder.decode(next.value, { stream: !next.done });
|
|
291
|
+
if (buffer.length > maxSseEventBytes)
|
|
292
|
+
throw new ClientError2("SseEventTooLarge");
|
|
293
|
+
const trailingCarriageReturn = !next.done && buffer.endsWith("\r");
|
|
294
|
+
if (trailingCarriageReturn)
|
|
295
|
+
buffer = buffer.slice(0, -1);
|
|
296
|
+
buffer = buffer.replaceAll(`\r
|
|
297
|
+
`, `
|
|
298
|
+
`).replaceAll("\r", `
|
|
299
|
+
`);
|
|
300
|
+
if (trailingCarriageReturn)
|
|
301
|
+
buffer += "\r";
|
|
302
|
+
if (next.done && buffer !== "")
|
|
303
|
+
buffer += `
|
|
33
304
|
|
|
305
|
+
`;
|
|
306
|
+
let boundary = buffer.indexOf(`
|
|
307
|
+
|
|
308
|
+
`);
|
|
309
|
+
while (boundary >= 0) {
|
|
310
|
+
const block = buffer.slice(0, boundary);
|
|
311
|
+
buffer = buffer.slice(boundary + 2);
|
|
312
|
+
const data = block.split(`
|
|
313
|
+
`).flatMap((line) => line.startsWith("data:") ? [line.slice(5).trimStart()] : []).join(`
|
|
314
|
+
`);
|
|
315
|
+
if (data !== "") {
|
|
316
|
+
try {
|
|
317
|
+
yield JSON.parse(data);
|
|
318
|
+
} catch (cause) {
|
|
319
|
+
throw new ClientError2("MalformedResponse", { cause });
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
boundary = buffer.indexOf(`
|
|
323
|
+
|
|
324
|
+
`);
|
|
325
|
+
}
|
|
326
|
+
if (next.done)
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
} finally {
|
|
330
|
+
try {
|
|
331
|
+
await reader.cancel();
|
|
332
|
+
} catch {}
|
|
333
|
+
reader.releaseLock();
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
return {
|
|
338
|
+
server: {
|
|
339
|
+
info: (requestOptions) => request({ method: "GET", path: `/api/info`, successStatus: 200, declaredStatuses: [400, 401], empty: false }, requestOptions),
|
|
340
|
+
pair: (requestOptions) => request({ method: "POST", path: `/api/pair`, successStatus: 200, declaredStatuses: [400, 401], empty: false }, requestOptions),
|
|
341
|
+
connect: (input, requestOptions) => request({
|
|
342
|
+
method: "GET",
|
|
343
|
+
path: `/auth/connect/${encodeURIComponent(input.code)}`,
|
|
344
|
+
successStatus: 200,
|
|
345
|
+
declaredStatuses: [400, 401],
|
|
346
|
+
empty: false
|
|
347
|
+
}, requestOptions)
|
|
348
|
+
},
|
|
349
|
+
location: {
|
|
350
|
+
get: (input, requestOptions) => request({
|
|
351
|
+
method: "GET",
|
|
352
|
+
path: `/api/location`,
|
|
353
|
+
query: { location: input?.["location"] },
|
|
354
|
+
successStatus: 200,
|
|
355
|
+
declaredStatuses: [400, 401],
|
|
356
|
+
empty: false
|
|
357
|
+
}, requestOptions),
|
|
358
|
+
reload: (requestOptions) => request({
|
|
359
|
+
method: "POST",
|
|
360
|
+
path: `/api/location/reload`,
|
|
361
|
+
successStatus: 204,
|
|
362
|
+
declaredStatuses: [400, 401, 503],
|
|
363
|
+
empty: true
|
|
364
|
+
}, requestOptions)
|
|
365
|
+
},
|
|
366
|
+
agent: {
|
|
367
|
+
list: (input, requestOptions) => request({
|
|
368
|
+
method: "GET",
|
|
369
|
+
path: `/api/agent`,
|
|
370
|
+
query: { location: input?.["location"] },
|
|
371
|
+
successStatus: 200,
|
|
372
|
+
declaredStatuses: [400, 401],
|
|
373
|
+
empty: false
|
|
374
|
+
}, requestOptions),
|
|
375
|
+
get: (input, requestOptions) => request({
|
|
376
|
+
method: "GET",
|
|
377
|
+
path: `/api/agent/${encodeURIComponent(input.agentID)}`,
|
|
378
|
+
query: { location: input["location"] },
|
|
379
|
+
successStatus: 200,
|
|
380
|
+
declaredStatuses: [400, 401, 404],
|
|
381
|
+
empty: false
|
|
382
|
+
}, requestOptions)
|
|
383
|
+
},
|
|
384
|
+
plugin: {
|
|
385
|
+
list: (input, requestOptions) => request({
|
|
386
|
+
method: "GET",
|
|
387
|
+
path: `/api/plugin`,
|
|
388
|
+
query: { location: input?.["location"] },
|
|
389
|
+
successStatus: 200,
|
|
390
|
+
declaredStatuses: [400, 401],
|
|
391
|
+
empty: false
|
|
392
|
+
}, requestOptions),
|
|
393
|
+
check: (input, requestOptions) => request({
|
|
394
|
+
method: "POST",
|
|
395
|
+
path: `/api/plugin/check`,
|
|
396
|
+
query: { location: input?.["location"] },
|
|
397
|
+
body: { target: input?.["target"] },
|
|
398
|
+
successStatus: 200,
|
|
399
|
+
declaredStatuses: [400, 401],
|
|
400
|
+
empty: false
|
|
401
|
+
}, requestOptions),
|
|
402
|
+
update: (input, requestOptions) => request({
|
|
403
|
+
method: "POST",
|
|
404
|
+
path: `/api/plugin/update`,
|
|
405
|
+
query: { location: input["location"] },
|
|
406
|
+
body: { targets: input["targets"] },
|
|
407
|
+
successStatus: 204,
|
|
408
|
+
declaredStatuses: [400, 401, 503],
|
|
409
|
+
empty: true
|
|
410
|
+
}, requestOptions)
|
|
411
|
+
},
|
|
412
|
+
session: {
|
|
413
|
+
list: (input, requestOptions) => request({
|
|
414
|
+
method: "GET",
|
|
415
|
+
path: `/api/session`,
|
|
416
|
+
query: {
|
|
417
|
+
limit: input?.["limit"],
|
|
418
|
+
order: input?.["order"],
|
|
419
|
+
search: input?.["search"],
|
|
420
|
+
parentID: input?.["parentID"],
|
|
421
|
+
directory: input?.["directory"],
|
|
422
|
+
project: input?.["project"],
|
|
423
|
+
subpath: input?.["subpath"],
|
|
424
|
+
cursor: input?.["cursor"]
|
|
425
|
+
},
|
|
426
|
+
successStatus: 200,
|
|
427
|
+
declaredStatuses: [400, 401],
|
|
428
|
+
empty: false
|
|
429
|
+
}, 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
|
+
create: (input, requestOptions) => request({
|
|
445
|
+
method: "POST",
|
|
446
|
+
path: `/api/session`,
|
|
447
|
+
body: {
|
|
448
|
+
id: input?.["id"],
|
|
449
|
+
title: input?.["title"],
|
|
450
|
+
agent: input?.["agent"],
|
|
451
|
+
model: input?.["model"],
|
|
452
|
+
location: input?.["location"],
|
|
453
|
+
metadata: input?.["metadata"],
|
|
454
|
+
permissions: input?.["permissions"]
|
|
455
|
+
},
|
|
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],
|
|
474
|
+
empty: false
|
|
475
|
+
}, requestOptions).then((value) => value.data),
|
|
476
|
+
active: (requestOptions) => request({
|
|
477
|
+
method: "GET",
|
|
478
|
+
path: `/api/session/active`,
|
|
479
|
+
successStatus: 200,
|
|
480
|
+
declaredStatuses: [400, 401],
|
|
481
|
+
empty: false
|
|
482
|
+
}, requestOptions).then((value) => value.data),
|
|
483
|
+
get: (input, requestOptions) => request({
|
|
484
|
+
method: "GET",
|
|
485
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}`,
|
|
486
|
+
successStatus: 200,
|
|
487
|
+
declaredStatuses: [400, 401, 404],
|
|
488
|
+
empty: false
|
|
489
|
+
}, requestOptions).then((value) => value.data),
|
|
490
|
+
remove: (input, requestOptions) => request({
|
|
491
|
+
method: "DELETE",
|
|
492
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}`,
|
|
493
|
+
successStatus: 204,
|
|
494
|
+
declaredStatuses: [400, 401, 404],
|
|
495
|
+
empty: true
|
|
496
|
+
}, requestOptions),
|
|
497
|
+
fork: (input, requestOptions) => request({
|
|
498
|
+
method: "POST",
|
|
499
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/fork`,
|
|
500
|
+
body: { before: input["before"] },
|
|
501
|
+
successStatus: 200,
|
|
502
|
+
declaredStatuses: [400, 401, 404],
|
|
503
|
+
empty: false
|
|
504
|
+
}, requestOptions).then((value) => value.data),
|
|
505
|
+
switchAgent: (input, requestOptions) => request({
|
|
506
|
+
method: "POST",
|
|
507
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/agent`,
|
|
508
|
+
body: { agent: input["agent"] },
|
|
509
|
+
successStatus: 204,
|
|
510
|
+
declaredStatuses: [400, 401, 404],
|
|
511
|
+
empty: true
|
|
512
|
+
}, requestOptions),
|
|
513
|
+
switchModel: (input, requestOptions) => request({
|
|
514
|
+
method: "POST",
|
|
515
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/model`,
|
|
516
|
+
body: { model: input["model"] },
|
|
517
|
+
successStatus: 204,
|
|
518
|
+
declaredStatuses: [400, 401, 404],
|
|
519
|
+
empty: true
|
|
520
|
+
}, requestOptions),
|
|
521
|
+
update: (input, requestOptions) => request({
|
|
522
|
+
method: "PATCH",
|
|
523
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}`,
|
|
524
|
+
body: { title: input["title"], metadata: input["metadata"], permissions: input["permissions"] },
|
|
525
|
+
successStatus: 204,
|
|
526
|
+
declaredStatuses: [400, 401, 404],
|
|
527
|
+
empty: true
|
|
528
|
+
}, requestOptions),
|
|
529
|
+
move: (input, requestOptions) => request({
|
|
530
|
+
method: "POST",
|
|
531
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/move`,
|
|
532
|
+
body: { directory: input["directory"], delivery: input["delivery"] },
|
|
533
|
+
successStatus: 204,
|
|
534
|
+
declaredStatuses: [400, 401, 404],
|
|
535
|
+
empty: true
|
|
536
|
+
}, requestOptions),
|
|
537
|
+
prompt: (input, requestOptions) => request({
|
|
538
|
+
method: "POST",
|
|
539
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/prompt`,
|
|
540
|
+
body: {
|
|
541
|
+
id: input["id"],
|
|
542
|
+
text: input["text"],
|
|
543
|
+
files: input["files"],
|
|
544
|
+
agents: input["agents"],
|
|
545
|
+
skills: input["skills"],
|
|
546
|
+
metadata: input["metadata"],
|
|
547
|
+
delivery: input["delivery"],
|
|
548
|
+
resume: input["resume"]
|
|
549
|
+
},
|
|
550
|
+
successStatus: 200,
|
|
551
|
+
declaredStatuses: [400, 401, 404, 409],
|
|
552
|
+
empty: false
|
|
553
|
+
}, requestOptions).then((value) => value.data),
|
|
554
|
+
command: (input, requestOptions) => request({
|
|
555
|
+
method: "POST",
|
|
556
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/command`,
|
|
557
|
+
body: {
|
|
558
|
+
name: input["name"],
|
|
559
|
+
text: input["text"],
|
|
560
|
+
files: input["files"],
|
|
561
|
+
agents: input["agents"],
|
|
562
|
+
skills: input["skills"],
|
|
563
|
+
delivery: input["delivery"]
|
|
564
|
+
},
|
|
565
|
+
successStatus: 204,
|
|
566
|
+
declaredStatuses: [400, 401, 404, 500],
|
|
567
|
+
empty: true
|
|
568
|
+
}, 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
|
+
synthetic: (input, requestOptions) => request({
|
|
578
|
+
method: "POST",
|
|
579
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/synthetic`,
|
|
580
|
+
body: {
|
|
581
|
+
id: input["id"],
|
|
582
|
+
text: input["text"],
|
|
583
|
+
description: input["description"],
|
|
584
|
+
metadata: input["metadata"],
|
|
585
|
+
delivery: input["delivery"],
|
|
586
|
+
resume: input["resume"]
|
|
587
|
+
},
|
|
588
|
+
successStatus: 200,
|
|
589
|
+
declaredStatuses: [400, 401, 404, 409],
|
|
590
|
+
empty: false
|
|
591
|
+
}, requestOptions).then((value) => value.data),
|
|
592
|
+
shell: (input, requestOptions) => request({
|
|
593
|
+
method: "POST",
|
|
594
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/shell`,
|
|
595
|
+
body: { id: input["id"], command: input["command"] },
|
|
596
|
+
successStatus: 204,
|
|
597
|
+
declaredStatuses: [400, 401, 404],
|
|
598
|
+
empty: true
|
|
599
|
+
}, requestOptions),
|
|
600
|
+
compact: (input, requestOptions) => request({
|
|
601
|
+
method: "POST",
|
|
602
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/compact`,
|
|
603
|
+
body: { id: input["id"], delivery: input["delivery"] },
|
|
604
|
+
successStatus: 200,
|
|
605
|
+
declaredStatuses: [400, 401, 404, 409],
|
|
606
|
+
empty: false
|
|
607
|
+
}, 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
|
+
revert: {
|
|
616
|
+
stage: (input, requestOptions) => request({
|
|
617
|
+
method: "POST",
|
|
618
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/revert/stage`,
|
|
619
|
+
body: { messageID: input["messageID"], files: input["files"] },
|
|
620
|
+
successStatus: 200,
|
|
621
|
+
declaredStatuses: [400, 401, 404, 409, 500],
|
|
622
|
+
empty: false
|
|
623
|
+
}, requestOptions).then((value) => value.data),
|
|
624
|
+
clear: (input, requestOptions) => request({
|
|
625
|
+
method: "DELETE",
|
|
626
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/revert`,
|
|
627
|
+
successStatus: 204,
|
|
628
|
+
declaredStatuses: [400, 401, 404, 409, 500],
|
|
629
|
+
empty: true
|
|
630
|
+
}, requestOptions),
|
|
631
|
+
commit: (input, requestOptions) => request({
|
|
632
|
+
method: "POST",
|
|
633
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/revert/commit`,
|
|
634
|
+
successStatus: 204,
|
|
635
|
+
declaredStatuses: [400, 401, 404, 409],
|
|
636
|
+
empty: true
|
|
637
|
+
}, requestOptions)
|
|
638
|
+
},
|
|
639
|
+
context: (input, requestOptions) => request({
|
|
640
|
+
method: "GET",
|
|
641
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/context`,
|
|
642
|
+
successStatus: 200,
|
|
643
|
+
declaredStatuses: [400, 401, 404, 500],
|
|
644
|
+
empty: false
|
|
645
|
+
}, requestOptions).then((value) => value.data),
|
|
646
|
+
diff: (input, requestOptions) => request({
|
|
647
|
+
method: "GET",
|
|
648
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/diff`,
|
|
649
|
+
query: { from: input["from"], to: input["to"], context: input["context"] },
|
|
650
|
+
successStatus: 200,
|
|
651
|
+
declaredStatuses: [400, 401, 404, 500],
|
|
652
|
+
empty: false
|
|
653
|
+
}, requestOptions).then((value) => value.data),
|
|
654
|
+
inbox: {
|
|
655
|
+
list: (input, requestOptions) => request({
|
|
656
|
+
method: "GET",
|
|
657
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/inbox`,
|
|
658
|
+
successStatus: 200,
|
|
659
|
+
declaredStatuses: [400, 401, 404],
|
|
660
|
+
empty: false
|
|
661
|
+
}, requestOptions).then((value) => value.data),
|
|
662
|
+
cancel: (input, requestOptions) => request({
|
|
663
|
+
method: "DELETE",
|
|
664
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/inbox/${encodeURIComponent(input.inboxID)}`,
|
|
665
|
+
successStatus: 204,
|
|
666
|
+
declaredStatuses: [400, 401, 404],
|
|
667
|
+
empty: true
|
|
668
|
+
}, requestOptions),
|
|
669
|
+
update: (input, requestOptions) => request({
|
|
670
|
+
method: "PATCH",
|
|
671
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/inbox/${encodeURIComponent(input.inboxID)}`,
|
|
672
|
+
body: { delivery: input["delivery"] },
|
|
673
|
+
successStatus: 204,
|
|
674
|
+
declaredStatuses: [400, 401, 404, 409],
|
|
675
|
+
empty: true
|
|
676
|
+
}, requestOptions)
|
|
677
|
+
},
|
|
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
|
+
generate: (input, requestOptions) => request({
|
|
705
|
+
method: "POST",
|
|
706
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/generate`,
|
|
707
|
+
body: { prompt: input["prompt"] },
|
|
708
|
+
successStatus: 200,
|
|
709
|
+
declaredStatuses: [400, 401, 404, 503],
|
|
710
|
+
empty: false
|
|
711
|
+
}, 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
|
+
interrupt: (input, requestOptions) => request({
|
|
721
|
+
method: "POST",
|
|
722
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/interrupt`,
|
|
723
|
+
query: { resume: input["resume"] },
|
|
724
|
+
successStatus: 200,
|
|
725
|
+
declaredStatuses: [400, 401, 404],
|
|
726
|
+
empty: false
|
|
727
|
+
}, requestOptions),
|
|
728
|
+
background: (input, requestOptions) => request({
|
|
729
|
+
method: "POST",
|
|
730
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/background`,
|
|
731
|
+
successStatus: 204,
|
|
732
|
+
declaredStatuses: [400, 401, 404],
|
|
733
|
+
empty: true
|
|
734
|
+
}, requestOptions),
|
|
735
|
+
message: {
|
|
736
|
+
get: (input, requestOptions) => request({
|
|
737
|
+
method: "GET",
|
|
738
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/message/${encodeURIComponent(input.messageID)}`,
|
|
739
|
+
successStatus: 200,
|
|
740
|
+
declaredStatuses: [400, 401, 404],
|
|
741
|
+
empty: false
|
|
742
|
+
}, requestOptions).then((value) => value.data)
|
|
743
|
+
},
|
|
744
|
+
form: {
|
|
745
|
+
list: (input, requestOptions) => request({
|
|
746
|
+
method: "GET",
|
|
747
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/form`,
|
|
748
|
+
successStatus: 200,
|
|
749
|
+
declaredStatuses: [400, 401, 404],
|
|
750
|
+
empty: false
|
|
751
|
+
}, requestOptions).then((value) => value.data),
|
|
752
|
+
create: (input, requestOptions) => request({
|
|
753
|
+
method: "POST",
|
|
754
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/form`,
|
|
755
|
+
body: { id: input["id"], title: input["title"], metadata: input["metadata"], fields: input["fields"] },
|
|
756
|
+
successStatus: 200,
|
|
757
|
+
declaredStatuses: [400, 401, 404, 409],
|
|
758
|
+
empty: false
|
|
759
|
+
}, requestOptions).then((value) => value.data),
|
|
760
|
+
get: (input, requestOptions) => request({
|
|
761
|
+
method: "GET",
|
|
762
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/form/${encodeURIComponent(input.formID)}`,
|
|
763
|
+
successStatus: 200,
|
|
764
|
+
declaredStatuses: [400, 401, 404],
|
|
765
|
+
empty: false
|
|
766
|
+
}, requestOptions).then((value) => value.data),
|
|
767
|
+
reply: (input, requestOptions) => request({
|
|
768
|
+
method: "POST",
|
|
769
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/form/${encodeURIComponent(input.formID)}/reply`,
|
|
770
|
+
body: { answer: input["answer"] },
|
|
771
|
+
successStatus: 204,
|
|
772
|
+
declaredStatuses: [400, 401, 404, 409],
|
|
773
|
+
empty: true
|
|
774
|
+
}, requestOptions),
|
|
775
|
+
cancel: (input, requestOptions) => request({
|
|
776
|
+
method: "DELETE",
|
|
777
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/form/${encodeURIComponent(input.formID)}`,
|
|
778
|
+
successStatus: 204,
|
|
779
|
+
declaredStatuses: [400, 401, 404, 409],
|
|
780
|
+
empty: true
|
|
781
|
+
}, requestOptions)
|
|
782
|
+
},
|
|
783
|
+
environment: (input, requestOptions) => request({
|
|
784
|
+
method: "PUT",
|
|
785
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/environment`,
|
|
786
|
+
body: { variables: input["variables"] },
|
|
787
|
+
successStatus: 204,
|
|
788
|
+
declaredStatuses: [400, 401, 404],
|
|
789
|
+
empty: true
|
|
790
|
+
}, requestOptions),
|
|
791
|
+
view: (input, requestOptions) => request({
|
|
792
|
+
method: "POST",
|
|
793
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/view`,
|
|
794
|
+
body: { idle: input["idle"] },
|
|
795
|
+
successStatus: 204,
|
|
796
|
+
declaredStatuses: [400, 401, 404],
|
|
797
|
+
empty: true
|
|
798
|
+
}, requestOptions)
|
|
799
|
+
},
|
|
800
|
+
message: {
|
|
801
|
+
list: (input, requestOptions) => request({
|
|
802
|
+
method: "GET",
|
|
803
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/message`,
|
|
804
|
+
query: { limit: input["limit"], order: input["order"], cursor: input["cursor"], type: input["type"] },
|
|
805
|
+
successStatus: 200,
|
|
806
|
+
declaredStatuses: [400, 401, 404, 500],
|
|
807
|
+
empty: false
|
|
808
|
+
}, requestOptions)
|
|
809
|
+
},
|
|
810
|
+
model: {
|
|
811
|
+
list: (input, requestOptions) => request({
|
|
812
|
+
method: "GET",
|
|
813
|
+
path: `/api/model`,
|
|
814
|
+
query: { location: input?.["location"] },
|
|
815
|
+
successStatus: 200,
|
|
816
|
+
declaredStatuses: [400, 401, 503],
|
|
817
|
+
empty: false
|
|
818
|
+
}, requestOptions),
|
|
819
|
+
default: (input, requestOptions) => request({
|
|
820
|
+
method: "GET",
|
|
821
|
+
path: `/api/model/default`,
|
|
822
|
+
query: { location: input?.["location"] },
|
|
823
|
+
successStatus: 200,
|
|
824
|
+
declaredStatuses: [400, 401, 503],
|
|
825
|
+
empty: false
|
|
826
|
+
}, requestOptions)
|
|
827
|
+
},
|
|
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
|
+
provider: {
|
|
839
|
+
list: (input, requestOptions) => request({
|
|
840
|
+
method: "GET",
|
|
841
|
+
path: `/api/provider`,
|
|
842
|
+
query: { location: input?.["location"] },
|
|
843
|
+
successStatus: 200,
|
|
844
|
+
declaredStatuses: [400, 401, 503],
|
|
845
|
+
empty: false
|
|
846
|
+
}, requestOptions),
|
|
847
|
+
get: (input, requestOptions) => request({
|
|
848
|
+
method: "GET",
|
|
849
|
+
path: `/api/provider/${encodeURIComponent(input.providerID)}`,
|
|
850
|
+
query: { location: input["location"] },
|
|
851
|
+
successStatus: 200,
|
|
852
|
+
declaredStatuses: [400, 401, 404, 503],
|
|
853
|
+
empty: false
|
|
854
|
+
}, requestOptions)
|
|
855
|
+
},
|
|
856
|
+
integration: {
|
|
857
|
+
list: (input, requestOptions) => request({
|
|
858
|
+
method: "GET",
|
|
859
|
+
path: `/api/integration`,
|
|
860
|
+
query: { location: input?.["location"] },
|
|
861
|
+
successStatus: 200,
|
|
862
|
+
declaredStatuses: [400, 401],
|
|
863
|
+
empty: false
|
|
864
|
+
}, requestOptions),
|
|
865
|
+
get: (input, requestOptions) => request({
|
|
866
|
+
method: "GET",
|
|
867
|
+
path: `/api/integration/${encodeURIComponent(input.integrationID)}`,
|
|
868
|
+
query: { location: input["location"] },
|
|
869
|
+
successStatus: 200,
|
|
870
|
+
declaredStatuses: [400, 401, 404],
|
|
871
|
+
empty: false
|
|
872
|
+
}, 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
|
+
connect: {
|
|
885
|
+
key: (input, requestOptions) => request({
|
|
886
|
+
method: "POST",
|
|
887
|
+
path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/key`,
|
|
888
|
+
query: { location: input["location"] },
|
|
889
|
+
body: { key: input["key"], answer: input["answer"], label: input["label"] },
|
|
890
|
+
successStatus: 204,
|
|
891
|
+
declaredStatuses: [400, 401, 404],
|
|
892
|
+
empty: true
|
|
893
|
+
}, requestOptions)
|
|
894
|
+
},
|
|
895
|
+
oauth: {
|
|
896
|
+
connect: (input, requestOptions) => request({
|
|
897
|
+
method: "POST",
|
|
898
|
+
path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/oauth`,
|
|
899
|
+
query: { location: input["location"] },
|
|
900
|
+
body: { methodID: input["methodID"], answer: input["answer"], label: input["label"] },
|
|
901
|
+
successStatus: 200,
|
|
902
|
+
declaredStatuses: [400, 401],
|
|
903
|
+
empty: false
|
|
904
|
+
}, requestOptions),
|
|
905
|
+
status: (input, requestOptions) => request({
|
|
906
|
+
method: "GET",
|
|
907
|
+
path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/oauth/${encodeURIComponent(input.attemptID)}`,
|
|
908
|
+
query: { location: input["location"] },
|
|
909
|
+
successStatus: 200,
|
|
910
|
+
declaredStatuses: [400, 401, 404],
|
|
911
|
+
empty: false
|
|
912
|
+
}, requestOptions),
|
|
913
|
+
complete: (input, requestOptions) => request({
|
|
914
|
+
method: "POST",
|
|
915
|
+
path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/oauth/${encodeURIComponent(input.attemptID)}/complete`,
|
|
916
|
+
query: { location: input["location"] },
|
|
917
|
+
body: { code: input["code"] },
|
|
918
|
+
successStatus: 204,
|
|
919
|
+
declaredStatuses: [400, 401, 404],
|
|
920
|
+
empty: true
|
|
921
|
+
}, requestOptions),
|
|
922
|
+
cancel: (input, requestOptions) => request({
|
|
923
|
+
method: "DELETE",
|
|
924
|
+
path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/oauth/${encodeURIComponent(input.attemptID)}`,
|
|
925
|
+
query: { location: input["location"] },
|
|
926
|
+
successStatus: 204,
|
|
927
|
+
declaredStatuses: [400, 401],
|
|
928
|
+
empty: true
|
|
929
|
+
}, requestOptions)
|
|
930
|
+
},
|
|
931
|
+
command: {
|
|
932
|
+
connect: (input, requestOptions) => request({
|
|
933
|
+
method: "POST",
|
|
934
|
+
path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/command`,
|
|
935
|
+
query: { location: input["location"] },
|
|
936
|
+
body: { methodID: input["methodID"], label: input["label"] },
|
|
937
|
+
successStatus: 200,
|
|
938
|
+
declaredStatuses: [400, 401, 404],
|
|
939
|
+
empty: false
|
|
940
|
+
}, requestOptions),
|
|
941
|
+
status: (input, requestOptions) => request({
|
|
942
|
+
method: "GET",
|
|
943
|
+
path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/command/${encodeURIComponent(input.attemptID)}`,
|
|
944
|
+
query: { location: input["location"] },
|
|
945
|
+
successStatus: 200,
|
|
946
|
+
declaredStatuses: [400, 401, 404],
|
|
947
|
+
empty: false
|
|
948
|
+
}, 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,
|
|
998
|
+
declaredStatuses: [400, 401, 404],
|
|
999
|
+
empty: true
|
|
1000
|
+
}, requestOptions),
|
|
1001
|
+
resource: {
|
|
1002
|
+
catalog: (input, requestOptions) => request({
|
|
1003
|
+
method: "GET",
|
|
1004
|
+
path: `/api/mcp/resource`,
|
|
1005
|
+
query: { location: input?.["location"] },
|
|
1006
|
+
successStatus: 200,
|
|
1007
|
+
declaredStatuses: [400, 401],
|
|
1008
|
+
empty: false
|
|
1009
|
+
}, requestOptions)
|
|
1010
|
+
}
|
|
1011
|
+
},
|
|
1012
|
+
credential: {
|
|
1013
|
+
update: (input, requestOptions) => request({
|
|
1014
|
+
method: "PATCH",
|
|
1015
|
+
path: `/api/credential/${encodeURIComponent(input.credentialID)}`,
|
|
1016
|
+
body: { label: input["label"] },
|
|
1017
|
+
successStatus: 204,
|
|
1018
|
+
declaredStatuses: [400, 401],
|
|
1019
|
+
empty: true
|
|
1020
|
+
}, requestOptions),
|
|
1021
|
+
activate: (input, requestOptions) => request({
|
|
1022
|
+
method: "POST",
|
|
1023
|
+
path: `/api/credential/${encodeURIComponent(input.credentialID)}/activate`,
|
|
1024
|
+
successStatus: 204,
|
|
1025
|
+
declaredStatuses: [400, 401],
|
|
1026
|
+
empty: true
|
|
1027
|
+
}, requestOptions),
|
|
1028
|
+
remove: (input, requestOptions) => request({
|
|
1029
|
+
method: "DELETE",
|
|
1030
|
+
path: `/api/credential/${encodeURIComponent(input.credentialID)}`,
|
|
1031
|
+
successStatus: 204,
|
|
1032
|
+
declaredStatuses: [400, 401],
|
|
1033
|
+
empty: true
|
|
1034
|
+
}, requestOptions)
|
|
1035
|
+
},
|
|
1036
|
+
project: {
|
|
1037
|
+
list: (requestOptions) => request({ method: "GET", path: `/api/project`, successStatus: 200, declaredStatuses: [400, 401], empty: false }, requestOptions),
|
|
1038
|
+
update: (input, requestOptions) => request({
|
|
1039
|
+
method: "PATCH",
|
|
1040
|
+
path: `/api/project/${encodeURIComponent(input.projectID)}`,
|
|
1041
|
+
body: {
|
|
1042
|
+
canonical: input["canonical"],
|
|
1043
|
+
name: input["name"],
|
|
1044
|
+
icon: input["icon"],
|
|
1045
|
+
commands: input["commands"]
|
|
1046
|
+
},
|
|
1047
|
+
successStatus: 200,
|
|
1048
|
+
declaredStatuses: [400, 401, 404],
|
|
1049
|
+
empty: false
|
|
1050
|
+
}, requestOptions)
|
|
1051
|
+
},
|
|
1052
|
+
form: {
|
|
1053
|
+
list: (input, requestOptions) => request({
|
|
1054
|
+
method: "GET",
|
|
1055
|
+
path: `/api/form`,
|
|
1056
|
+
query: { location: input?.["location"] },
|
|
1057
|
+
successStatus: 200,
|
|
1058
|
+
declaredStatuses: [400, 401],
|
|
1059
|
+
empty: false
|
|
1060
|
+
}, requestOptions)
|
|
1061
|
+
},
|
|
1062
|
+
permission: {
|
|
1063
|
+
request: {
|
|
1064
|
+
list: (input, requestOptions) => request({
|
|
1065
|
+
method: "GET",
|
|
1066
|
+
path: `/api/permission/request`,
|
|
1067
|
+
query: { location: input?.["location"] },
|
|
1068
|
+
successStatus: 200,
|
|
1069
|
+
declaredStatuses: [400, 401],
|
|
1070
|
+
empty: false
|
|
1071
|
+
}, requestOptions)
|
|
1072
|
+
},
|
|
1073
|
+
saved: {
|
|
1074
|
+
list: (input, requestOptions) => request({
|
|
1075
|
+
method: "GET",
|
|
1076
|
+
path: `/api/permission/saved`,
|
|
1077
|
+
query: { projectID: input?.["projectID"] },
|
|
1078
|
+
successStatus: 200,
|
|
1079
|
+
declaredStatuses: [400, 401],
|
|
1080
|
+
empty: false
|
|
1081
|
+
}, requestOptions).then((value) => value.data),
|
|
1082
|
+
remove: (input, requestOptions) => request({
|
|
1083
|
+
method: "DELETE",
|
|
1084
|
+
path: `/api/permission/saved/${encodeURIComponent(input.id)}`,
|
|
1085
|
+
successStatus: 204,
|
|
1086
|
+
declaredStatuses: [400, 401],
|
|
1087
|
+
empty: true
|
|
1088
|
+
}, requestOptions)
|
|
1089
|
+
},
|
|
1090
|
+
create: (input, requestOptions) => request({
|
|
1091
|
+
method: "POST",
|
|
1092
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/permission`,
|
|
1093
|
+
body: {
|
|
1094
|
+
id: input["id"],
|
|
1095
|
+
action: input["action"],
|
|
1096
|
+
resources: input["resources"],
|
|
1097
|
+
save: input["save"],
|
|
1098
|
+
metadata: input["metadata"],
|
|
1099
|
+
source: input["source"],
|
|
1100
|
+
agent: input["agent"]
|
|
1101
|
+
},
|
|
1102
|
+
successStatus: 200,
|
|
1103
|
+
declaredStatuses: [400, 401, 404],
|
|
1104
|
+
empty: false
|
|
1105
|
+
}, requestOptions).then((value) => value.data),
|
|
1106
|
+
list: (input, requestOptions) => request({
|
|
1107
|
+
method: "GET",
|
|
1108
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/permission`,
|
|
1109
|
+
successStatus: 200,
|
|
1110
|
+
declaredStatuses: [400, 401, 404],
|
|
1111
|
+
empty: false
|
|
1112
|
+
}, requestOptions).then((value) => value.data),
|
|
1113
|
+
get: (input, requestOptions) => request({
|
|
1114
|
+
method: "GET",
|
|
1115
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/permission/${encodeURIComponent(input.requestID)}`,
|
|
1116
|
+
successStatus: 200,
|
|
1117
|
+
declaredStatuses: [400, 401, 404],
|
|
1118
|
+
empty: false
|
|
1119
|
+
}, requestOptions).then((value) => value.data),
|
|
1120
|
+
reply: (input, requestOptions) => request({
|
|
1121
|
+
method: "POST",
|
|
1122
|
+
path: `/api/session/${encodeURIComponent(input.sessionID)}/permission/${encodeURIComponent(input.requestID)}/reply`,
|
|
1123
|
+
body: { decision: input["decision"], message: input["message"] },
|
|
1124
|
+
successStatus: 204,
|
|
1125
|
+
declaredStatuses: [400, 401, 404],
|
|
1126
|
+
empty: true
|
|
1127
|
+
}, requestOptions)
|
|
1128
|
+
},
|
|
1129
|
+
file: {
|
|
1130
|
+
read: (input, requestOptions) => request({
|
|
1131
|
+
method: "GET",
|
|
1132
|
+
path: `/api/fs/read/${encodePath(input.path)}`,
|
|
1133
|
+
query: { location: input["location"] },
|
|
1134
|
+
successStatus: 200,
|
|
1135
|
+
declaredStatuses: [400, 401, 404],
|
|
1136
|
+
empty: false,
|
|
1137
|
+
binary: true
|
|
1138
|
+
}, requestOptions),
|
|
1139
|
+
list: (input, requestOptions) => request({
|
|
1140
|
+
method: "GET",
|
|
1141
|
+
path: `/api/fs/list`,
|
|
1142
|
+
query: { location: input?.["location"], path: input?.["path"] },
|
|
1143
|
+
successStatus: 200,
|
|
1144
|
+
declaredStatuses: [400, 401],
|
|
1145
|
+
empty: false
|
|
1146
|
+
}, requestOptions),
|
|
1147
|
+
find: (input, requestOptions) => request({
|
|
1148
|
+
method: "GET",
|
|
1149
|
+
path: `/api/fs/find`,
|
|
1150
|
+
query: { location: input["location"], query: input["query"], type: input["type"], limit: input["limit"] },
|
|
1151
|
+
successStatus: 200,
|
|
1152
|
+
declaredStatuses: [400, 401],
|
|
1153
|
+
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
|
+
}, requestOptions)
|
|
1165
|
+
},
|
|
1166
|
+
command: {
|
|
1167
|
+
list: (input, requestOptions) => request({
|
|
1168
|
+
method: "GET",
|
|
1169
|
+
path: `/api/command`,
|
|
1170
|
+
query: { location: input?.["location"] },
|
|
1171
|
+
successStatus: 200,
|
|
1172
|
+
declaredStatuses: [400, 401],
|
|
1173
|
+
empty: false
|
|
1174
|
+
}, requestOptions)
|
|
1175
|
+
},
|
|
1176
|
+
skill: {
|
|
1177
|
+
list: (input, requestOptions) => request({
|
|
1178
|
+
method: "GET",
|
|
1179
|
+
path: `/api/skill`,
|
|
1180
|
+
query: { location: input?.["location"] },
|
|
1181
|
+
successStatus: 200,
|
|
1182
|
+
declaredStatuses: [400, 401],
|
|
1183
|
+
empty: false
|
|
1184
|
+
}, requestOptions)
|
|
1185
|
+
},
|
|
1186
|
+
rpc: {
|
|
1187
|
+
call: (input, requestOptions) => request({
|
|
1188
|
+
method: "POST",
|
|
1189
|
+
path: `/api/rpc/${encodeURIComponent(input.rpcID)}/${encodeURIComponent(input.method)}`,
|
|
1190
|
+
query: { location: input["location"] },
|
|
1191
|
+
body: { input: input["input"] },
|
|
1192
|
+
successStatus: 200,
|
|
1193
|
+
declaredStatuses: [400, 401, 500],
|
|
1194
|
+
empty: false
|
|
1195
|
+
}, requestOptions)
|
|
1196
|
+
},
|
|
1197
|
+
event: {
|
|
1198
|
+
subscribe: (requestOptions) => sse({ method: "GET", path: `/api/event`, successStatus: 200, declaredStatuses: [400, 401], empty: false }, requestOptions)
|
|
1199
|
+
},
|
|
1200
|
+
pty: {
|
|
1201
|
+
list: (input, requestOptions) => request({
|
|
1202
|
+
method: "GET",
|
|
1203
|
+
path: `/api/pty`,
|
|
1204
|
+
query: { location: input?.["location"] },
|
|
1205
|
+
successStatus: 200,
|
|
1206
|
+
declaredStatuses: [400, 401],
|
|
1207
|
+
empty: false
|
|
1208
|
+
}, requestOptions),
|
|
1209
|
+
create: (input, requestOptions) => request({
|
|
1210
|
+
method: "POST",
|
|
1211
|
+
path: `/api/pty`,
|
|
1212
|
+
query: { location: input?.["location"] },
|
|
1213
|
+
body: {
|
|
1214
|
+
command: input?.["command"],
|
|
1215
|
+
args: input?.["args"],
|
|
1216
|
+
cwd: input?.["cwd"],
|
|
1217
|
+
title: input?.["title"],
|
|
1218
|
+
env: input?.["env"]
|
|
1219
|
+
},
|
|
1220
|
+
successStatus: 200,
|
|
1221
|
+
declaredStatuses: [400, 401],
|
|
1222
|
+
empty: false
|
|
1223
|
+
}, requestOptions),
|
|
1224
|
+
get: (input, requestOptions) => request({
|
|
1225
|
+
method: "GET",
|
|
1226
|
+
path: `/api/pty/${encodeURIComponent(input.ptyID)}`,
|
|
1227
|
+
query: { location: input["location"] },
|
|
1228
|
+
successStatus: 200,
|
|
1229
|
+
declaredStatuses: [400, 401, 404],
|
|
1230
|
+
empty: false
|
|
1231
|
+
}, requestOptions),
|
|
1232
|
+
update: (input, requestOptions) => request({
|
|
1233
|
+
method: "PUT",
|
|
1234
|
+
path: `/api/pty/${encodeURIComponent(input.ptyID)}`,
|
|
1235
|
+
query: { location: input["location"] },
|
|
1236
|
+
body: { title: input["title"], size: input["size"] },
|
|
1237
|
+
successStatus: 200,
|
|
1238
|
+
declaredStatuses: [400, 401, 404],
|
|
1239
|
+
empty: false
|
|
1240
|
+
}, requestOptions),
|
|
1241
|
+
remove: (input, requestOptions) => request({
|
|
1242
|
+
method: "DELETE",
|
|
1243
|
+
path: `/api/pty/${encodeURIComponent(input.ptyID)}`,
|
|
1244
|
+
query: { location: input["location"] },
|
|
1245
|
+
successStatus: 204,
|
|
1246
|
+
declaredStatuses: [400, 401, 404],
|
|
1247
|
+
empty: true
|
|
1248
|
+
}, requestOptions),
|
|
1249
|
+
connect: {
|
|
1250
|
+
token: (input, requestOptions) => request({
|
|
1251
|
+
method: "POST",
|
|
1252
|
+
path: `/api/pty/${encodeURIComponent(input.ptyID)}/connect-token`,
|
|
1253
|
+
query: { location: input["location"] },
|
|
1254
|
+
headers: { "x-opencode-ticket": input["x-opencode-ticket"] },
|
|
1255
|
+
successStatus: 200,
|
|
1256
|
+
declaredStatuses: [400, 401, 403, 404],
|
|
1257
|
+
empty: false
|
|
1258
|
+
}, requestOptions)
|
|
1259
|
+
}
|
|
1260
|
+
},
|
|
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
|
+
shell: {
|
|
1347
|
+
list: (input, requestOptions) => request({
|
|
1348
|
+
method: "GET",
|
|
1349
|
+
path: `/api/shell`,
|
|
1350
|
+
query: { location: input?.["location"] },
|
|
1351
|
+
successStatus: 200,
|
|
1352
|
+
declaredStatuses: [400, 401],
|
|
1353
|
+
empty: false
|
|
1354
|
+
}, requestOptions),
|
|
1355
|
+
create: (input, requestOptions) => request({
|
|
1356
|
+
method: "POST",
|
|
1357
|
+
path: `/api/shell`,
|
|
1358
|
+
query: { location: input["location"] },
|
|
1359
|
+
body: {
|
|
1360
|
+
command: input["command"],
|
|
1361
|
+
cwd: input["cwd"],
|
|
1362
|
+
timeout: input["timeout"],
|
|
1363
|
+
metadata: input["metadata"]
|
|
1364
|
+
},
|
|
1365
|
+
successStatus: 200,
|
|
1366
|
+
declaredStatuses: [400, 401],
|
|
1367
|
+
empty: false
|
|
1368
|
+
}, requestOptions),
|
|
1369
|
+
get: (input, requestOptions) => request({
|
|
1370
|
+
method: "GET",
|
|
1371
|
+
path: `/api/shell/${encodeURIComponent(input.id)}`,
|
|
1372
|
+
query: { location: input["location"] },
|
|
1373
|
+
successStatus: 200,
|
|
1374
|
+
declaredStatuses: [400, 401, 404],
|
|
1375
|
+
empty: false
|
|
1376
|
+
}, requestOptions),
|
|
1377
|
+
output: (input, requestOptions) => request({
|
|
1378
|
+
method: "GET",
|
|
1379
|
+
path: `/api/shell/${encodeURIComponent(input.id)}/output`,
|
|
1380
|
+
query: { location: input["location"], cursor: input["cursor"], limit: input["limit"] },
|
|
1381
|
+
successStatus: 200,
|
|
1382
|
+
declaredStatuses: [400, 401, 404],
|
|
1383
|
+
empty: false
|
|
1384
|
+
}, requestOptions),
|
|
1385
|
+
remove: (input, requestOptions) => request({
|
|
1386
|
+
method: "DELETE",
|
|
1387
|
+
path: `/api/shell/${encodeURIComponent(input.id)}`,
|
|
1388
|
+
query: { location: input["location"] },
|
|
1389
|
+
successStatus: 204,
|
|
1390
|
+
declaredStatuses: [400, 401],
|
|
1391
|
+
empty: true
|
|
1392
|
+
}, requestOptions)
|
|
1393
|
+
},
|
|
1394
|
+
reference: {
|
|
1395
|
+
list: (input, requestOptions) => request({
|
|
1396
|
+
method: "GET",
|
|
1397
|
+
path: `/api/reference`,
|
|
1398
|
+
query: { location: input?.["location"] },
|
|
1399
|
+
successStatus: 200,
|
|
1400
|
+
declaredStatuses: [400, 401],
|
|
1401
|
+
empty: false
|
|
1402
|
+
}, requestOptions)
|
|
1403
|
+
},
|
|
1404
|
+
worktree: {
|
|
1405
|
+
list: (input, requestOptions) => request({
|
|
1406
|
+
method: "GET",
|
|
1407
|
+
path: `/api/worktree`,
|
|
1408
|
+
query: { projectID: input["projectID"] },
|
|
1409
|
+
successStatus: 200,
|
|
1410
|
+
declaredStatuses: [400, 401, 404],
|
|
1411
|
+
empty: false
|
|
1412
|
+
}, requestOptions),
|
|
1413
|
+
create: (input, requestOptions) => request({
|
|
1414
|
+
method: "POST",
|
|
1415
|
+
path: `/api/worktree`,
|
|
1416
|
+
body: {
|
|
1417
|
+
projectID: input["projectID"],
|
|
1418
|
+
from: input["from"],
|
|
1419
|
+
branch: input["branch"],
|
|
1420
|
+
directory: input["directory"],
|
|
1421
|
+
name: input["name"]
|
|
1422
|
+
},
|
|
1423
|
+
successStatus: 200,
|
|
1424
|
+
declaredStatuses: [400, 401, 404],
|
|
1425
|
+
empty: false
|
|
1426
|
+
}, requestOptions),
|
|
1427
|
+
remove: (input, requestOptions) => request({
|
|
1428
|
+
method: "DELETE",
|
|
1429
|
+
path: `/api/worktree`,
|
|
1430
|
+
body: { projectID: input["projectID"], directory: input["directory"], force: input["force"] },
|
|
1431
|
+
successStatus: 204,
|
|
1432
|
+
declaredStatuses: [400, 401, 404],
|
|
1433
|
+
empty: true
|
|
1434
|
+
}, requestOptions),
|
|
1435
|
+
refresh: (input, requestOptions) => request({
|
|
1436
|
+
method: "POST",
|
|
1437
|
+
path: `/api/worktree/refresh`,
|
|
1438
|
+
body: { projectID: input["projectID"] },
|
|
1439
|
+
successStatus: 204,
|
|
1440
|
+
declaredStatuses: [400, 401, 404],
|
|
1441
|
+
empty: true
|
|
1442
|
+
}, requestOptions)
|
|
1443
|
+
},
|
|
1444
|
+
vcs: {
|
|
1445
|
+
get: (input, requestOptions) => request({
|
|
1446
|
+
method: "GET",
|
|
1447
|
+
path: `/api/vcs`,
|
|
1448
|
+
query: { location: input?.["location"] },
|
|
1449
|
+
successStatus: 200,
|
|
1450
|
+
declaredStatuses: [400, 401],
|
|
1451
|
+
empty: false
|
|
1452
|
+
}, requestOptions),
|
|
1453
|
+
base: (input, requestOptions) => request({
|
|
1454
|
+
method: "GET",
|
|
1455
|
+
path: `/api/vcs/base`,
|
|
1456
|
+
query: { location: input?.["location"] },
|
|
1457
|
+
successStatus: 200,
|
|
1458
|
+
declaredStatuses: [400, 401, 503],
|
|
1459
|
+
empty: false
|
|
1460
|
+
}, requestOptions),
|
|
1461
|
+
status: (input, requestOptions) => request({
|
|
1462
|
+
method: "GET",
|
|
1463
|
+
path: `/api/vcs/status`,
|
|
1464
|
+
query: { location: input?.["location"] },
|
|
1465
|
+
successStatus: 200,
|
|
1466
|
+
declaredStatuses: [400, 401],
|
|
1467
|
+
empty: false
|
|
1468
|
+
}, requestOptions),
|
|
1469
|
+
branch: {
|
|
1470
|
+
list: (input, requestOptions) => request({
|
|
1471
|
+
method: "GET",
|
|
1472
|
+
path: `/api/vcs/branch`,
|
|
1473
|
+
query: { location: input?.["location"], search: input?.["search"], limit: input?.["limit"] },
|
|
1474
|
+
successStatus: 200,
|
|
1475
|
+
declaredStatuses: [400, 401],
|
|
1476
|
+
empty: false
|
|
1477
|
+
}, requestOptions)
|
|
1478
|
+
},
|
|
1479
|
+
diff: (input, requestOptions) => request({
|
|
1480
|
+
method: "GET",
|
|
1481
|
+
path: `/api/vcs/diff`,
|
|
1482
|
+
query: { location: input["location"], mode: input["mode"], base: input["base"], context: input["context"] },
|
|
1483
|
+
successStatus: 200,
|
|
1484
|
+
declaredStatuses: [400, 401, 503],
|
|
1485
|
+
empty: false
|
|
1486
|
+
}, requestOptions)
|
|
1487
|
+
},
|
|
1488
|
+
debug: {
|
|
1489
|
+
location: {
|
|
1490
|
+
list: (requestOptions) => request({
|
|
1491
|
+
method: "GET",
|
|
1492
|
+
path: `/api/debug/location`,
|
|
1493
|
+
successStatus: 200,
|
|
1494
|
+
declaredStatuses: [400, 401],
|
|
1495
|
+
empty: false
|
|
1496
|
+
}, requestOptions),
|
|
1497
|
+
evict: (input, requestOptions) => request({
|
|
1498
|
+
method: "DELETE",
|
|
1499
|
+
path: `/api/debug/location`,
|
|
1500
|
+
query: { location: input?.["location"] },
|
|
1501
|
+
successStatus: 204,
|
|
1502
|
+
declaredStatuses: [400, 401],
|
|
1503
|
+
empty: true
|
|
1504
|
+
}, requestOptions)
|
|
1505
|
+
}
|
|
1506
|
+
},
|
|
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
|
+
websearch: {
|
|
1519
|
+
providers: (input, requestOptions) => request({
|
|
1520
|
+
method: "GET",
|
|
1521
|
+
path: `/api/websearch/provider`,
|
|
1522
|
+
query: { location: input?.["location"] },
|
|
1523
|
+
successStatus: 200,
|
|
1524
|
+
declaredStatuses: [400, 401, 503],
|
|
1525
|
+
empty: false
|
|
1526
|
+
}, requestOptions),
|
|
1527
|
+
query: (input, requestOptions) => request({
|
|
1528
|
+
method: "POST",
|
|
1529
|
+
path: `/api/websearch`,
|
|
1530
|
+
query: { location: input["location"] },
|
|
1531
|
+
body: { query: input["query"], providerID: input["providerID"] },
|
|
1532
|
+
successStatus: 200,
|
|
1533
|
+
declaredStatuses: [400, 401, 503],
|
|
1534
|
+
empty: false
|
|
1535
|
+
}, requestOptions)
|
|
1536
|
+
},
|
|
1537
|
+
config: {
|
|
1538
|
+
get: (input, requestOptions) => request({
|
|
1539
|
+
method: "GET",
|
|
1540
|
+
path: `/api/config`,
|
|
1541
|
+
query: { location: input?.["location"] },
|
|
1542
|
+
successStatus: 200,
|
|
1543
|
+
declaredStatuses: [400, 401],
|
|
1544
|
+
empty: false
|
|
1545
|
+
}, 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
|
|
1554
|
+
}, requestOptions)
|
|
1555
|
+
}
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1558
|
+
function encodePath(value) {
|
|
1559
|
+
return value.split("/").map(encodeURIComponent).join("/");
|
|
1560
|
+
}
|
|
1561
|
+
function appendQuery(params, key, value) {
|
|
1562
|
+
if (value === undefined)
|
|
1563
|
+
return;
|
|
1564
|
+
if (value === null) {
|
|
1565
|
+
params.append(key, "null");
|
|
1566
|
+
return;
|
|
1567
|
+
}
|
|
1568
|
+
if (Array.isArray(value)) {
|
|
1569
|
+
for (const item of value)
|
|
1570
|
+
appendQuery(params, key, item);
|
|
1571
|
+
return;
|
|
1572
|
+
}
|
|
1573
|
+
if (typeof value === "object") {
|
|
1574
|
+
for (const [child, item] of Object.entries(value))
|
|
1575
|
+
appendQuery(params, `${key}[${child}]`, item);
|
|
1576
|
+
return;
|
|
1577
|
+
}
|
|
1578
|
+
params.append(key, String(value));
|
|
1579
|
+
}
|
|
1580
|
+
async function json(response) {
|
|
1581
|
+
if (!isContentType(response, "application/json") && !response.headers.get("content-type")?.includes("+json")) {
|
|
1582
|
+
try {
|
|
1583
|
+
await response.body?.cancel();
|
|
1584
|
+
} catch {}
|
|
1585
|
+
throw new ClientError2("UnsupportedContentType", { detail: response.headers.get("content-type") });
|
|
1586
|
+
}
|
|
1587
|
+
let text;
|
|
1588
|
+
try {
|
|
1589
|
+
text = await response.text();
|
|
1590
|
+
} catch (cause) {
|
|
1591
|
+
throw new ClientError2("Transport", { cause });
|
|
1592
|
+
}
|
|
1593
|
+
if (text === "")
|
|
1594
|
+
throw new ClientError2("MalformedResponse");
|
|
1595
|
+
try {
|
|
1596
|
+
return JSON.parse(text);
|
|
1597
|
+
} catch (cause) {
|
|
1598
|
+
throw new ClientError2("MalformedResponse", { cause });
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
function declared(body) {
|
|
1602
|
+
const error = Object.assign(new Error(body.message ?? body.data?.message), body);
|
|
1603
|
+
if (body._tag)
|
|
1604
|
+
error.name = body._tag;
|
|
1605
|
+
return error;
|
|
1606
|
+
}
|
|
1607
|
+
function isContentType(response, expected) {
|
|
1608
|
+
return response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase() === expected;
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
// ../../node_modules/.bun/@opencode+client@2.0.19+43902b222b0d7d3e/node_modules/@opencode/client/dist/chunks/rpc-runtime-4tveyqeh.js
|
|
1612
|
+
var isRpcError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "RpcError";
|
|
1613
|
+
var isRpcInternalError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "RpcInternalError";
|
|
1614
|
+
|
|
1615
|
+
// ../../node_modules/.bun/@opencode+client@2.0.19+43902b222b0d7d3e/node_modules/@opencode/client/dist/chunks/rpc-runtime-1tbj6z39.js
|
|
1616
|
+
function makeRpc2(raw, events) {
|
|
1617
|
+
return (definition) => {
|
|
1618
|
+
const subscribe = (name, options) => {
|
|
1619
|
+
if (!Object.hasOwn(definition.events, name))
|
|
1620
|
+
throw new Error(`Unknown RPC event: ${definition.id}.${name}`);
|
|
1621
|
+
const type = eventType(definition, name);
|
|
1622
|
+
return {
|
|
1623
|
+
[Symbol.asyncIterator]() {
|
|
1624
|
+
const controller = new AbortController;
|
|
1625
|
+
const signal = options?.signal ? AbortSignal.any([controller.signal, options.signal]) : controller.signal;
|
|
1626
|
+
const iterator = async function* () {
|
|
1627
|
+
try {
|
|
1628
|
+
for await (const published of events.subscribe({ signal })) {
|
|
1629
|
+
if (signal.aborted)
|
|
1630
|
+
return;
|
|
1631
|
+
if (published.type !== type)
|
|
1632
|
+
continue;
|
|
1633
|
+
yield published;
|
|
1634
|
+
}
|
|
1635
|
+
} catch (error) {
|
|
1636
|
+
if (!signal.aborted)
|
|
1637
|
+
throw error;
|
|
1638
|
+
} finally {
|
|
1639
|
+
controller.abort();
|
|
1640
|
+
}
|
|
1641
|
+
}();
|
|
1642
|
+
return {
|
|
1643
|
+
next: () => iterator.next(),
|
|
1644
|
+
return: () => {
|
|
1645
|
+
controller.abort();
|
|
1646
|
+
return iterator.return();
|
|
1647
|
+
}
|
|
1648
|
+
};
|
|
1649
|
+
}
|
|
1650
|
+
};
|
|
1651
|
+
};
|
|
1652
|
+
return Object.assign(Object.fromEntries(Object.keys(definition.methods).map((name) => [
|
|
1653
|
+
name,
|
|
1654
|
+
async (input, options) => {
|
|
1655
|
+
try {
|
|
1656
|
+
const result = await raw.rpc.call({
|
|
1657
|
+
rpcID: definition.id,
|
|
1658
|
+
method: name,
|
|
1659
|
+
input,
|
|
1660
|
+
location: options?.location
|
|
1661
|
+
}, { signal: options?.signal, headers: options?.headers });
|
|
1662
|
+
return result.output;
|
|
1663
|
+
} catch (error) {
|
|
1664
|
+
if (!isRpcError2(error) && !isRpcInternalError2(error))
|
|
1665
|
+
throw error;
|
|
1666
|
+
throw error.data === undefined ? { type: error.type, message: error.message } : { type: error.type, message: error.message, data: error.data };
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
])), {
|
|
1670
|
+
events: {
|
|
1671
|
+
subscribe,
|
|
1672
|
+
on: (name, handler, options) => {
|
|
1673
|
+
const controller = new AbortController;
|
|
1674
|
+
const signal = options?.signal ? AbortSignal.any([controller.signal, options.signal]) : controller.signal;
|
|
1675
|
+
const source = subscribe(name, { signal });
|
|
1676
|
+
(async () => {
|
|
1677
|
+
for await (const event of source)
|
|
1678
|
+
await handler(event);
|
|
1679
|
+
})().catch((error) => console.error(error));
|
|
1680
|
+
return () => controller.abort();
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
});
|
|
1684
|
+
};
|
|
1685
|
+
}
|
|
1686
|
+
function eventType(definition, name) {
|
|
1687
|
+
return `rpc.${definition.id}.${name}`;
|
|
1688
|
+
}
|
|
1689
|
+
|
|
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
|
|
1695
|
+
});
|
|
1696
|
+
function make2(options) {
|
|
1697
|
+
const raw = make3(options);
|
|
1698
|
+
const events = make7((signal, onActivity) => raw.event.subscribe({ signal, onActivity }));
|
|
1699
|
+
return {
|
|
1700
|
+
...raw,
|
|
1701
|
+
rpc: Object.assign(makeRpc2(raw, events), raw.rpc),
|
|
1702
|
+
event: events
|
|
1703
|
+
};
|
|
1704
|
+
}
|
|
34
1705
|
// ../agent-runtime/src/http.ts
|
|
35
1706
|
class RuntimeHttpError extends Error {
|
|
36
1707
|
status;
|
|
@@ -49,138 +1720,44 @@ function isSessionNotFound(error) {
|
|
|
49
1720
|
function authorizationHeader(password) {
|
|
50
1721
|
return password ? { authorization: `Basic ${Buffer.from(`opencode:${password}`).toString("base64")}` } : {};
|
|
51
1722
|
}
|
|
52
|
-
function
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
async function send(path, init = {}) {
|
|
62
|
-
const { json, ...rest } = init;
|
|
63
|
-
const response = await (target.fetch ?? fetch)(runtimeUrl(target, path), {
|
|
64
|
-
...rest,
|
|
65
|
-
headers: {
|
|
66
|
-
accept: "application/json",
|
|
67
|
-
...json === undefined ? {} : { "content-type": "application/json" },
|
|
68
|
-
...headers,
|
|
69
|
-
...rest.headers
|
|
70
|
-
},
|
|
71
|
-
body: json === undefined ? rest.body : JSON.stringify(json),
|
|
72
|
-
signal: rest.signal ?? (target.signal ? AbortSignal.any([target.signal, AbortSignal.timeout(15000)]) : AbortSignal.timeout(15000))
|
|
73
|
-
});
|
|
74
|
-
if (!response.ok) {
|
|
1723
|
+
function createOpencodeClient(target) {
|
|
1724
|
+
const send = target.fetch ?? fetch;
|
|
1725
|
+
return exports_client.make({
|
|
1726
|
+
baseUrl: target.url,
|
|
1727
|
+
headers: { ...target.headers, ...authorizationHeader(target.password) },
|
|
1728
|
+
fetch: async (input, init) => {
|
|
1729
|
+
const response = await send(input, init);
|
|
1730
|
+
if (response.ok)
|
|
1731
|
+
return response;
|
|
75
1732
|
const body = await response.text().catch(() => "");
|
|
76
|
-
|
|
77
|
-
try {
|
|
78
|
-
const parsed = JSON.parse(body);
|
|
79
|
-
tag = typeof parsed._tag === "string" ? parsed._tag : typeof parsed.name === "string" ? parsed.name : null;
|
|
80
|
-
} catch {}
|
|
81
|
-
throw new RuntimeHttpError(response.status, body, tag);
|
|
82
|
-
}
|
|
83
|
-
return response;
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
send,
|
|
87
|
-
async json(path, init) {
|
|
88
|
-
const response = await send(path, init);
|
|
89
|
-
const text = await response.text();
|
|
90
|
-
return text ? JSON.parse(text) : undefined;
|
|
1733
|
+
throw new RuntimeHttpError(response.status, body, errorTag(body));
|
|
91
1734
|
}
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
async function* readServerSentEvents(url, init) {
|
|
95
|
-
const response = await (init.fetch ?? fetch)(url, {
|
|
96
|
-
headers: { accept: "text/event-stream", ...init.headers },
|
|
97
|
-
signal: init.signal
|
|
98
1735
|
});
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
const reader = response.body.getReader();
|
|
106
|
-
const onAbort = () => {
|
|
107
|
-
reader.cancel().catch(() => {});
|
|
108
|
-
};
|
|
109
|
-
init.signal.addEventListener("abort", onAbort, { once: true });
|
|
110
|
-
const decoder = new TextDecoder;
|
|
111
|
-
let buffer = "";
|
|
112
|
-
let data = [];
|
|
113
|
-
let event = null;
|
|
1736
|
+
}
|
|
1737
|
+
function unwrapClientError(error) {
|
|
1738
|
+
return error instanceof ClientError2 && error.reason === "Transport" && error.cause !== undefined ? error.cause : error;
|
|
1739
|
+
}
|
|
1740
|
+
async function call(operation) {
|
|
114
1741
|
try {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const { value, done } = await reader.read();
|
|
119
|
-
if (done)
|
|
120
|
-
break;
|
|
121
|
-
buffer += decoder.decode(value, { stream: true });
|
|
122
|
-
let newline = buffer.indexOf(`
|
|
123
|
-
`);
|
|
124
|
-
while (newline >= 0) {
|
|
125
|
-
let line = buffer.slice(0, newline);
|
|
126
|
-
buffer = buffer.slice(newline + 1);
|
|
127
|
-
newline = buffer.indexOf(`
|
|
128
|
-
`);
|
|
129
|
-
if (line.endsWith("\r"))
|
|
130
|
-
line = line.slice(0, -1);
|
|
131
|
-
if (line === "") {
|
|
132
|
-
if (data.length > 0)
|
|
133
|
-
yield { event, data: data.join(`
|
|
134
|
-
`) };
|
|
135
|
-
data = [];
|
|
136
|
-
event = null;
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
if (line.startsWith(":"))
|
|
140
|
-
continue;
|
|
141
|
-
const colon = line.indexOf(":");
|
|
142
|
-
const field = colon === -1 ? line : line.slice(0, colon);
|
|
143
|
-
let fieldValue = colon === -1 ? "" : line.slice(colon + 1);
|
|
144
|
-
if (fieldValue.startsWith(" "))
|
|
145
|
-
fieldValue = fieldValue.slice(1);
|
|
146
|
-
if (field === "data")
|
|
147
|
-
data.push(fieldValue);
|
|
148
|
-
else if (field === "event")
|
|
149
|
-
event = fieldValue;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
init.signal.throwIfAborted();
|
|
153
|
-
} finally {
|
|
154
|
-
init.signal.removeEventListener("abort", onAbort);
|
|
155
|
-
await reader.cancel().catch(() => {
|
|
156
|
-
return;
|
|
157
|
-
});
|
|
1742
|
+
return await operation;
|
|
1743
|
+
} catch (error) {
|
|
1744
|
+
throw unwrapClientError(error);
|
|
158
1745
|
}
|
|
159
1746
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
fetch: target.fetch
|
|
165
|
-
});
|
|
166
|
-
for await (const item of stream) {
|
|
167
|
-
if (item.event === "open") {
|
|
168
|
-
yield { type: "connected" };
|
|
169
|
-
continue;
|
|
170
|
-
}
|
|
171
|
-
const raw = parseEventData(item.data);
|
|
172
|
-
const parsed = raw && parse(raw);
|
|
173
|
-
if (parsed)
|
|
174
|
-
yield parsed;
|
|
175
|
-
}
|
|
1747
|
+
function requestTimeout(signal, timeoutMs = 15000) {
|
|
1748
|
+
return {
|
|
1749
|
+
signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(timeoutMs)]) : AbortSignal.timeout(timeoutMs)
|
|
1750
|
+
};
|
|
176
1751
|
}
|
|
177
|
-
function
|
|
1752
|
+
function errorTag(body) {
|
|
178
1753
|
try {
|
|
179
|
-
const parsed = JSON.parse(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
1754
|
+
const parsed = JSON.parse(body);
|
|
1755
|
+
if (typeof parsed._tag === "string")
|
|
1756
|
+
return parsed._tag;
|
|
1757
|
+
if (typeof parsed.name === "string")
|
|
1758
|
+
return parsed.name;
|
|
1759
|
+
} catch {}
|
|
1760
|
+
return null;
|
|
184
1761
|
}
|
|
185
1762
|
function asRecord(value) {
|
|
186
1763
|
return value && typeof value === "object" ? value : {};
|
|
@@ -226,63 +1803,56 @@ function truncateToolOutput(value) {
|
|
|
226
1803
|
}
|
|
227
1804
|
|
|
228
1805
|
// ../agent-runtime/src/v2.ts
|
|
229
|
-
function session(sessionId) {
|
|
230
|
-
return `/api/session/${encodeURIComponent(sessionId)}`;
|
|
231
|
-
}
|
|
232
1806
|
function createV2Runtime(target) {
|
|
233
|
-
const
|
|
234
|
-
|
|
1807
|
+
const client = createOpencodeClient(target);
|
|
1808
|
+
const options = () => requestTimeout(target.signal);
|
|
1809
|
+
async function switchSessionOptions(sessionID, agent, model) {
|
|
235
1810
|
const modelRef = parseModelRef(model);
|
|
236
1811
|
if (modelRef) {
|
|
237
|
-
await
|
|
238
|
-
method: "POST",
|
|
239
|
-
json: { model: { providerID: modelRef.providerID, id: modelRef.modelID } }
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
if (agent) {
|
|
243
|
-
await http.send(`${session(sessionId)}/agent`, { method: "POST", json: { agent } });
|
|
1812
|
+
await call(client.session.switchModel({ sessionID, model: { providerID: modelRef.providerID, id: modelRef.modelID } }, options()));
|
|
244
1813
|
}
|
|
1814
|
+
if (agent)
|
|
1815
|
+
await call(client.session.switchAgent({ sessionID, agent }, options()));
|
|
245
1816
|
}
|
|
246
1817
|
return {
|
|
247
1818
|
async createSession(input) {
|
|
248
1819
|
const modelRef = parseModelRef(input.model);
|
|
249
|
-
const created = await
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
return { id: created.data.id, title: created.data.title ?? input.title ?? "Agent run" };
|
|
1820
|
+
const created = await call(client.session.create({
|
|
1821
|
+
title: input.title,
|
|
1822
|
+
agent: input.agent,
|
|
1823
|
+
model: modelRef ? { providerID: modelRef.providerID, id: modelRef.modelID } : undefined,
|
|
1824
|
+
location: { directory: target.directory }
|
|
1825
|
+
}, options()));
|
|
1826
|
+
return { id: created.id, title: created.title ?? input.title ?? "Agent run" };
|
|
259
1827
|
},
|
|
260
1828
|
async prompt(input) {
|
|
261
1829
|
await switchSessionOptions(input.sessionId, input.agent, input.model);
|
|
262
|
-
await
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
1830
|
+
await call(client.session.prompt({
|
|
1831
|
+
sessionID: input.sessionId,
|
|
1832
|
+
id: input.messageId,
|
|
1833
|
+
text: input.prompt,
|
|
1834
|
+
files: input.files
|
|
1835
|
+
}, options()));
|
|
266
1836
|
},
|
|
267
|
-
async abort(
|
|
268
|
-
await
|
|
1837
|
+
async abort(sessionID) {
|
|
1838
|
+
await call(client.session.interrupt({ sessionID }, options()));
|
|
269
1839
|
},
|
|
270
|
-
async deleteSession(
|
|
271
|
-
await
|
|
1840
|
+
async deleteSession(sessionID) {
|
|
1841
|
+
await call(client.session.remove({ sessionID }, options()));
|
|
272
1842
|
},
|
|
273
|
-
async snapshot(
|
|
1843
|
+
async snapshot(sessionID, messageId) {
|
|
274
1844
|
try {
|
|
275
|
-
await
|
|
1845
|
+
await call(client.session.get({ sessionID }, options()));
|
|
276
1846
|
} catch (error) {
|
|
277
1847
|
if (isSessionNotFound(error))
|
|
278
1848
|
return missingSessionSnapshot();
|
|
279
1849
|
throw error;
|
|
280
1850
|
}
|
|
281
1851
|
const [active, messages, permissions, forms] = await Promise.all([
|
|
282
|
-
|
|
283
|
-
listMessages(
|
|
284
|
-
|
|
285
|
-
|
|
1852
|
+
call(client.session.active(options())),
|
|
1853
|
+
listMessages(sessionID),
|
|
1854
|
+
call(client.permission.list({ sessionID }, options())),
|
|
1855
|
+
call(client.session.form.list({ sessionID }, options()))
|
|
286
1856
|
]);
|
|
287
1857
|
const runMessages = selectRunMessages(messages, messageId);
|
|
288
1858
|
const userIndex = messages.findIndex((message) => message.id === messageId);
|
|
@@ -294,7 +1864,7 @@ function createV2Runtime(target) {
|
|
|
294
1864
|
return {
|
|
295
1865
|
sessionExists: true,
|
|
296
1866
|
superseded,
|
|
297
|
-
busy:
|
|
1867
|
+
busy: sessionID in active,
|
|
298
1868
|
retry: Boolean(assistant?.retry) && assistantTime.completed == null,
|
|
299
1869
|
messages: runMessages.map(normalizeMessage),
|
|
300
1870
|
finalText: finalText || null,
|
|
@@ -306,49 +1876,51 @@ function createV2Runtime(target) {
|
|
|
306
1876
|
message: asString(assistantError.message) ?? "Agent request failed"
|
|
307
1877
|
} : null
|
|
308
1878
|
},
|
|
309
|
-
pendingInputs: superseded ? [] : [
|
|
310
|
-
...(permissions.data ?? []).map(asRecord).map(permissionRequest),
|
|
311
|
-
...(forms.data ?? []).map(asRecord).map(formRequest)
|
|
312
|
-
]
|
|
1879
|
+
pendingInputs: superseded ? [] : [...permissions.map(permissionRequest), ...forms.map(formRequest)]
|
|
313
1880
|
};
|
|
314
1881
|
},
|
|
315
|
-
subscribe
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
1882
|
+
async* subscribe(signal) {
|
|
1883
|
+
try {
|
|
1884
|
+
for await (const event of client.event.subscribe({ signal })) {
|
|
1885
|
+
if (event.type === "server.connected") {
|
|
1886
|
+
yield { type: "connected" };
|
|
1887
|
+
continue;
|
|
1888
|
+
}
|
|
1889
|
+
const parsed = parseV2Signal(event);
|
|
1890
|
+
if (parsed)
|
|
1891
|
+
yield parsed;
|
|
1892
|
+
}
|
|
1893
|
+
signal.throwIfAborted();
|
|
1894
|
+
} catch (error) {
|
|
1895
|
+
throw unwrapClientError(error);
|
|
1896
|
+
}
|
|
1897
|
+
},
|
|
1898
|
+
async replyPermission(sessionID, requestID, decision) {
|
|
1899
|
+
await call(client.permission.reply({ sessionID, requestID, decision }, options()));
|
|
321
1900
|
},
|
|
322
|
-
async replyQuestion(
|
|
1901
|
+
async replyQuestion(sessionID, request, answers) {
|
|
323
1902
|
const answer = {};
|
|
324
1903
|
request.questions.forEach((question, index) => {
|
|
325
1904
|
const selected = (answers[index] ?? []).map((label) => optionValue(question, label));
|
|
326
1905
|
answer[question.key] = question.multiple ? selected : selected[0] ?? "";
|
|
327
1906
|
});
|
|
328
|
-
await
|
|
329
|
-
method: "POST",
|
|
330
|
-
json: { answer }
|
|
331
|
-
});
|
|
1907
|
+
await call(client.session.form.reply({ sessionID, formID: request.id, answer }, options()));
|
|
332
1908
|
},
|
|
333
|
-
async rejectQuestion(
|
|
334
|
-
await
|
|
335
|
-
method: "POST",
|
|
336
|
-
json: {}
|
|
337
|
-
});
|
|
1909
|
+
async rejectQuestion(sessionID, formID) {
|
|
1910
|
+
await call(client.session.form.cancel({ sessionID, formID }, options()));
|
|
338
1911
|
}
|
|
339
1912
|
};
|
|
340
|
-
async function listMessages(
|
|
341
|
-
const
|
|
1913
|
+
async function listMessages(sessionID) {
|
|
1914
|
+
const limit = 200;
|
|
342
1915
|
const messages = [];
|
|
343
|
-
let
|
|
1916
|
+
let cursor;
|
|
344
1917
|
while (true) {
|
|
345
|
-
const page = await
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
if (!next || items.length < pageSize)
|
|
1918
|
+
const page = await call(client.message.list(cursor ? { sessionID, cursor, limit } : { sessionID, order: "asc", limit }, options()));
|
|
1919
|
+
messages.push(...page.data);
|
|
1920
|
+
const next = page.cursor.next ?? null;
|
|
1921
|
+
if (!next || page.data.length < limit)
|
|
350
1922
|
break;
|
|
351
|
-
|
|
1923
|
+
cursor = next;
|
|
352
1924
|
}
|
|
353
1925
|
return messages;
|
|
354
1926
|
}
|
|
@@ -970,11 +2542,6 @@ function directRunOperations(assertWorkspace, fetchImpl) {
|
|
|
970
2542
|
};
|
|
971
2543
|
}
|
|
972
2544
|
|
|
973
|
-
// src/direct/client.ts
|
|
974
|
-
import {
|
|
975
|
-
createOpencodeClient as createOpencodeV2Client
|
|
976
|
-
} from "@opencode-ai/sdk/v2";
|
|
977
|
-
|
|
978
2545
|
// src/direct/ascii.ts
|
|
979
2546
|
import { BoxApi, Configuration, waitUntilReady } from "@asciidev/box-sdk";
|
|
980
2547
|
|
|
@@ -2951,35 +4518,6 @@ function resolveProvider(provider) {
|
|
|
2951
4518
|
return createVercelDirectProvider(provider);
|
|
2952
4519
|
}
|
|
2953
4520
|
}
|
|
2954
|
-
function createAuthClient(workspace, fetchImpl) {
|
|
2955
|
-
const authorization = workspace.runtime.password ? `Basic ${Buffer.from(`opencode:${workspace.runtime.password}`).toString("base64")}` : undefined;
|
|
2956
|
-
return createOpencodeV2Client({
|
|
2957
|
-
fetch: fetchImpl,
|
|
2958
|
-
baseUrl: workspace.runtime.url,
|
|
2959
|
-
directory: workspace.runtime.directory,
|
|
2960
|
-
headers: {
|
|
2961
|
-
...workspace.runtime.headers,
|
|
2962
|
-
...authorization ? { Authorization: authorization } : {}
|
|
2963
|
-
}
|
|
2964
|
-
});
|
|
2965
|
-
}
|
|
2966
|
-
function errorMessage(error) {
|
|
2967
|
-
if (!error)
|
|
2968
|
-
return "OpenCode request failed";
|
|
2969
|
-
if (typeof error === "string")
|
|
2970
|
-
return error;
|
|
2971
|
-
if (typeof error === "object" && "data" in error) {
|
|
2972
|
-
const data = error.data;
|
|
2973
|
-
if (typeof data?.message === "string")
|
|
2974
|
-
return data.message;
|
|
2975
|
-
}
|
|
2976
|
-
if (typeof error === "object" && "message" in error) {
|
|
2977
|
-
const message = error.message;
|
|
2978
|
-
if (typeof message === "string")
|
|
2979
|
-
return message;
|
|
2980
|
-
}
|
|
2981
|
-
return error instanceof Error ? error.message : JSON.stringify(error);
|
|
2982
|
-
}
|
|
2983
4521
|
function authStatus(status) {
|
|
2984
4522
|
const common = {
|
|
2985
4523
|
createdAt: Number(status.time.created),
|
|
@@ -3034,14 +4572,20 @@ function setupRunner(commands) {
|
|
|
3034
4572
|
}
|
|
3035
4573
|
function createDirectGittermClient(options) {
|
|
3036
4574
|
const provider = resolveProvider(options.provider);
|
|
3037
|
-
const
|
|
3038
|
-
const http = (workspace) => createRuntimeHttp({
|
|
4575
|
+
const opencode = (workspace) => createOpencodeClient({
|
|
3039
4576
|
url: workspace.runtime.url,
|
|
3040
|
-
directory: workspace.runtime.directory,
|
|
3041
4577
|
password: workspace.runtime.password ?? null,
|
|
3042
4578
|
headers: workspace.runtime.headers,
|
|
3043
4579
|
fetch: options.fetch
|
|
3044
4580
|
});
|
|
4581
|
+
const location = (workspace) => ({ directory: workspace.runtime.directory });
|
|
4582
|
+
async function request(operation) {
|
|
4583
|
+
try {
|
|
4584
|
+
return await call(operation(requestTimeout()));
|
|
4585
|
+
} catch (error) {
|
|
4586
|
+
throw directError(error);
|
|
4587
|
+
}
|
|
4588
|
+
}
|
|
3045
4589
|
function assertWorkspace(workspace) {
|
|
3046
4590
|
if (workspace.provider !== provider.name) {
|
|
3047
4591
|
throw new GittermError("BAD_REQUEST", `Workspace belongs to ${workspace.provider}, not ${provider.name}`);
|
|
@@ -3055,22 +4599,26 @@ function createDirectGittermClient(options) {
|
|
|
3055
4599
|
}
|
|
3056
4600
|
async function getAuthStatus(attempt, workspace) {
|
|
3057
4601
|
assertAuthAttempt(attempt, workspace);
|
|
3058
|
-
const result = await
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
return authStatus(result.data
|
|
4602
|
+
const result = await request((requestOptions) => opencode(workspace).integration.oauth.status({
|
|
4603
|
+
integrationID: attempt.integrationId,
|
|
4604
|
+
attemptID: attempt.id,
|
|
4605
|
+
location: location(workspace)
|
|
4606
|
+
}, requestOptions));
|
|
4607
|
+
return authStatus(result.data);
|
|
3064
4608
|
}
|
|
3065
4609
|
async function startPty(workspace, command, title) {
|
|
3066
|
-
return
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
4610
|
+
return request((requestOptions) => opencode(workspace).pty.create({
|
|
4611
|
+
location: location(workspace),
|
|
4612
|
+
command: "bash",
|
|
4613
|
+
args: ["-lc", command],
|
|
4614
|
+
cwd: workspace.runtime.directory,
|
|
4615
|
+
title
|
|
4616
|
+
}, requestOptions));
|
|
3070
4617
|
}
|
|
3071
4618
|
async function setupFile(workspace, name) {
|
|
3072
4619
|
try {
|
|
3073
|
-
|
|
4620
|
+
const bytes = await call(opencode(workspace).file.read({ path: `${SETUP_DIR}/${name}`, location: location(workspace) }, requestTimeout()));
|
|
4621
|
+
return new TextDecoder().decode(bytes).trim();
|
|
3074
4622
|
} catch (error) {
|
|
3075
4623
|
if (error instanceof RuntimeHttpError && error.status === 404)
|
|
3076
4624
|
return null;
|
|
@@ -3125,45 +4673,37 @@ function createDirectGittermClient(options) {
|
|
|
3125
4673
|
if (credential.source !== "apiKey")
|
|
3126
4674
|
throw new GittermError("BAD_REQUEST", "Use connectOAuth() for OAuth credential rotation, or inject an OAuth bundle when creating the workspace");
|
|
3127
4675
|
directModelAuth(credential);
|
|
3128
|
-
await
|
|
4676
|
+
await request((requestOptions) => opencode(workspace).integration.connect.key({ integrationID: providerName, key: credential.apiKey, location: location(workspace) }, requestOptions));
|
|
3129
4677
|
},
|
|
3130
4678
|
async list(workspace) {
|
|
3131
4679
|
assertWorkspace(workspace);
|
|
3132
|
-
const result = await
|
|
3133
|
-
|
|
3134
|
-
throw new Error(errorMessage(result.error));
|
|
3135
|
-
return result.data.data;
|
|
4680
|
+
const result = await request((requestOptions) => opencode(workspace).integration.list({ location: location(workspace) }, requestOptions));
|
|
4681
|
+
return result.data;
|
|
3136
4682
|
},
|
|
3137
4683
|
async get(workspace, integrationId) {
|
|
3138
4684
|
assertWorkspace(workspace);
|
|
3139
|
-
const result = await
|
|
3140
|
-
|
|
3141
|
-
});
|
|
3142
|
-
if (result.error || !result.data)
|
|
3143
|
-
throw new Error(errorMessage(result.error));
|
|
3144
|
-
return result.data.data;
|
|
4685
|
+
const result = await request((requestOptions) => opencode(workspace).integration.get({ integrationID: integrationId, location: location(workspace) }, requestOptions));
|
|
4686
|
+
return result.data;
|
|
3145
4687
|
},
|
|
3146
4688
|
async connectKey(input) {
|
|
3147
4689
|
assertWorkspace(input.workspace);
|
|
3148
|
-
|
|
4690
|
+
await request((requestOptions) => opencode(input.workspace).integration.connect.key({
|
|
3149
4691
|
integrationID: input.integrationId,
|
|
3150
4692
|
key: input.key,
|
|
3151
|
-
label: input.label
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
throw new Error(errorMessage(result.error));
|
|
4693
|
+
label: input.label,
|
|
4694
|
+
location: location(input.workspace)
|
|
4695
|
+
}, requestOptions));
|
|
3155
4696
|
},
|
|
3156
4697
|
async connectOAuth(input) {
|
|
3157
4698
|
assertWorkspace(input.workspace);
|
|
3158
|
-
const result = await
|
|
4699
|
+
const result = await request((requestOptions) => opencode(input.workspace).integration.oauth.connect({
|
|
3159
4700
|
integrationID: input.integrationId,
|
|
3160
4701
|
methodID: input.methodId,
|
|
3161
|
-
|
|
3162
|
-
label: input.label
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
const attempt = result.data.data;
|
|
4702
|
+
answer: input.inputs,
|
|
4703
|
+
label: input.label,
|
|
4704
|
+
location: location(input.workspace)
|
|
4705
|
+
}, requestOptions));
|
|
4706
|
+
const attempt = result.data;
|
|
3167
4707
|
return {
|
|
3168
4708
|
id: attempt.attemptID,
|
|
3169
4709
|
workspaceId: input.workspace.id,
|
|
@@ -3184,12 +4724,12 @@ function createDirectGittermClient(options) {
|
|
|
3184
4724
|
throw new Error("Only code-based OAuth attempts are completed manually");
|
|
3185
4725
|
if (!code.trim())
|
|
3186
4726
|
throw new Error("OAuth authorization code is required");
|
|
3187
|
-
|
|
4727
|
+
await request((requestOptions) => opencode(workspace).integration.oauth.complete({
|
|
4728
|
+
integrationID: attempt.integrationId,
|
|
3188
4729
|
attemptID: attempt.id,
|
|
3189
|
-
code
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
throw new Error(errorMessage(result.error));
|
|
4730
|
+
code,
|
|
4731
|
+
location: location(workspace)
|
|
4732
|
+
}, requestOptions));
|
|
3193
4733
|
},
|
|
3194
4734
|
async wait(attempt, workspace, wait = {}) {
|
|
3195
4735
|
assertAuthAttempt(attempt, workspace);
|
|
@@ -3212,11 +4752,11 @@ function createDirectGittermClient(options) {
|
|
|
3212
4752
|
},
|
|
3213
4753
|
async cancel(attempt, workspace) {
|
|
3214
4754
|
assertAuthAttempt(attempt, workspace);
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
4755
|
+
await request((requestOptions) => opencode(workspace).integration.oauth.cancel({
|
|
4756
|
+
integrationID: attempt.integrationId,
|
|
4757
|
+
attemptID: attempt.id,
|
|
4758
|
+
location: location(workspace)
|
|
4759
|
+
}, requestOptions));
|
|
3220
4760
|
}
|
|
3221
4761
|
},
|
|
3222
4762
|
workspaces: {
|