@laburen/delta-sdk 1.3.0 → 1.5.0-canary.11
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/CHANGELOG.md +24 -0
- package/README.md +3 -0
- package/dist/core/config.d.ts +12 -12
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +88 -88
- package/dist/core/config.js.map +1 -1
- package/dist/core/{constantes.d.ts → constants.d.ts} +3 -3
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/{constantes.js → constants.js} +3 -3
- package/dist/core/constants.js.map +1 -0
- package/dist/core/{contadores.d.ts → counters.d.ts} +12 -11
- package/dist/core/counters.d.ts.map +1 -0
- package/dist/core/counters.js +53 -0
- package/dist/core/counters.js.map +1 -0
- package/dist/core/{sobre.d.ts → envelope.d.ts} +17 -17
- package/dist/core/envelope.d.ts.map +1 -0
- package/dist/core/envelope.js +198 -0
- package/dist/core/envelope.js.map +1 -0
- package/dist/core/scrubbing.d.ts +4 -4
- package/dist/core/scrubbing.d.ts.map +1 -1
- package/dist/core/scrubbing.js +38 -38
- package/dist/core/scrubbing.js.map +1 -1
- package/dist/core/{sesion.d.ts → session.d.ts} +2 -2
- package/dist/core/session.d.ts.map +1 -0
- package/dist/core/{sesion.js → session.js} +2 -2
- package/dist/core/session.js.map +1 -0
- package/dist/core/{transporte.d.ts → transport.d.ts} +9 -9
- package/dist/core/transport.d.ts.map +1 -0
- package/dist/core/{transporte.js → transport.js} +15 -15
- package/dist/core/transport.js.map +1 -0
- package/dist/core/{tipos.d.ts → types.d.ts} +4 -4
- package/dist/core/{tipos.d.ts.map → types.d.ts.map} +1 -1
- package/dist/core/{tipos.js → types.js} +1 -1
- package/dist/core/{tipos.js.map → types.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/platform/client.d.ts +8 -0
- package/dist/platform/client.d.ts.map +1 -0
- package/dist/platform/client.js +30 -0
- package/dist/platform/client.js.map +1 -0
- package/dist/platform/core/errors.d.ts +150 -0
- package/dist/platform/core/errors.d.ts.map +1 -0
- package/dist/platform/core/errors.js +265 -0
- package/dist/platform/core/errors.js.map +1 -0
- package/dist/platform/core/oauth.d.ts +37 -0
- package/dist/platform/core/oauth.d.ts.map +1 -0
- package/dist/platform/core/oauth.js +144 -0
- package/dist/platform/core/oauth.js.map +1 -0
- package/dist/platform/core/pagination.d.ts +30 -0
- package/dist/platform/core/pagination.d.ts.map +1 -0
- package/dist/platform/core/pagination.js +44 -0
- package/dist/platform/core/pagination.js.map +1 -0
- package/dist/platform/core/request.d.ts +6 -0
- package/dist/platform/core/request.d.ts.map +1 -0
- package/dist/platform/core/request.js +24 -0
- package/dist/platform/core/request.js.map +1 -0
- package/dist/platform/core/send.d.ts +36 -0
- package/dist/platform/core/send.d.ts.map +1 -0
- package/dist/platform/core/send.js +184 -0
- package/dist/platform/core/send.js.map +1 -0
- package/dist/platform/core/sse.d.ts +8 -0
- package/dist/platform/core/sse.d.ts.map +1 -0
- package/dist/platform/core/sse.js +72 -0
- package/dist/platform/core/sse.js.map +1 -0
- package/dist/platform/core/stream.d.ts +21 -0
- package/dist/platform/core/stream.d.ts.map +1 -0
- package/dist/platform/core/stream.js +268 -0
- package/dist/platform/core/stream.js.map +1 -0
- package/dist/platform/generated/resources.d.ts +120 -0
- package/dist/platform/generated/resources.d.ts.map +1 -0
- package/dist/platform/generated/resources.js +65 -0
- package/dist/platform/generated/resources.js.map +1 -0
- package/dist/platform/generated/schemas.d.ts +88 -0
- package/dist/platform/generated/schemas.d.ts.map +1 -0
- package/dist/platform/generated/schemas.js +2 -0
- package/dist/platform/generated/schemas.js.map +1 -0
- package/dist/platform/generated/types.d.ts +5181 -0
- package/dist/platform/generated/types.d.ts.map +1 -0
- package/dist/platform/generated/types.js +6 -0
- package/dist/platform/generated/types.js.map +1 -0
- package/dist/platform/index.d.ts +9 -0
- package/dist/platform/index.d.ts.map +1 -0
- package/dist/platform/index.js +7 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/telemetry/{captura.d.ts → capture.d.ts} +3 -3
- package/dist/telemetry/capture.d.ts.map +1 -0
- package/dist/telemetry/{captura.js → capture.js} +54 -54
- package/dist/telemetry/capture.js.map +1 -0
- package/dist/telemetry/index.d.ts +2 -2
- package/dist/telemetry/index.js +1 -1
- package/dist/telemetry/{tipos.d.ts → types.d.ts} +2 -2
- package/dist/telemetry/types.d.ts.map +1 -0
- package/dist/telemetry/types.js +2 -0
- package/dist/telemetry/types.js.map +1 -0
- package/dist/telemetry/with-telemetry.d.ts +9 -9
- package/dist/telemetry/with-telemetry.d.ts.map +1 -1
- package/dist/telemetry/with-telemetry.js +31 -31
- package/dist/telemetry/with-telemetry.js.map +1 -1
- package/dist/telemetry/with-tool.d.ts +2 -2
- package/dist/telemetry/with-tool.d.ts.map +1 -1
- package/dist/telemetry/with-tool.js +3 -3
- package/dist/telemetry/with-tool.js.map +1 -1
- package/docs/platform/guide.md +661 -0
- package/docs/telemetry/que-se-manda.md +2 -2
- package/docs/telemetry/troubleshooting.md +1 -1
- package/package.json +15 -5
- package/src/core/config.ts +81 -83
- package/src/core/{constantes.ts → constants.ts} +2 -2
- package/src/core/counters.ts +72 -0
- package/src/core/envelope.ts +234 -0
- package/src/core/scrubbing.ts +41 -41
- package/src/core/{sesion.ts → session.ts} +1 -1
- package/src/core/{transporte.ts → transport.ts} +20 -20
- package/src/core/{tipos.ts → types.ts} +3 -3
- package/src/index.ts +1 -1
- package/src/platform/client.ts +32 -0
- package/src/platform/core/errors.ts +348 -0
- package/src/platform/core/oauth.ts +201 -0
- package/src/platform/core/pagination.ts +67 -0
- package/src/platform/core/request.ts +27 -0
- package/src/platform/core/send.ts +225 -0
- package/src/platform/core/sse.ts +68 -0
- package/src/platform/core/stream.ts +314 -0
- package/src/platform/generated/resources.ts +192 -0
- package/src/platform/generated/schemas.ts +84 -0
- package/src/platform/generated/types.ts +5181 -0
- package/src/platform/index.ts +45 -0
- package/src/telemetry/{captura.ts → capture.ts} +57 -57
- package/src/telemetry/index.ts +2 -2
- package/src/telemetry/{tipos.ts → types.ts} +1 -1
- package/src/telemetry/with-telemetry.ts +51 -54
- package/src/telemetry/with-tool.ts +5 -5
- package/dist/core/constantes.d.ts.map +0 -1
- package/dist/core/constantes.js.map +0 -1
- package/dist/core/contadores.d.ts.map +0 -1
- package/dist/core/contadores.js +0 -53
- package/dist/core/contadores.js.map +0 -1
- package/dist/core/sesion.d.ts.map +0 -1
- package/dist/core/sesion.js.map +0 -1
- package/dist/core/sobre.d.ts.map +0 -1
- package/dist/core/sobre.js +0 -200
- package/dist/core/sobre.js.map +0 -1
- package/dist/core/transporte.d.ts.map +0 -1
- package/dist/core/transporte.js.map +0 -1
- package/dist/telemetry/captura.d.ts.map +0 -1
- package/dist/telemetry/captura.js.map +0 -1
- package/dist/telemetry/tipos.d.ts.map +0 -1
- package/dist/telemetry/tipos.js +0 -2
- package/dist/telemetry/tipos.js.map +0 -1
- package/src/core/contadores.ts +0 -71
- package/src/core/sobre.ts +0 -236
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import type { OperationSpec } from "../generated/resources.js";
|
|
2
|
+
import type { components } from "../generated/types.js";
|
|
3
|
+
import {
|
|
4
|
+
apiErrorFromFamily,
|
|
5
|
+
isKnownErrorType,
|
|
6
|
+
isLaburenApiError,
|
|
7
|
+
LaburenAbortError,
|
|
8
|
+
LaburenApiError,
|
|
9
|
+
LaburenConnectionError,
|
|
10
|
+
LaburenTimeoutError,
|
|
11
|
+
statusForErrorType,
|
|
12
|
+
} from "./errors.js";
|
|
13
|
+
import { type PlatformConfig, type RequestOptions, sendWithRetries } from "./send.js";
|
|
14
|
+
import { parseSse } from "./sse.js";
|
|
15
|
+
|
|
16
|
+
/** Un turno en curso: los pedazos a medida que llegan y el resultado cuando termina. */
|
|
17
|
+
export interface AgentStream<Chunk, Meta> {
|
|
18
|
+
/** Cada acceso arranca desde el primer pedazo; leerlo no es obligatorio. */
|
|
19
|
+
readonly chunks: AsyncIterable<Chunk>;
|
|
20
|
+
/** Se resuelve con el `finish`; se rechaza con el mismo error que lanza `chunks`. */
|
|
21
|
+
readonly result: Promise<Meta & { text: string }>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Si pasan tantos ms sin recibir ni un byte (ni `: ping`) se corta; la API manda un ping cada 15 s. */
|
|
25
|
+
const STREAM_IDLE_TIMEOUT_MS = 45_000;
|
|
26
|
+
|
|
27
|
+
type Chunk = components["schemas"]["AgentRunChunk"];
|
|
28
|
+
type Metadata = components["schemas"]["AgentRunMetadata"];
|
|
29
|
+
|
|
30
|
+
// Si el contrato suma un type, este mapa deja de compilar hasta que se lo agregue acá.
|
|
31
|
+
const KNOWN_TYPES: Record<Chunk["type"], true> = {
|
|
32
|
+
start: true,
|
|
33
|
+
"start-step": true,
|
|
34
|
+
"finish-step": true,
|
|
35
|
+
"text-start": true,
|
|
36
|
+
"text-delta": true,
|
|
37
|
+
"text-end": true,
|
|
38
|
+
"reasoning-start": true,
|
|
39
|
+
"reasoning-delta": true,
|
|
40
|
+
"reasoning-end": true,
|
|
41
|
+
"tool-input-available": true,
|
|
42
|
+
"tool-output-available": true,
|
|
43
|
+
"tool-output-error": true,
|
|
44
|
+
"source-url": true,
|
|
45
|
+
"source-document": true,
|
|
46
|
+
file: true,
|
|
47
|
+
"data-error": true,
|
|
48
|
+
error: true,
|
|
49
|
+
finish: true,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
53
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Hace el pedido de una operación de streaming y devuelve `{ chunks, result }` apenas llegan los headers.
|
|
58
|
+
* Un error antes del primer byte lanza acá; después, lo lanzan `chunks` y `result`.
|
|
59
|
+
*/
|
|
60
|
+
export async function openStream(
|
|
61
|
+
config: PlatformConfig,
|
|
62
|
+
spec: OperationSpec,
|
|
63
|
+
pathValues: string[],
|
|
64
|
+
params: Record<string, unknown> | undefined,
|
|
65
|
+
options: RequestOptions | undefined,
|
|
66
|
+
): Promise<AgentStream<Chunk, Metadata>> {
|
|
67
|
+
const { response, controller } = await sendWithRetries(
|
|
68
|
+
config,
|
|
69
|
+
spec,
|
|
70
|
+
pathValues,
|
|
71
|
+
params,
|
|
72
|
+
options,
|
|
73
|
+
async (res, ctrl) => {
|
|
74
|
+
if (!res.body) {
|
|
75
|
+
throw new LaburenApiError({
|
|
76
|
+
status: res.status,
|
|
77
|
+
message: "Successful response without a body for a stream.",
|
|
78
|
+
requestId: res.headers.get("request-id"),
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return { response: res, controller: ctrl };
|
|
82
|
+
},
|
|
83
|
+
);
|
|
84
|
+
return new ReadStream(response, controller, options?.signal);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Lee el body una sola vez, guarda lo leído y despierta a quien esté esperando.
|
|
89
|
+
*
|
|
90
|
+
* El listener de la señal del llamador se engancha al recibir los headers y se saca cuando el stream
|
|
91
|
+
* termina. Quien no lee ni `chunks` ni `result` no suelta la conexión hasta que aborte su señal; leer
|
|
92
|
+
* cualquiera de los dos la suelta al terminar el turno. Sin señal no hay listener ni forma de abortar:
|
|
93
|
+
* la conexión queda abierta hasta que se lee `chunks` o `result` (o el servidor la cierra).
|
|
94
|
+
*/
|
|
95
|
+
class ReadStream implements AgentStream<Chunk, Metadata> {
|
|
96
|
+
private readonly received: Chunk[] = [];
|
|
97
|
+
private state: "idle" | "reading" | "done" | "failed" = "idle";
|
|
98
|
+
private failure: unknown;
|
|
99
|
+
private readonly waiters = new Set<() => void>();
|
|
100
|
+
private readonly resultPromise: Promise<Metadata & { text: string }>;
|
|
101
|
+
/** Corta la conexión; `pump` lo reemplaza por uno que también cancela su reader. */
|
|
102
|
+
private cutNow: (reason?: unknown) => void = (reason) => {
|
|
103
|
+
this.response.body?.cancel(reason).catch(() => {});
|
|
104
|
+
this.controller.abort(reason);
|
|
105
|
+
};
|
|
106
|
+
private readonly onCallerAbort = () => this.cutNow(this.callerSignal?.reason);
|
|
107
|
+
private resolveResult!: (value: Metadata & { text: string }) => void;
|
|
108
|
+
private rejectResult!: (error: unknown) => void;
|
|
109
|
+
|
|
110
|
+
constructor(
|
|
111
|
+
private readonly response: Response,
|
|
112
|
+
private readonly controller: AbortController,
|
|
113
|
+
private readonly callerSignal: AbortSignal | undefined,
|
|
114
|
+
) {
|
|
115
|
+
this.resultPromise = new Promise((resolve, reject) => {
|
|
116
|
+
this.resolveResult = resolve;
|
|
117
|
+
this.rejectResult = reject;
|
|
118
|
+
});
|
|
119
|
+
// Si nadie espera `result` y el stream falla, no tiene que salir un "unhandled rejection".
|
|
120
|
+
this.resultPromise.catch(() => {});
|
|
121
|
+
// El abort del llamador tiene que cortar la conexión aunque nadie haya leído todavía.
|
|
122
|
+
if (this.callerSignal?.aborted) this.onCallerAbort();
|
|
123
|
+
else this.callerSignal?.addEventListener("abort", this.onCallerAbort, { once: true });
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
get chunks(): AsyncIterable<Chunk> {
|
|
127
|
+
this.start();
|
|
128
|
+
return { [Symbol.asyncIterator]: () => this.iterate() };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
get result(): Promise<Metadata & { text: string }> {
|
|
132
|
+
this.start();
|
|
133
|
+
return this.resultPromise;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private async *iterate(): AsyncGenerator<Chunk> {
|
|
137
|
+
for (let index = 0; ; ) {
|
|
138
|
+
if (index < this.received.length) {
|
|
139
|
+
yield this.received[index++] as Chunk;
|
|
140
|
+
} else if (this.state === "failed") {
|
|
141
|
+
throw this.failure;
|
|
142
|
+
} else if (this.state === "done") {
|
|
143
|
+
return;
|
|
144
|
+
} else {
|
|
145
|
+
await new Promise<void>((resolve) => this.waiters.add(resolve));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private wake(): void {
|
|
151
|
+
const waiting = [...this.waiters];
|
|
152
|
+
this.waiters.clear();
|
|
153
|
+
for (const resolve of waiting) resolve();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
private start(): void {
|
|
157
|
+
if (this.state !== "idle") return;
|
|
158
|
+
this.state = "reading";
|
|
159
|
+
this.pump().then(
|
|
160
|
+
(metadata) => {
|
|
161
|
+
this.state = "done";
|
|
162
|
+
this.resolveResult(metadata);
|
|
163
|
+
this.wake();
|
|
164
|
+
},
|
|
165
|
+
(error) => {
|
|
166
|
+
this.state = "failed";
|
|
167
|
+
this.failure = error;
|
|
168
|
+
this.rejectResult(error);
|
|
169
|
+
this.wake();
|
|
170
|
+
},
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Lee todo el body. Devuelve la metadata del `finish` con el texto; lanza el error tipado si falla. */
|
|
175
|
+
private async pump(): Promise<Metadata & { text: string }> {
|
|
176
|
+
const requestId = this.response.headers.get("request-id");
|
|
177
|
+
const reader = (this.response.body as ReadableStream<Uint8Array>).getReader();
|
|
178
|
+
let idleTimer: ReturnType<typeof setTimeout> | undefined;
|
|
179
|
+
let idleTimedOut = false;
|
|
180
|
+
|
|
181
|
+
// Cortar = cancelar el reader (la lectura pendiente termina) y abortar el fetch (cierra la conexión).
|
|
182
|
+
const cut = (reason?: unknown) => {
|
|
183
|
+
reader.cancel(reason).catch(() => {});
|
|
184
|
+
this.controller.abort(reason);
|
|
185
|
+
};
|
|
186
|
+
const armIdle = () => {
|
|
187
|
+
clearTimeout(idleTimer);
|
|
188
|
+
idleTimer = setTimeout(() => {
|
|
189
|
+
idleTimedOut = true;
|
|
190
|
+
cut();
|
|
191
|
+
}, STREAM_IDLE_TIMEOUT_MS);
|
|
192
|
+
};
|
|
193
|
+
this.cutNow = cut;
|
|
194
|
+
|
|
195
|
+
// highWaterMark 0: no lee por adelantado, así cada byte re-arma el corte justo cuando se consume.
|
|
196
|
+
const body = new ReadableStream<Uint8Array>(
|
|
197
|
+
{
|
|
198
|
+
async pull(streamController) {
|
|
199
|
+
const { done, value } = await reader.read();
|
|
200
|
+
if (done) streamController.close();
|
|
201
|
+
else streamController.enqueue(value);
|
|
202
|
+
},
|
|
203
|
+
cancel: (reason) => reader.cancel(reason),
|
|
204
|
+
},
|
|
205
|
+
{ highWaterMark: 0 },
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
let thread: string | null = null;
|
|
209
|
+
let text = "";
|
|
210
|
+
let dataError: { type?: string; code?: string; retryable?: boolean } | null = null;
|
|
211
|
+
let finished: { metadata: Metadata } | null = null;
|
|
212
|
+
|
|
213
|
+
try {
|
|
214
|
+
if (this.callerSignal?.aborted) cut(this.callerSignal.reason);
|
|
215
|
+
armIdle();
|
|
216
|
+
for await (const data of parseSse(body, armIdle)) {
|
|
217
|
+
let parsed: unknown;
|
|
218
|
+
try {
|
|
219
|
+
parsed = JSON.parse(data);
|
|
220
|
+
} catch {
|
|
221
|
+
throw new LaburenApiError({
|
|
222
|
+
status: 500,
|
|
223
|
+
message: "A stream chunk is not valid JSON.",
|
|
224
|
+
requestId,
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
if (!isRecord(parsed) || typeof parsed.type !== "string") continue;
|
|
228
|
+
if (!Object.hasOwn(KNOWN_TYPES, parsed.type)) continue;
|
|
229
|
+
const chunk = parsed as Chunk;
|
|
230
|
+
|
|
231
|
+
if (chunk.type === "data-error") {
|
|
232
|
+
dataError = chunk.data;
|
|
233
|
+
} else if (chunk.type === "error") {
|
|
234
|
+
throw apiErrorFromFamily({
|
|
235
|
+
status: statusForErrorType(dataError?.type),
|
|
236
|
+
message: chunk.errorText,
|
|
237
|
+
type: dataError?.type,
|
|
238
|
+
code: dataError?.code,
|
|
239
|
+
shouldRetry: retryableOf(dataError),
|
|
240
|
+
requestId,
|
|
241
|
+
});
|
|
242
|
+
} else {
|
|
243
|
+
if (chunk.type === "start") thread = chunk.messageMetadata?.memory.thread ?? null;
|
|
244
|
+
if (chunk.type === "text-delta") text += chunk.delta;
|
|
245
|
+
this.received.push(chunk);
|
|
246
|
+
this.wake();
|
|
247
|
+
if (chunk.type === "finish") {
|
|
248
|
+
// El server siempre manda la metadata: que falte es un bug suyo, igual que un JSON roto.
|
|
249
|
+
if (!chunk.messageMetadata) {
|
|
250
|
+
throw new LaburenApiError({
|
|
251
|
+
status: 500,
|
|
252
|
+
message: "The stream finish arrived without metadata (messageMetadata).",
|
|
253
|
+
requestId,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
finished = { metadata: chunk.messageMetadata };
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
} catch (error) {
|
|
262
|
+
if (isLaburenApiError(error)) throw error;
|
|
263
|
+
throw this.cutError(error, idleTimedOut, thread);
|
|
264
|
+
} finally {
|
|
265
|
+
clearTimeout(idleTimer);
|
|
266
|
+
this.callerSignal?.removeEventListener("abort", this.onCallerAbort);
|
|
267
|
+
reader.cancel().catch(() => {});
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (finished) return { ...finished.metadata, text };
|
|
271
|
+
// Si el llamador abortó o saltó el idle timeout, ese motivo gana sobre el error de la familia.
|
|
272
|
+
if (dataError && !this.callerSignal?.aborted && !idleTimedOut) {
|
|
273
|
+
// El `error` que sigue al `data-error` no llegó: no hay `errorText`, pero el code sí.
|
|
274
|
+
throw apiErrorFromFamily({
|
|
275
|
+
status: statusForErrorType(dataError.type),
|
|
276
|
+
message: `The stream was cut after an error with code ${dataError.code ?? "unknown"}.`,
|
|
277
|
+
type: dataError.type,
|
|
278
|
+
code: dataError.code,
|
|
279
|
+
shouldRetry: retryableOf(dataError),
|
|
280
|
+
requestId,
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
throw this.cutError(undefined, idleTimedOut, thread);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** El error de un stream que terminó sin `finish`: el del llamador, el de los 45 s sin bytes o un corte. */
|
|
287
|
+
private cutError(cause: unknown, idleTimedOut: boolean, thread: string | null): Error {
|
|
288
|
+
if (this.callerSignal?.aborted) {
|
|
289
|
+
return new LaburenAbortError({ cause: this.callerSignal.reason });
|
|
290
|
+
}
|
|
291
|
+
if (idleTimedOut) {
|
|
292
|
+
return new LaburenTimeoutError(
|
|
293
|
+
`The stream received no data for ${STREAM_IDLE_TIMEOUT_MS} ms${threadHint(thread)}.`,
|
|
294
|
+
{ cause },
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
return new LaburenConnectionError(
|
|
298
|
+
`The stream was cut before the turn finished${threadHint(thread)}.`,
|
|
299
|
+
{ cause },
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/** `retryable` del data-error, solo si la familia es conocida: de un type desconocido no se asume nada. */
|
|
305
|
+
function retryableOf(
|
|
306
|
+
dataError: { type?: string; retryable?: boolean } | null,
|
|
307
|
+
): boolean | undefined {
|
|
308
|
+
return dataError !== null && isKnownErrorType(dataError.type) ? dataError.retryable : undefined;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** Dice a qué conversación volver: el turno puede seguir corriendo en el servidor. */
|
|
312
|
+
function threadHint(thread: string | null): string {
|
|
313
|
+
return thread ? ` (thread ${thread}; the turn may still be running on the server)` : "";
|
|
314
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
// GENERADO por scripts/generate-resources.mjs a partir de contract/openapi.json. No editar a mano.
|
|
2
|
+
import type { PagePromise } from "../core/pagination.js";
|
|
3
|
+
import type { RequestOptions } from "../core/request.js";
|
|
4
|
+
import type { AgentStream } from "../core/stream.js";
|
|
5
|
+
import type { components, operations } from "./types.js";
|
|
6
|
+
import type { AgentCreateParams, AgentGenerateParams, AgentListParams, AgentStreamParams, AgentUpdateParams, AgentVersionCompareParams, AgentVersionCreateParams, AgentVersionListParams, AgentVersionRestoreParams, KnowledgeProjectListParams, McpConnectionCreateParams, McpConnectionListParams, McpConnectionToolListParams, McpConnectionUpdateParams, McpConnectionVersionCompareParams, McpConnectionVersionCreateParams, McpConnectionVersionListParams, McpConnectionVersionRestoreParams, MeOrganizationListParams, ModelListParams, SkillCreateParams, SkillListParams, SkillVersionCompareParams, SkillVersionCreateParams, SkillVersionListParams, SkillVersionRestoreParams, TokenCreateParams, TokenListParams, TokenUpdateParams } from "./schemas.js";
|
|
7
|
+
|
|
8
|
+
type Ok<K extends keyof operations> = operations[K]["responses"] extends {
|
|
9
|
+
200: { content: { "application/json": infer R } };
|
|
10
|
+
}
|
|
11
|
+
? R
|
|
12
|
+
: never;
|
|
13
|
+
type Item<K extends keyof operations> = Ok<K> extends { data: Array<infer I> } ? I : never;
|
|
14
|
+
|
|
15
|
+
/** Descripción de una operación del contrato. */
|
|
16
|
+
export interface OperationSpec {
|
|
17
|
+
id: string;
|
|
18
|
+
method: "GET" | "POST" | "PATCH" | "DELETE";
|
|
19
|
+
path: string;
|
|
20
|
+
pathParams: readonly string[];
|
|
21
|
+
/** Tiene body o query: después de los ids va `params`; si no, va `options`. */
|
|
22
|
+
hasParams: boolean;
|
|
23
|
+
idempotent: boolean;
|
|
24
|
+
paginated: boolean;
|
|
25
|
+
/** El 200 es un stream de chunks (text/event-stream con x-laburen-item-schema). */
|
|
26
|
+
stream?: "ui-message";
|
|
27
|
+
/** Timeout de la operación en ms (x-laburen-timeout-ms); le gana al del cliente. */
|
|
28
|
+
timeoutMs?: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Hace el pedido de una operación; la implementa el núcleo de la puerta. */
|
|
32
|
+
export type Call = (
|
|
33
|
+
spec: OperationSpec,
|
|
34
|
+
pathValues: string[],
|
|
35
|
+
params: Record<string, unknown> | undefined,
|
|
36
|
+
options: RequestOptions | undefined,
|
|
37
|
+
) => unknown;
|
|
38
|
+
|
|
39
|
+
/** Una operación por cada ruta del contrato, salvo oauth.* y meta.openapi. */
|
|
40
|
+
export const OPERATIONS: readonly OperationSpec[] = [
|
|
41
|
+
{"id":"agents.create","method":"POST","path":"/agents","pathParams":[],"idempotent":true,"paginated":false,"hasParams":true},
|
|
42
|
+
{"id":"agents.delete","method":"DELETE","path":"/agents/{agent_id}","pathParams":["agent_id"],"idempotent":true,"paginated":false,"hasParams":false},
|
|
43
|
+
{"id":"agents.generate","method":"POST","path":"/agents/{agent_id}/generate","pathParams":["agent_id"],"idempotent":true,"paginated":false,"hasParams":true,"timeoutMs":630000},
|
|
44
|
+
{"id":"agents.get","method":"GET","path":"/agents/{agent_id}","pathParams":["agent_id"],"idempotent":false,"paginated":false,"hasParams":false},
|
|
45
|
+
{"id":"agents.list","method":"GET","path":"/agents","pathParams":[],"idempotent":false,"paginated":true,"hasParams":true},
|
|
46
|
+
{"id":"agents.stream","method":"POST","path":"/agents/{agent_id}/stream","pathParams":["agent_id"],"idempotent":true,"paginated":false,"hasParams":true,"stream":"ui-message","timeoutMs":630000},
|
|
47
|
+
{"id":"agents.update","method":"PATCH","path":"/agents/{agent_id}","pathParams":["agent_id"],"idempotent":true,"paginated":false,"hasParams":true},
|
|
48
|
+
{"id":"agents.versions.activate","method":"POST","path":"/agents/{agent_id}/versions/{version_id}/activate","pathParams":["agent_id","version_id"],"idempotent":true,"paginated":false,"hasParams":false},
|
|
49
|
+
{"id":"agents.versions.compare","method":"GET","path":"/agents/{agent_id}/versions/compare","pathParams":["agent_id"],"idempotent":false,"paginated":false,"hasParams":true},
|
|
50
|
+
{"id":"agents.versions.create","method":"POST","path":"/agents/{agent_id}/versions","pathParams":["agent_id"],"idempotent":true,"paginated":false,"hasParams":true},
|
|
51
|
+
{"id":"agents.versions.delete","method":"DELETE","path":"/agents/{agent_id}/versions/{version_id}","pathParams":["agent_id","version_id"],"idempotent":true,"paginated":false,"hasParams":false},
|
|
52
|
+
{"id":"agents.versions.get","method":"GET","path":"/agents/{agent_id}/versions/{version_id}","pathParams":["agent_id","version_id"],"idempotent":false,"paginated":false,"hasParams":false},
|
|
53
|
+
{"id":"agents.versions.list","method":"GET","path":"/agents/{agent_id}/versions","pathParams":["agent_id"],"idempotent":false,"paginated":true,"hasParams":true},
|
|
54
|
+
{"id":"agents.versions.restore","method":"POST","path":"/agents/{agent_id}/versions/{version_id}/restore","pathParams":["agent_id","version_id"],"idempotent":true,"paginated":false,"hasParams":true},
|
|
55
|
+
{"id":"knowledge.projects.list","method":"GET","path":"/knowledge-projects","pathParams":[],"idempotent":false,"paginated":true,"hasParams":true},
|
|
56
|
+
{"id":"mcp.connections.create","method":"POST","path":"/mcp-connections","pathParams":[],"idempotent":true,"paginated":false,"hasParams":true},
|
|
57
|
+
{"id":"mcp.connections.delete","method":"DELETE","path":"/mcp-connections/{connection_id}","pathParams":["connection_id"],"idempotent":true,"paginated":false,"hasParams":false},
|
|
58
|
+
{"id":"mcp.connections.get","method":"GET","path":"/mcp-connections/{connection_id}","pathParams":["connection_id"],"idempotent":false,"paginated":false,"hasParams":false},
|
|
59
|
+
{"id":"mcp.connections.list","method":"GET","path":"/mcp-connections","pathParams":[],"idempotent":false,"paginated":true,"hasParams":true},
|
|
60
|
+
{"id":"mcp.connections.tools.list","method":"GET","path":"/mcp-connections/{connection_id}/tools","pathParams":["connection_id"],"idempotent":false,"paginated":true,"hasParams":true},
|
|
61
|
+
{"id":"mcp.connections.update","method":"PATCH","path":"/mcp-connections/{connection_id}","pathParams":["connection_id"],"idempotent":true,"paginated":false,"hasParams":true},
|
|
62
|
+
{"id":"mcp.connections.versions.activate","method":"POST","path":"/mcp-connections/{connection_id}/versions/{version_id}/activate","pathParams":["connection_id","version_id"],"idempotent":true,"paginated":false,"hasParams":false},
|
|
63
|
+
{"id":"mcp.connections.versions.compare","method":"GET","path":"/mcp-connections/{connection_id}/versions/compare","pathParams":["connection_id"],"idempotent":false,"paginated":false,"hasParams":true},
|
|
64
|
+
{"id":"mcp.connections.versions.create","method":"POST","path":"/mcp-connections/{connection_id}/versions","pathParams":["connection_id"],"idempotent":true,"paginated":false,"hasParams":true},
|
|
65
|
+
{"id":"mcp.connections.versions.delete","method":"DELETE","path":"/mcp-connections/{connection_id}/versions/{version_id}","pathParams":["connection_id","version_id"],"idempotent":true,"paginated":false,"hasParams":false},
|
|
66
|
+
{"id":"mcp.connections.versions.get","method":"GET","path":"/mcp-connections/{connection_id}/versions/{version_id}","pathParams":["connection_id","version_id"],"idempotent":false,"paginated":false,"hasParams":false},
|
|
67
|
+
{"id":"mcp.connections.versions.list","method":"GET","path":"/mcp-connections/{connection_id}/versions","pathParams":["connection_id"],"idempotent":false,"paginated":true,"hasParams":true},
|
|
68
|
+
{"id":"mcp.connections.versions.restore","method":"POST","path":"/mcp-connections/{connection_id}/versions/{version_id}/restore","pathParams":["connection_id","version_id"],"idempotent":true,"paginated":false,"hasParams":true},
|
|
69
|
+
{"id":"me.get","method":"GET","path":"/me","pathParams":[],"idempotent":false,"paginated":false,"hasParams":false},
|
|
70
|
+
{"id":"me.organizations.list","method":"GET","path":"/me/organizations","pathParams":[],"idempotent":false,"paginated":true,"hasParams":true},
|
|
71
|
+
{"id":"meta.schemas.agentConfig","method":"GET","path":"/schemas/agent-config.json","pathParams":[],"idempotent":false,"paginated":false,"hasParams":false},
|
|
72
|
+
{"id":"models.list","method":"GET","path":"/models","pathParams":[],"idempotent":false,"paginated":true,"hasParams":true},
|
|
73
|
+
{"id":"skills.create","method":"POST","path":"/skills","pathParams":[],"idempotent":true,"paginated":false,"hasParams":true},
|
|
74
|
+
{"id":"skills.delete","method":"DELETE","path":"/skills/{skill_id}","pathParams":["skill_id"],"idempotent":true,"paginated":false,"hasParams":false},
|
|
75
|
+
{"id":"skills.get","method":"GET","path":"/skills/{skill_id}","pathParams":["skill_id"],"idempotent":false,"paginated":false,"hasParams":false},
|
|
76
|
+
{"id":"skills.list","method":"GET","path":"/skills","pathParams":[],"idempotent":false,"paginated":true,"hasParams":true},
|
|
77
|
+
{"id":"skills.versions.activate","method":"POST","path":"/skills/{skill_id}/versions/{version_id}/activate","pathParams":["skill_id","version_id"],"idempotent":true,"paginated":false,"hasParams":false},
|
|
78
|
+
{"id":"skills.versions.compare","method":"GET","path":"/skills/{skill_id}/versions/compare","pathParams":["skill_id"],"idempotent":false,"paginated":false,"hasParams":true},
|
|
79
|
+
{"id":"skills.versions.create","method":"POST","path":"/skills/{skill_id}/versions","pathParams":["skill_id"],"idempotent":true,"paginated":false,"hasParams":true},
|
|
80
|
+
{"id":"skills.versions.delete","method":"DELETE","path":"/skills/{skill_id}/versions/{version_id}","pathParams":["skill_id","version_id"],"idempotent":true,"paginated":false,"hasParams":false},
|
|
81
|
+
{"id":"skills.versions.get","method":"GET","path":"/skills/{skill_id}/versions/{version_id}","pathParams":["skill_id","version_id"],"idempotent":false,"paginated":false,"hasParams":false},
|
|
82
|
+
{"id":"skills.versions.list","method":"GET","path":"/skills/{skill_id}/versions","pathParams":["skill_id"],"idempotent":false,"paginated":true,"hasParams":true},
|
|
83
|
+
{"id":"skills.versions.restore","method":"POST","path":"/skills/{skill_id}/versions/{version_id}/restore","pathParams":["skill_id","version_id"],"idempotent":true,"paginated":false,"hasParams":true},
|
|
84
|
+
{"id":"tokens.create","method":"POST","path":"/tokens","pathParams":[],"idempotent":false,"paginated":false,"hasParams":true},
|
|
85
|
+
{"id":"tokens.list","method":"GET","path":"/tokens","pathParams":[],"idempotent":false,"paginated":true,"hasParams":true},
|
|
86
|
+
{"id":"tokens.revoke","method":"DELETE","path":"/tokens/{token_id}","pathParams":["token_id"],"idempotent":true,"paginated":false,"hasParams":false},
|
|
87
|
+
{"id":"tokens.update","method":"PATCH","path":"/tokens/{token_id}","pathParams":["token_id"],"idempotent":true,"paginated":false,"hasParams":true},
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
/** Métodos de la puerta, anidados por los segmentos del operationId. */
|
|
91
|
+
export interface Resources {
|
|
92
|
+
agents: {
|
|
93
|
+
create(params: AgentCreateParams, options?: RequestOptions): Promise<Ok<"agents.create">>;
|
|
94
|
+
delete(agentId: string, options?: RequestOptions): Promise<Ok<"agents.delete">>;
|
|
95
|
+
generate(agentId: string, params: AgentGenerateParams, options?: RequestOptions): Promise<Ok<"agents.generate">>;
|
|
96
|
+
get(agentId: string, options?: RequestOptions): Promise<Ok<"agents.get">>;
|
|
97
|
+
list(params?: AgentListParams, options?: RequestOptions): PagePromise<Item<"agents.list">>;
|
|
98
|
+
stream(agentId: string, params: AgentStreamParams, options?: RequestOptions): Promise<AgentStream<components["schemas"]["AgentRunChunk"], components["schemas"]["AgentRunMetadata"]>>;
|
|
99
|
+
update(agentId: string, params: AgentUpdateParams, options?: RequestOptions): Promise<Ok<"agents.update">>;
|
|
100
|
+
versions: {
|
|
101
|
+
activate(agentId: string, versionId: string, options?: RequestOptions): Promise<Ok<"agents.versions.activate">>;
|
|
102
|
+
compare(agentId: string, params: AgentVersionCompareParams, options?: RequestOptions): Promise<Ok<"agents.versions.compare">>;
|
|
103
|
+
create(agentId: string, params: AgentVersionCreateParams, options?: RequestOptions): Promise<Ok<"agents.versions.create">>;
|
|
104
|
+
delete(agentId: string, versionId: string, options?: RequestOptions): Promise<Ok<"agents.versions.delete">>;
|
|
105
|
+
get(agentId: string, versionId: string, options?: RequestOptions): Promise<Ok<"agents.versions.get">>;
|
|
106
|
+
list(agentId: string, params?: AgentVersionListParams, options?: RequestOptions): PagePromise<Item<"agents.versions.list">>;
|
|
107
|
+
restore(agentId: string, versionId: string, params?: AgentVersionRestoreParams, options?: RequestOptions): Promise<Ok<"agents.versions.restore">>;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
knowledge: {
|
|
111
|
+
projects: {
|
|
112
|
+
list(params?: KnowledgeProjectListParams, options?: RequestOptions): PagePromise<Item<"knowledge.projects.list">>;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
mcp: {
|
|
116
|
+
connections: {
|
|
117
|
+
create(params: McpConnectionCreateParams, options?: RequestOptions): Promise<Ok<"mcp.connections.create">>;
|
|
118
|
+
delete(connectionId: string, options?: RequestOptions): Promise<Ok<"mcp.connections.delete">>;
|
|
119
|
+
get(connectionId: string, options?: RequestOptions): Promise<Ok<"mcp.connections.get">>;
|
|
120
|
+
list(params?: McpConnectionListParams, options?: RequestOptions): PagePromise<Item<"mcp.connections.list">>;
|
|
121
|
+
tools: {
|
|
122
|
+
list(connectionId: string, params?: McpConnectionToolListParams, options?: RequestOptions): PagePromise<Item<"mcp.connections.tools.list">>;
|
|
123
|
+
};
|
|
124
|
+
update(connectionId: string, params: McpConnectionUpdateParams, options?: RequestOptions): Promise<Ok<"mcp.connections.update">>;
|
|
125
|
+
versions: {
|
|
126
|
+
activate(connectionId: string, versionId: string, options?: RequestOptions): Promise<Ok<"mcp.connections.versions.activate">>;
|
|
127
|
+
compare(connectionId: string, params: McpConnectionVersionCompareParams, options?: RequestOptions): Promise<Ok<"mcp.connections.versions.compare">>;
|
|
128
|
+
create(connectionId: string, params: McpConnectionVersionCreateParams, options?: RequestOptions): Promise<Ok<"mcp.connections.versions.create">>;
|
|
129
|
+
delete(connectionId: string, versionId: string, options?: RequestOptions): Promise<Ok<"mcp.connections.versions.delete">>;
|
|
130
|
+
get(connectionId: string, versionId: string, options?: RequestOptions): Promise<Ok<"mcp.connections.versions.get">>;
|
|
131
|
+
list(connectionId: string, params?: McpConnectionVersionListParams, options?: RequestOptions): PagePromise<Item<"mcp.connections.versions.list">>;
|
|
132
|
+
restore(connectionId: string, versionId: string, params?: McpConnectionVersionRestoreParams, options?: RequestOptions): Promise<Ok<"mcp.connections.versions.restore">>;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
me: {
|
|
137
|
+
get(options?: RequestOptions): Promise<Ok<"me.get">>;
|
|
138
|
+
organizations: {
|
|
139
|
+
list(params?: MeOrganizationListParams, options?: RequestOptions): PagePromise<Item<"me.organizations.list">>;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
meta: {
|
|
143
|
+
schemas: {
|
|
144
|
+
agentConfig(options?: RequestOptions): Promise<Ok<"meta.schemas.agentConfig">>;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
models: {
|
|
148
|
+
list(params?: ModelListParams, options?: RequestOptions): PagePromise<Item<"models.list">>;
|
|
149
|
+
};
|
|
150
|
+
skills: {
|
|
151
|
+
create(params: SkillCreateParams, options?: RequestOptions): Promise<Ok<"skills.create">>;
|
|
152
|
+
delete(skillId: string, options?: RequestOptions): Promise<Ok<"skills.delete">>;
|
|
153
|
+
get(skillId: string, options?: RequestOptions): Promise<Ok<"skills.get">>;
|
|
154
|
+
list(params?: SkillListParams, options?: RequestOptions): PagePromise<Item<"skills.list">>;
|
|
155
|
+
versions: {
|
|
156
|
+
activate(skillId: string, versionId: string, options?: RequestOptions): Promise<Ok<"skills.versions.activate">>;
|
|
157
|
+
compare(skillId: string, params: SkillVersionCompareParams, options?: RequestOptions): Promise<Ok<"skills.versions.compare">>;
|
|
158
|
+
create(skillId: string, params: SkillVersionCreateParams, options?: RequestOptions): Promise<Ok<"skills.versions.create">>;
|
|
159
|
+
delete(skillId: string, versionId: string, options?: RequestOptions): Promise<Ok<"skills.versions.delete">>;
|
|
160
|
+
get(skillId: string, versionId: string, options?: RequestOptions): Promise<Ok<"skills.versions.get">>;
|
|
161
|
+
list(skillId: string, params?: SkillVersionListParams, options?: RequestOptions): PagePromise<Item<"skills.versions.list">>;
|
|
162
|
+
restore(skillId: string, versionId: string, params?: SkillVersionRestoreParams, options?: RequestOptions): Promise<Ok<"skills.versions.restore">>;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
tokens: {
|
|
166
|
+
create(params: TokenCreateParams, options?: RequestOptions): Promise<Ok<"tokens.create">>;
|
|
167
|
+
list(params?: TokenListParams, options?: RequestOptions): PagePromise<Item<"tokens.list">>;
|
|
168
|
+
revoke(tokenId: string, options?: RequestOptions): Promise<Ok<"tokens.revoke">>;
|
|
169
|
+
update(tokenId: string, params: TokenUpdateParams, options?: RequestOptions): Promise<Ok<"tokens.update">>;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** Arma los métodos de `Resources`: ids de la ruta, después params (solo si la operación los tiene), después options. */
|
|
174
|
+
export function buildResources(call: Call): Resources {
|
|
175
|
+
const root: Record<string, unknown> = {};
|
|
176
|
+
for (const spec of OPERATIONS) {
|
|
177
|
+
const segments = spec.id.split(".");
|
|
178
|
+
let node = root;
|
|
179
|
+
for (const segment of segments.slice(0, -1)) {
|
|
180
|
+
node = (node[segment] ??= {}) as Record<string, unknown>;
|
|
181
|
+
}
|
|
182
|
+
const count = spec.pathParams.length;
|
|
183
|
+
node[segments[segments.length - 1] as string] = (...args: unknown[]) =>
|
|
184
|
+
call(
|
|
185
|
+
spec,
|
|
186
|
+
args.slice(0, count) as string[],
|
|
187
|
+
spec.hasParams ? (args[count] as Record<string, unknown> | undefined) : undefined,
|
|
188
|
+
(spec.hasParams ? args[count + 1] : args[count]) as RequestOptions | undefined,
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
return root as unknown as Resources;
|
|
192
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// GENERADO por scripts/generate-resources.mjs a partir de contract/openapi.json. No editar a mano.
|
|
2
|
+
import type { Page } from "../core/pagination.js";
|
|
3
|
+
import type { components, operations } from "./types.js";
|
|
4
|
+
|
|
5
|
+
type JsonBody<O> = O extends { requestBody?: infer R }
|
|
6
|
+
? NonNullable<R> extends { content: { "application/json": infer B } }
|
|
7
|
+
? B
|
|
8
|
+
: never
|
|
9
|
+
: never;
|
|
10
|
+
type JsonOk<O> = O extends { responses: { 200: { content: { "application/json": infer R } } } }
|
|
11
|
+
? R
|
|
12
|
+
: never;
|
|
13
|
+
|
|
14
|
+
export type Agent = components["schemas"]["Agent"];
|
|
15
|
+
export type AgentConfig = components["schemas"]["AgentConfig"];
|
|
16
|
+
export type AgentConfigInput = components["schemas"]["AgentConfigInput"];
|
|
17
|
+
export type AgentRunChunk = components["schemas"]["AgentRunChunk"];
|
|
18
|
+
export type AgentRunMetadata = components["schemas"]["AgentRunMetadata"];
|
|
19
|
+
export type AgentVersion = components["schemas"]["AgentVersion"];
|
|
20
|
+
export type AgentVersionComparison = components["schemas"]["AgentVersionComparison"];
|
|
21
|
+
export type AgentWithVersion = components["schemas"]["AgentWithVersion"];
|
|
22
|
+
export type CreatedToken = components["schemas"]["CreatedToken"];
|
|
23
|
+
export type DeviceAuthorization = components["schemas"]["DeviceAuthorization"];
|
|
24
|
+
export type ApiErrorBody = components["schemas"]["Error"];
|
|
25
|
+
export type KnowledgeProject = components["schemas"]["KnowledgeProject"];
|
|
26
|
+
export type McpConnection = components["schemas"]["McpConnection"];
|
|
27
|
+
export type McpConnectionVersion = components["schemas"]["McpConnectionVersion"];
|
|
28
|
+
export type McpConnectionVersionComparison = components["schemas"]["McpConnectionVersionComparison"];
|
|
29
|
+
export type McpConnectionWithVersion = components["schemas"]["McpConnectionWithVersion"];
|
|
30
|
+
export type McpTool = components["schemas"]["McpTool"];
|
|
31
|
+
export type Model = components["schemas"]["Model"];
|
|
32
|
+
export type OAuthErrorBody = components["schemas"]["OAuthError"];
|
|
33
|
+
export type OAuthToken = components["schemas"]["OAuthToken"];
|
|
34
|
+
export type Organization = components["schemas"]["Organization"];
|
|
35
|
+
export type Skill = components["schemas"]["Skill"];
|
|
36
|
+
export type SkillCreated = components["schemas"]["SkillCreated"];
|
|
37
|
+
export type SkillVersion = components["schemas"]["SkillVersion"];
|
|
38
|
+
export type SkillVersionComparison = components["schemas"]["SkillVersionComparison"];
|
|
39
|
+
export type SkillVersionCreated = components["schemas"]["SkillVersionCreated"];
|
|
40
|
+
export type Token = components["schemas"]["Token"];
|
|
41
|
+
|
|
42
|
+
export type AgentCreateParams = JsonBody<operations["agents.create"]>;
|
|
43
|
+
export type AgentGenerateParams = JsonBody<operations["agents.generate"]>;
|
|
44
|
+
export type AgentListParams = NonNullable<operations["agents.list"]["parameters"]["query"]>;
|
|
45
|
+
export type AgentStreamParams = JsonBody<operations["agents.stream"]>;
|
|
46
|
+
export type AgentUpdateParams = JsonBody<operations["agents.update"]>;
|
|
47
|
+
export type AgentVersionCompareParams = NonNullable<operations["agents.versions.compare"]["parameters"]["query"]>;
|
|
48
|
+
export type AgentVersionCreateParams = JsonBody<operations["agents.versions.create"]>;
|
|
49
|
+
export type AgentVersionListParams = NonNullable<operations["agents.versions.list"]["parameters"]["query"]>;
|
|
50
|
+
export type AgentVersionRestoreParams = JsonBody<operations["agents.versions.restore"]>;
|
|
51
|
+
export type KnowledgeProjectListParams = NonNullable<operations["knowledge.projects.list"]["parameters"]["query"]>;
|
|
52
|
+
export type McpConnectionCreateParams = JsonBody<operations["mcp.connections.create"]>;
|
|
53
|
+
export type McpConnectionListParams = NonNullable<operations["mcp.connections.list"]["parameters"]["query"]>;
|
|
54
|
+
export type McpConnectionToolListParams = NonNullable<operations["mcp.connections.tools.list"]["parameters"]["query"]>;
|
|
55
|
+
export type McpConnectionUpdateParams = JsonBody<operations["mcp.connections.update"]>;
|
|
56
|
+
export type McpConnectionVersionCompareParams = NonNullable<operations["mcp.connections.versions.compare"]["parameters"]["query"]>;
|
|
57
|
+
export type McpConnectionVersionCreateParams = JsonBody<operations["mcp.connections.versions.create"]>;
|
|
58
|
+
export type McpConnectionVersionListParams = NonNullable<operations["mcp.connections.versions.list"]["parameters"]["query"]>;
|
|
59
|
+
export type McpConnectionVersionRestoreParams = JsonBody<operations["mcp.connections.versions.restore"]>;
|
|
60
|
+
export type MeOrganizationListParams = NonNullable<operations["me.organizations.list"]["parameters"]["query"]>;
|
|
61
|
+
export type ModelListParams = NonNullable<operations["models.list"]["parameters"]["query"]>;
|
|
62
|
+
export type SkillCreateParams = JsonBody<operations["skills.create"]>;
|
|
63
|
+
export type SkillListParams = NonNullable<operations["skills.list"]["parameters"]["query"]>;
|
|
64
|
+
export type SkillVersionCompareParams = NonNullable<operations["skills.versions.compare"]["parameters"]["query"]>;
|
|
65
|
+
export type SkillVersionCreateParams = JsonBody<operations["skills.versions.create"]>;
|
|
66
|
+
export type SkillVersionListParams = NonNullable<operations["skills.versions.list"]["parameters"]["query"]>;
|
|
67
|
+
export type SkillVersionRestoreParams = JsonBody<operations["skills.versions.restore"]>;
|
|
68
|
+
export type TokenCreateParams = JsonBody<operations["tokens.create"]>;
|
|
69
|
+
export type TokenListParams = NonNullable<operations["tokens.list"]["parameters"]["query"]>;
|
|
70
|
+
export type TokenUpdateParams = JsonBody<operations["tokens.update"]>;
|
|
71
|
+
|
|
72
|
+
export type AgentsPage = Page<Agent>;
|
|
73
|
+
export type AgentVersionsPage = Page<AgentVersion>;
|
|
74
|
+
export type KnowledgeProjectsPage = Page<KnowledgeProject>;
|
|
75
|
+
export type McpConnectionsPage = Page<McpConnection>;
|
|
76
|
+
export type McpToolsPage = Page<McpTool>;
|
|
77
|
+
export type McpConnectionVersionsPage = Page<McpConnectionVersion>;
|
|
78
|
+
export type OrganizationsPage = Page<Organization>;
|
|
79
|
+
export type ModelsPage = Page<Model>;
|
|
80
|
+
export type SkillsPage = Page<Skill>;
|
|
81
|
+
export type SkillVersionsPage = Page<SkillVersion>;
|
|
82
|
+
export type TokensPage = Page<Token>;
|
|
83
|
+
|
|
84
|
+
export type AgentRun = JsonOk<operations["agents.generate"]>;
|