@runtypelabs/sdk 10.14.2 → 10.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -173,7 +173,8 @@ function createFlowEventTranslator() {
173
173
  failedSteps: data.failedSteps,
174
174
  executionTime: data.durationMs,
175
175
  finalOutput: data.finalOutput,
176
- completedAt: data.completedAt
176
+ completedAt: data.completedAt,
177
+ outcome: data.outcome
177
178
  })];
178
179
  case "execution_error": return [compact({
179
180
  type: "flow_error",
@@ -182,7 +183,8 @@ function createFlowEventTranslator() {
182
183
  error: data.error,
183
184
  code: data.code,
184
185
  upgradeUrl: data.upgradeUrl,
185
- blockReason: data.blockReason
186
+ blockReason: data.blockReason,
187
+ outcome: data.outcome
186
188
  })];
187
189
  case "await":
188
190
  if (data.awaitReason === "detached") return [];
@@ -195,7 +197,8 @@ function createFlowEventTranslator() {
195
197
  parameters: data.parameters,
196
198
  awaitedAt: data.awaitedAt,
197
199
  origin: data.origin,
198
- pageOrigin: data.pageOrigin
200
+ pageOrigin: data.pageOrigin,
201
+ annotations: data.annotations
199
202
  })];
200
203
  default: return [];
201
204
  }
@@ -304,7 +307,8 @@ function createAgentEventTranslator() {
304
307
  parameters: data.parameters,
305
308
  hiddenParameterNames: data.hiddenParameterNames,
306
309
  origin: data.origin,
307
- pageOrigin: data.pageOrigin
310
+ pageOrigin: data.pageOrigin,
311
+ annotations: data.annotations
308
312
  })];
309
313
  case "tool_output_delta": return [compact({
310
314
  type: "agent_tool_delta",
@@ -419,6 +423,7 @@ function createAgentEventTranslator() {
419
423
  awaitedAt: data.awaitedAt,
420
424
  origin: data.origin,
421
425
  pageOrigin: data.pageOrigin,
426
+ annotations: data.annotations,
422
427
  awaitReason: data.awaitReason,
423
428
  elicitation: data.elicitation,
424
429
  externalAgent: data.externalAgent
@@ -438,7 +443,8 @@ function createAgentEventTranslator() {
438
443
  totalTokens: data.totalTokens,
439
444
  finalOutput: data.finalOutput,
440
445
  duration: data.durationMs,
441
- externalAgent: data.externalAgent
446
+ externalAgent: data.externalAgent,
447
+ outcome: data.outcome
442
448
  })];
443
449
  case "execution_error":
444
450
  if (data.kind !== "agent") return [];
@@ -450,7 +456,8 @@ function createAgentEventTranslator() {
450
456
  success: false,
451
457
  stopReason: data.stopReason ?? "error",
452
458
  error: errorMessage(data.error),
453
- completedAt: data.completedAt
459
+ completedAt: data.completedAt,
460
+ outcome: data.outcome
454
461
  })];
455
462
  case "error": return [compact({
456
463
  type: "agent_error",
@@ -8739,6 +8746,13 @@ var LogsEndpoint = class {
8739
8746
  return this.client.get(`/logs/trace/execution/${executionId}`);
8740
8747
  }
8741
8748
  /**
8749
+ * Explain one execution from its retained trace, with each claim citing trace entry ids.
8750
+ * Runs a metered, tool-free analysis in the caller's account and never changes the run.
8751
+ */
8752
+ async explainRun(executionId) {
8753
+ return this.client.post(`/logs/trace/execution/${encodeURIComponent(executionId)}/explain`, void 0, void 0, { timeoutMs: 6e4 });
8754
+ }
8755
+ /**
8742
8756
  * Get the trace tree for a conversation (all executions within it).
8743
8757
  */
8744
8758
  async traceConversation(conversationId) {
@@ -14445,7 +14459,7 @@ function transformQueryParams(params) {
14445
14459
  }
14446
14460
  //#endregion
14447
14461
  //#region src/version.ts
14448
- const SDK_VERSION = "10.14.2";
14462
+ const SDK_VERSION = "10.15.1";
14449
14463
  /**
14450
14464
  * Canonical client identity the API uses for attribution
14451
14465
  * (`detectActorSource` in apps/api/src/lib/audit-log.ts keys `'sdk'` off the
@@ -14566,6 +14580,7 @@ var RuntypeClient = class {
14566
14580
  parametersSchema: entry.parametersSchema,
14567
14581
  ...entry.origin ? { origin: entry.origin } : {},
14568
14582
  ...entry.pageOrigin ? { pageOrigin: entry.pageOrigin } : {},
14583
+ ...entry.annotations ? { annotations: entry.annotations } : {},
14569
14584
  ...entry.untrustedContentHint ? { untrustedContentHint: true } : {}
14570
14585
  })) : [];
14571
14586
  const modifiedRequest = {
@@ -14750,7 +14765,7 @@ var RuntypeClient = class {
14750
14765
  /**
14751
14766
  * Generic POST request
14752
14767
  */
14753
- async post(path, data, extraHeaders) {
14768
+ async post(path, data, extraHeaders, options) {
14754
14769
  const url = this.buildUrl(path);
14755
14770
  return await this.makeRequest(url, {
14756
14771
  method: "POST",
@@ -14759,7 +14774,7 @@ var RuntypeClient = class {
14759
14774
  ...extraHeaders
14760
14775
  },
14761
14776
  body: data ? JSON.stringify(data) : void 0
14762
- });
14777
+ }, options?.timeoutMs);
14763
14778
  }
14764
14779
  /**
14765
14780
  * POST request with FormData support for file uploads
@@ -14868,9 +14883,9 @@ var RuntypeClient = class {
14868
14883
  * `makeRawRequest` keeps its own variant: it additionally composes a
14869
14884
  * caller-supplied `signal` (user-initiated stream aborts) with the timeout.
14870
14885
  */
14871
- async fetchWithTimeout(url, options) {
14872
- const controller = this.timeout === null ? null : new AbortController();
14873
- const timeoutId = controller && this.timeout !== null ? setTimeout(() => controller.abort(), this.timeout) : null;
14886
+ async fetchWithTimeout(url, options, timeoutMs = this.timeout) {
14887
+ const controller = timeoutMs === null ? null : new AbortController();
14888
+ const timeoutId = controller && timeoutMs !== null ? setTimeout(() => controller.abort(), timeoutMs) : null;
14874
14889
  try {
14875
14890
  const response = await fetch(url, {
14876
14891
  ...options,
@@ -14880,12 +14895,12 @@ var RuntypeClient = class {
14880
14895
  return response;
14881
14896
  } catch (error) {
14882
14897
  if (timeoutId) clearTimeout(timeoutId);
14883
- if (timeoutId && error instanceof Error && error.name === "AbortError") throw new Error(`Request timeout after ${this.timeout}ms`, { cause: error });
14898
+ if (timeoutId && error instanceof Error && error.name === "AbortError") throw new Error(`Request timeout after ${timeoutMs}ms`, { cause: error });
14884
14899
  throw error;
14885
14900
  }
14886
14901
  }
14887
- async makeRequest(url, options) {
14888
- const response = await this.fetchWithTimeout(url, options);
14902
+ async makeRequest(url, options, timeoutMs = this.timeout) {
14903
+ const response = await this.fetchWithTimeout(url, options, timeoutMs);
14889
14904
  if (!response.ok) throw await this.createApiError(response);
14890
14905
  if (response.status === 204) return null;
14891
14906
  if (response.headers.get("content-type")?.includes("application/json")) return response.json();