@agent-os-sdk/client 0.9.4 → 0.9.6

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.
@@ -11,7 +11,8 @@ import type { PaginationParams, PaginatedResponse } from "../client/helpers.js";
11
11
  type WaitRunResponse = components["schemas"]["WaitRunResponse"];
12
12
  type BatchRunResponse = components["schemas"]["BatchRunResponse"];
13
13
  type CancelRunResponse = components["schemas"]["CancelRunResponse"];
14
- type CheckpointListResponse = components["schemas"]["CheckpointListResponse"];
14
+ type CheckpointIndexResponse = components["schemas"]["CheckpointIndexResponse"];
15
+ type RunReplayResponse = components["schemas"]["RunReplayResponse"];
15
16
  export interface Run {
16
17
  run_id: string;
17
18
  status: RunStatus;
@@ -187,25 +188,11 @@ export declare class RunsModule {
187
188
  /**
188
189
  * Replay from checkpoint (stateful).
189
190
  * Creates a NEW run that starts from the specified checkpoint.
190
- *
191
- * @param runId - The original run to replay from
192
- * @param checkpointId - The checkpoint ID to start from
193
- * @param options - Replay options
194
- * @returns New run created from checkpoint
195
- *
196
- * @example
197
- * ```ts
198
- * const checkpoints = await client.runs.getCheckpoints(runId)
199
- * const newRun = await client.runs.replay(runId, checkpoints[2].id, {
200
- * mode: 'best_effort',
201
- * reason: 'Debugging step 3'
202
- * })
203
- * ```
204
191
  */
205
- replay(runId: string, checkpointId?: string, options?: {
192
+ replay(runId: string, checkpointId: string, options?: {
206
193
  mode?: "best_effort" | "strict";
207
194
  reason?: string;
208
- }): Promise<APIResponse<CreateRunResponse>>;
195
+ }): Promise<APIResponse<RunReplayResponse>>;
209
196
  /**
210
197
  * Get canonical run events from SSOT ledger (polling by seq).
211
198
  */
@@ -250,12 +237,11 @@ export declare class RunsModule {
250
237
  /**
251
238
  * Get checkpoints for a run.
252
239
  */
253
- getCheckpoints(runId: string): Promise<APIResponse<CheckpointListResponse>>;
240
+ getCheckpoints(runId: string): Promise<APIResponse<CheckpointIndexResponse>>;
254
241
  /** Alias: runs.checkpoints() -> runs.getCheckpoints() */
255
242
  checkpoints: (runId: string) => Promise<APIResponse<{
256
243
  run_id?: string;
257
- total_checkpoints?: number;
258
- checkpoints?: components["schemas"]["CheckpointNode"][] | null;
244
+ checkpoints?: components["schemas"]["CheckpointIndexItem"][] | null;
259
245
  }>>;
260
246
  /**
261
247
  * Follow a run attempt's canonical event stream with automatic reconnection.
@@ -1 +1 @@
1
- {"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../../src/modules/runs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIhF,KAAK,eAAe,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,iBAAiB,CAAC,CAAC;AAChE,KAAK,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAClE,KAAK,iBAAiB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,mBAAmB,CAAC,CAAC;AACpE,KAAK,sBAAsB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,wBAAwB,CAAC,CAAC;AAG9E,MAAM,WAAW,GAAG;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,C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CAAC;CAwC1B;AAMD,gCAAgC;AAChC,MAAM,WAAW,aAAa;IAC1B,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mCAAmC;IACnC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,8CAA8C;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,qDAAqD;IACrD,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,6CAA6C;IAC7C,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,GAAG,OAAO,KAAK,IAAI,CAAC;CACpD;AAED,qCAAqC;AACrC,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,WAAW,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,CAAC;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACzC,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -165,26 +165,11 @@ export class RunsModule {
165
165
  /**
166
166
  * Replay from checkpoint (stateful).
167
167
  * Creates a NEW run that starts from the specified checkpoint.
168
- *
169
- * @param runId - The original run to replay from
170
- * @param checkpointId - The checkpoint ID to start from
171
- * @param options - Replay options
172
- * @returns New run created from checkpoint
173
- *
174
- * @example
175
- * ```ts
176
- * const checkpoints = await client.runs.getCheckpoints(runId)
177
- * const newRun = await client.runs.replay(runId, checkpoints[2].id, {
178
- * mode: 'best_effort',
179
- * reason: 'Debugging step 3'
180
- * })
181
- * ```
182
168
  */
183
169
  async replay(runId, checkpointId, options) {
184
- return this.client.POST("/v1/api/runs/{runId}/replay", {
185
- params: { path: { runId } },
170
+ return this.client.POST("/v1/api/runs/{runId}/checkpoints/{checkpointId}/replay", {
171
+ params: { path: { runId, checkpointId } },
186
172
  body: {
187
- checkpoint_id: checkpointId,
188
173
  mode: options?.mode,
189
174
  reason: options?.reason
190
175
  },
@@ -247,7 +232,7 @@ export class RunsModule {
247
232
  * Get checkpoints for a run.
248
233
  */
249
234
  async getCheckpoints(runId) {
250
- return this.client.GET("/v1/api/runs/{runId}/checkpoints", {
235
+ return this.client.GET("/v1/api/runs/{runId}/checkpoints/index", {
251
236
  params: { path: { runId } },
252
237
  });
253
238
  }
@@ -45,6 +45,11 @@ export interface SpanListResponse {
45
45
  export interface TraceDetail extends Trace {
46
46
  spans: Span[];
47
47
  }
48
+ export interface SpansByRunResponse {
49
+ run_id: string;
50
+ spans: Span[];
51
+ count: number;
52
+ }
48
53
  export declare class TracesModule {
49
54
  private client;
50
55
  private headers;
@@ -67,6 +72,11 @@ export declare class TracesModule {
67
72
  * Get spans for a trace.
68
73
  */
69
74
  getSpans(traceId: string): Promise<APIResponse<SpanListResponse>>;
75
+ /**
76
+ * Get all spans associated with a run.
77
+ * Maps to: GET /v1/api/traces/by-run/{runId}
78
+ */
79
+ getByRun(runId: string): Promise<APIResponse<SpansByRunResponse>>;
70
80
  /**
71
81
  * Ingest spans (batch).
72
82
  */
@@ -1 +1 @@
1
- {"version":3,"file":"traces.d.ts","sourceRoot":"","sources":["../../src/modules/traces.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE3E,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;AAIzD,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAA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AAO,CAAC,MAAM;IAAa,OAAO,CAAC,OAAO;gBAAlC,MAAM,EAAE,SAAS,EAAU,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAEpF;;OAEG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAO3C;;OAEG;IACG,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAO7D;;OAEG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAOvE;;;OAGG;IACG,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAMvE;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAO3D;;OAEG;IACG,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;CAM3E"}
@@ -35,6 +35,15 @@ export class TracesModule {
35
35
  headers: this.headers(),
36
36
  });
37
37
  }
38
+ /**
39
+ * Get all spans associated with a run.
40
+ * Maps to: GET /v1/api/traces/by-run/{runId}
41
+ */
42
+ async getByRun(runId) {
43
+ return this.client.GET(`/v1/api/traces/by-run/${runId}`, {
44
+ headers: this.headers(),
45
+ });
46
+ }
38
47
  /**
39
48
  * Ingest spans (batch).
40
49
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-os-sdk/client",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "description": "Official TypeScript SDK for Agent OS platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -50,4 +50,4 @@
50
50
  "dist",
51
51
  "src"
52
52
  ]
53
- }
53
+ }
@@ -58,7 +58,6 @@ import { AuthModule } from "../modules/auth.js";
58
58
  import { CatalogModule } from "../modules/catalog.js";
59
59
  import { CheckpointsModule } from "../modules/checkpoints.js";
60
60
  import { CronsModule } from "../modules/crons.js";
61
- import { DlqModule } from "../modules/dlq.js";
62
61
  import { EvaluationModule } from "../modules/evaluation.js";
63
62
  import { FilesModule } from "../modules/files.js";
64
63
  import { GraphsModule } from "../modules/graphs.js";
@@ -107,7 +106,6 @@ export class AgentOsClient {
107
106
  readonly checkpoints: CheckpointsModule;
108
107
  readonly playground: PlaygroundModule;
109
108
  readonly crons: CronsModule;
110
- readonly dlq: DlqModule;
111
109
  readonly store: StoreModule;
112
110
  readonly audit: AuditModule;
113
111
  readonly usage: UsageModule;
@@ -145,6 +143,8 @@ export class AgentOsClient {
145
143
  this._client = createRawClient({
146
144
  baseUrl: options.baseUrl,
147
145
  headerProvider: () => this._resolveHeaders(),
146
+ network: options.network,
147
+ hooks: options.hooks,
148
148
  });
149
149
 
150
150
  // Module header getter (sync fallback for backwards compat with module internals)
@@ -175,7 +175,6 @@ export class AgentOsClient {
175
175
  this.checkpoints = new CheckpointsModule(this._client, getHeaders);
176
176
  this.playground = new PlaygroundModule(this._client, getHeaders);
177
177
  this.crons = new CronsModule(this._client, getHeaders);
178
- this.dlq = new DlqModule(this._client, getHeaders);
179
178
  this.store = new StoreModule(this._client, getHeaders);
180
179
  this.audit = new AuditModule(this._client, getHeaders);
181
180
  this.usage = new UsageModule(this._client, getHeaders);
@@ -6,6 +6,9 @@
6
6
  * - API Token (server): Uses aosk_* token with embedded claims
7
7
  */
8
8
 
9
+ import type { NetworkConfig } from "./config.js";
10
+ import type { SDKHooks } from "./raw.js";
11
+
9
12
  // ============================================================================
10
13
  // Auth Provider Types
11
14
  // ============================================================================
@@ -82,6 +85,10 @@ export type AgentOsClientOptions = {
82
85
  * Only set to true if you understand the security implications.
83
86
  */
84
87
  allowApiTokenInBrowser?: boolean
88
+ /** Network policy (timeouts/retries). */
89
+ network?: Partial<NetworkConfig>
90
+ /** Optional request lifecycle hooks for observability */
91
+ hooks?: SDKHooks
85
92
  /** Custom headers to add to all requests */
86
93
  headers?: Record<string, string>
87
94
  }
package/src/client/raw.ts CHANGED
@@ -7,8 +7,13 @@
7
7
 
8
8
  import createClient, { type Client } from "openapi-fetch";
9
9
  import type { components, paths } from "../generated/openapi.js";
10
+ import { createErrorFromResponse } from "../errors/factory.js";
11
+ import { AgentOsError, NetworkError, TimeoutError } from "../errors/index.js";
10
12
  import { httpRequestBuilder } from "./HttpRequestBuilder.js";
11
13
  import type { OperationContext } from "./OperationContext.js";
14
+ import { mergeNetworkConfig, type NetworkConfig } from "./config.js";
15
+ import { withRetry } from "./retry.js";
16
+ import { withTimeout } from "./timeout.js";
12
17
 
13
18
  // Re-export types for external use
14
19
  export type { components, paths };
@@ -17,6 +22,8 @@ export type ClientOptions = {
17
22
  baseUrl: string;
18
23
  headers?: Record<string, string>;
19
24
  headerProvider?: () => Promise<Record<string, string>>;
25
+ /** Network behavior (timeouts/retries). Defaults to DEFAULT_NETWORK_CONFIG. */
26
+ network?: Partial<NetworkConfig>;
20
27
  /** Hooks for observability (OTEL, Sentry, etc.) */
21
28
  hooks?: SDKHooks;
22
29
  };
@@ -100,6 +107,12 @@ export function createTypedClient(options: ClientOptions): TypedClient {
100
107
  */
101
108
  export function createRawClient(options: ClientOptions) {
102
109
  const { baseUrl, headers: defaultHeaders = {}, headerProvider } = options;
110
+ const networkConfig = mergeNetworkConfig(options.network);
111
+ type ErrorPayload = { code?: string; message?: string; details?: unknown } & Record<string, unknown>;
112
+ type HttpAgentOsError = AgentOsError & {
113
+ response?: Response;
114
+ payload?: ErrorPayload;
115
+ };
103
116
 
104
117
  async function request<T>(
105
118
  method: string,
@@ -195,63 +208,115 @@ export function createRawClient(options: ClientOptions) {
195
208
 
196
209
  let response: Response;
197
210
  try {
198
- response = await doFetch(opts?.signal);
199
- } catch (fetchError) {
200
- const durationMs = Date.now() - startTime;
201
- // Call onError hook
202
- await options.hooks?.onError?.({
203
- method,
204
- url: fullUrl,
205
- error: fetchError instanceof Error ? fetchError : new Error(String(fetchError)),
206
- durationMs,
207
- requestId: clientRequestId,
208
- });
209
-
210
- // Network error - return as error
211
- return {
212
- error: {
213
- code: "NETWORK_ERROR",
214
- message: fetchError instanceof Error ? fetchError.message : "Network request failed"
215
- },
216
- response: new Response(null, { status: 503, statusText: "Network Error" })
217
- };
218
- }
211
+ const hasIdempotencyKey = Boolean(
212
+ opts?.idempotencyKey ||
213
+ headers["X-Idempotency-Key"] ||
214
+ headers["Idempotency-Key"]
215
+ );
216
+
217
+ const executeAttempt = async (signal?: AbortSignal): Promise<Response> => {
218
+ const attemptResponse = await withTimeout(async (timeoutSignal) => {
219
+ try {
220
+ return await doFetch(timeoutSignal);
221
+ } catch (fetchError) {
222
+ // Preserve AbortError semantics for caller-provided cancellation.
223
+ if (fetchError instanceof Error && fetchError.name === "AbortError") {
224
+ throw fetchError;
225
+ }
226
+
227
+ throw new NetworkError(
228
+ fetchError instanceof Error ? fetchError.message : "Network request failed",
229
+ fetchError instanceof Error ? fetchError : undefined
230
+ );
231
+ }
232
+ }, opts?.timeoutMs ?? networkConfig.timeoutMs, signal);
233
+
234
+ if (!attemptResponse.ok) {
235
+ let errorBody: ErrorPayload | undefined;
236
+ try {
237
+ errorBody = await attemptResponse.json() as ErrorPayload;
238
+ } catch {
239
+ // Ignore JSON parse errors and fallback to status text.
240
+ }
219
241
 
220
- const durationMs = Date.now() - startTime;
242
+ const typedError = createErrorFromResponse(attemptResponse, errorBody, path) as HttpAgentOsError;
243
+ typedError.response = attemptResponse;
244
+ typedError.payload = errorBody;
245
+ throw typedError;
246
+ }
221
247
 
222
- // Extract requestId for tracing (prefer server requestId if available)
223
- const requestId = response.headers.get("x-request-id") ?? clientRequestId;
248
+ return attemptResponse;
249
+ };
224
250
 
225
- if (!response.ok) {
226
- let errorBody: { code?: string; message?: string; details?: unknown } | undefined;
227
- try {
228
- errorBody = await response.json();
229
- } catch {
230
- // Ignore JSON parse errors
251
+ if (opts?.retry === false) {
252
+ response = await executeAttempt(opts?.signal);
253
+ } else {
254
+ response = await withRetry(
255
+ (signal) => executeAttempt(signal),
256
+ networkConfig.retry,
257
+ { method, hasIdempotencyKey },
258
+ opts?.signal
259
+ );
231
260
  }
261
+ } catch (requestError) {
262
+ const durationMs = Date.now() - startTime;
263
+ const error = requestError instanceof Error ? requestError : new Error(String(requestError));
264
+ const typedError = requestError instanceof AgentOsError ? requestError as HttpAgentOsError : undefined;
265
+ const errorResponse = typedError?.response;
266
+ const requestId = errorResponse?.headers.get("x-request-id")
267
+ ?? typedError?.requestId
268
+ ?? clientRequestId;
232
269
 
233
270
  // Call onError hook
234
271
  await options.hooks?.onError?.({
235
272
  method,
236
273
  url: fullUrl,
237
- error: new Error(errorBody?.message || response.statusText),
274
+ error,
238
275
  durationMs,
239
276
  requestId,
240
277
  });
241
278
 
279
+ if (typedError && errorResponse) {
280
+ return {
281
+ error: {
282
+ code: typedError.backendCode || typedError.code,
283
+ message: typedError.message,
284
+ details: typedError.details,
285
+ // Include full payload for validation hints and backend-specific fields.
286
+ ...typedError.payload,
287
+ },
288
+ response: errorResponse,
289
+ meta: { requestId },
290
+ };
291
+ }
292
+
293
+ if (error instanceof TimeoutError) {
294
+ return {
295
+ error: {
296
+ code: error.code,
297
+ message: error.message,
298
+ },
299
+ response: new Response(null, { status: 408, statusText: "Request Timeout" }),
300
+ meta: { requestId },
301
+ };
302
+ }
303
+
304
+ // Network/abort/unexpected errors - return as standardized transport error.
242
305
  return {
243
306
  error: {
244
- code: errorBody?.code || `HTTP_${response.status}`,
245
- message: errorBody?.message || response.statusText,
246
- details: errorBody?.details,
247
- // Include full error body for 422 responses with hints
248
- ...errorBody,
307
+ code: "NETWORK_ERROR",
308
+ message: error.message || "Network request failed"
249
309
  },
250
- response,
310
+ response: new Response(null, { status: 503, statusText: "Network Error" }),
251
311
  meta: { requestId },
252
312
  };
253
313
  }
254
314
 
315
+ const durationMs = Date.now() - startTime;
316
+
317
+ // Extract requestId for tracing (prefer server requestId if available)
318
+ const requestId = response.headers.get("x-request-id") ?? clientRequestId;
319
+
255
320
  // Call onResponse hook
256
321
  await options.hooks?.onResponse?.({
257
322
  method,
@@ -384,6 +449,8 @@ export type WaitRunResponse = components["schemas"]["WaitRunResponse"];
384
449
  export type BatchRunRequest = components["schemas"]["BatchRunRequest"];
385
450
  export type BatchRunResponse = components["schemas"]["BatchRunResponse"];
386
451
  export type ReplayRequest = components["schemas"]["ReplayRequest"];
452
+ export type RunReplayRequest = components["schemas"]["RunReplayRequest"];
453
+ export type RunReplayResponse = components["schemas"]["RunReplayResponse"];
387
454
  export type CancelRequest = components["schemas"]["CancelRequest"];
388
455
  export type CancelRunResponse = components["schemas"]["CancelRunResponse"];
389
456
 
@@ -2637,172 +2637,6 @@ export interface paths {
2637
2637
  patch?: never;
2638
2638
  trace?: never;
2639
2639
  };
2640
- "/v1/api/runs/dlq": {
2641
- parameters: {
2642
- query?: never;
2643
- header?: never;
2644
- path?: never;
2645
- cookie?: never;
2646
- };
2647
- /** List DLQ messages. */
2648
- get: {
2649
- parameters: {
2650
- query?: {
2651
- messageType?: string;
2652
- skip?: number;
2653
- take?: number;
2654
- };
2655
- header?: never;
2656
- path?: never;
2657
- cookie?: never;
2658
- };
2659
- requestBody?: never;
2660
- responses: {
2661
- /** @description OK */
2662
- 200: {
2663
- headers: {
2664
- [name: string]: unknown;
2665
- };
2666
- content?: never;
2667
- };
2668
- };
2669
- };
2670
- put?: never;
2671
- post?: never;
2672
- delete?: never;
2673
- options?: never;
2674
- head?: never;
2675
- patch?: never;
2676
- trace?: never;
2677
- };
2678
- "/v1/api/runs/dlq/{id}": {
2679
- parameters: {
2680
- query?: never;
2681
- header?: never;
2682
- path?: never;
2683
- cookie?: never;
2684
- };
2685
- /** Get a specific DLQ message. */
2686
- get: {
2687
- parameters: {
2688
- query?: never;
2689
- header?: never;
2690
- path: {
2691
- id: string;
2692
- };
2693
- cookie?: never;
2694
- };
2695
- requestBody?: never;
2696
- responses: {
2697
- /** @description OK */
2698
- 200: {
2699
- headers: {
2700
- [name: string]: unknown;
2701
- };
2702
- content?: never;
2703
- };
2704
- };
2705
- };
2706
- put?: never;
2707
- post?: never;
2708
- /** Delete/acknowledge a DLQ message. */
2709
- delete: {
2710
- parameters: {
2711
- query?: never;
2712
- header?: never;
2713
- path: {
2714
- id: string;
2715
- };
2716
- cookie?: never;
2717
- };
2718
- requestBody?: never;
2719
- responses: {
2720
- /** @description OK */
2721
- 200: {
2722
- headers: {
2723
- [name: string]: unknown;
2724
- };
2725
- content?: never;
2726
- };
2727
- };
2728
- };
2729
- options?: never;
2730
- head?: never;
2731
- patch?: never;
2732
- trace?: never;
2733
- };
2734
- "/v1/api/runs/dlq/{id}/retry": {
2735
- parameters: {
2736
- query?: never;
2737
- header?: never;
2738
- path?: never;
2739
- cookie?: never;
2740
- };
2741
- get?: never;
2742
- put?: never;
2743
- /** Retry a DLQ message (re-enqueue the original operation). */
2744
- post: {
2745
- parameters: {
2746
- query?: never;
2747
- header?: never;
2748
- path: {
2749
- id: string;
2750
- };
2751
- cookie?: never;
2752
- };
2753
- requestBody?: never;
2754
- responses: {
2755
- /** @description OK */
2756
- 200: {
2757
- headers: {
2758
- [name: string]: unknown;
2759
- };
2760
- content?: never;
2761
- };
2762
- };
2763
- };
2764
- delete?: never;
2765
- options?: never;
2766
- head?: never;
2767
- patch?: never;
2768
- trace?: never;
2769
- };
2770
- "/v1/api/runs/dlq/purge": {
2771
- parameters: {
2772
- query?: never;
2773
- header?: never;
2774
- path?: never;
2775
- cookie?: never;
2776
- };
2777
- get?: never;
2778
- put?: never;
2779
- post?: never;
2780
- /** Purge all DLQ messages for the tenant. */
2781
- delete: {
2782
- parameters: {
2783
- query?: {
2784
- messageType?: string;
2785
- };
2786
- header?: never;
2787
- path?: never;
2788
- cookie?: never;
2789
- };
2790
- requestBody?: never;
2791
- responses: {
2792
- /** @description OK */
2793
- 200: {
2794
- headers: {
2795
- [name: string]: unknown;
2796
- };
2797
- content?: never;
2798
- };
2799
- };
2800
- };
2801
- options?: never;
2802
- head?: never;
2803
- patch?: never;
2804
- trace?: never;
2805
- };
2806
2640
  "/v1/api/evaluations/datasets": {
2807
2641
  parameters: {
2808
2642
  query?: never;
@@ -5544,7 +5378,7 @@ export interface paths {
5544
5378
  [name: string]: unknown;
5545
5379
  };
5546
5380
  content: {
5547
- "application/json": components["schemas"]["ReplayResponse"];
5381
+ "application/json": components["schemas"]["RunReplayResponse"];
5548
5382
  };
5549
5383
  };
5550
5384
  /** @description Not Found */
@@ -9249,6 +9083,16 @@ export interface components {
9249
9083
  } | null;
9250
9084
  /** Format: int32 */
9251
9085
  version_number?: number | null;
9086
+ execute?: boolean;
9087
+ provider?: string | null;
9088
+ model?: string | null;
9089
+ /** Format: uuid */
9090
+ credential_id?: string | null;
9091
+ credential_name?: string | null;
9092
+ /** Format: double */
9093
+ temperature?: number | null;
9094
+ /** Format: int32 */
9095
+ max_tokens?: number | null;
9252
9096
  };
9253
9097
  /**
9254
9098
  * @description Playground request - note: TenantId/WorkspaceId from body are IGNORED,
@@ -9365,6 +9209,8 @@ export interface components {
9365
9209
  query?: string | null;
9366
9210
  /** Format: int32 */
9367
9211
  top_k?: number;
9212
+ /** Format: float */
9213
+ min_score?: number | null;
9368
9214
  filters?: {
9369
9215
  [key: string]: unknown;
9370
9216
  } | null;
@@ -9494,6 +9340,16 @@ export interface components {
9494
9340
  mode?: string | null;
9495
9341
  reason?: string | null;
9496
9342
  };
9343
+ RunReplayResponse: {
9344
+ /** Format: uuid */
9345
+ run_id?: string;
9346
+ /** Format: uuid */
9347
+ replayed_from_run_id?: string;
9348
+ /** Format: uuid */
9349
+ replayed_from_checkpoint_id?: string;
9350
+ mode?: string | null;
9351
+ status?: string | null;
9352
+ };
9497
9353
  RunResponse: {
9498
9354
  /** Format: uuid */
9499
9355
  run_id?: string;