@runtypelabs/sdk 11.18.0 → 11.19.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/dist/index.cjs CHANGED
@@ -597,14 +597,6 @@ async function processStream(response, callbacks = {}, _options = {}) {
597
597
  callbacks.onError?.(error);
598
598
  throw error;
599
599
  }
600
- const reader = response.body?.getReader();
601
- if (!reader) {
602
- const error = /* @__PURE__ */ new Error("Response body is not readable");
603
- callbacks.onError?.(error);
604
- throw error;
605
- }
606
- const decoder = new TextDecoder();
607
- let buffer = "";
608
600
  const results = /* @__PURE__ */ new Map();
609
601
  let flowSummary = {
610
602
  flowId: "",
@@ -622,18 +614,17 @@ async function processStream(response, callbacks = {}, _options = {}) {
622
614
  if (response.headers.get("content-type")?.includes("application/json")) try {
623
615
  const data = await response.json();
624
616
  if (data.events && Array.isArray(data.events)) {
625
- for (const event of data.events) handleEvent(event, callbacks, results, flowSummary);
626
- if (data.flowId) flowSummary.flowId = data.flowId;
627
- if (data.recordId) flowSummary.flowName = data.recordId;
617
+ for (const event of data.events) dispatch(event);
628
618
  if (data.executionSummary) {
629
619
  const s = data.executionSummary;
630
- if (s.flowId) flowSummary.flowId = s.flowId;
631
- if (s.flowName) flowSummary.flowName = s.flowName;
632
- if (s.totalSteps) flowSummary.totalSteps = s.totalSteps;
633
- if (s.successfulSteps) flowSummary.successfulSteps = s.successfulSteps;
634
- if (s.failedSteps) flowSummary.failedSteps = s.failedSteps;
635
- if (s.executionTime) flowSummary.executionTime = s.executionTime;
620
+ flowSummary.flowId || (flowSummary.flowId = s.flowId);
621
+ flowSummary.flowName || (flowSummary.flowName = s.flowName);
622
+ flowSummary.totalSteps || (flowSummary.totalSteps = s.totalSteps);
623
+ flowSummary.successfulSteps || (flowSummary.successfulSteps = s.successfulSteps);
624
+ flowSummary.failedSteps || (flowSummary.failedSteps = s.failedSteps);
625
+ flowSummary.executionTime || (flowSummary.executionTime = s.executionTime);
636
626
  }
627
+ flowSummary.flowId || (flowSummary.flowId = data.flowId);
637
628
  return {
638
629
  flowId: flowSummary.flowId || "",
639
630
  flowName: flowSummary.flowName || "",
@@ -658,6 +649,14 @@ async function processStream(response, callbacks = {}, _options = {}) {
658
649
  throw e;
659
650
  }
660
651
  }
652
+ const reader = response.bodyUsed ? void 0 : response.body?.getReader();
653
+ if (!reader) {
654
+ const error = /* @__PURE__ */ new Error("Response body is not readable");
655
+ callbacks.onError?.(error);
656
+ throw error;
657
+ }
658
+ const decoder = new TextDecoder();
659
+ let buffer = "";
661
660
  try {
662
661
  while (true) {
663
662
  const { done, value } = await reader.read();
@@ -4841,7 +4840,8 @@ var RecordsEndpoint = class {
4841
4840
  return this.client.post("/records/bulk-delete", { ids });
4842
4841
  }
4843
4842
  /**
4844
- * Bulk edit multiple records
4843
+ * Bulk edit multiple records. At most 5,000 targets per call, dry runs included; a larger set
4844
+ * returns 400 `bulk_edit_too_many_records`, so narrow the filter and edit in batches.
4845
4845
  */
4846
4846
  async bulkEdit(data) {
4847
4847
  return this.client.post("/records/bulk-edit", data);
@@ -8671,10 +8671,12 @@ var SchedulesEndpoint = class {
8671
8671
  return this.client.post(`/schedules/${id}/resume`);
8672
8672
  }
8673
8673
  /**
8674
- * List the run history for a specific schedule.
8674
+ * List the run history for a specific schedule, newest first. Without `params` it returns every run.
8675
+ * Pass `limit` (at most 500) to page, then pass `nextCursor` as `cursor` while `hasMore` is true.
8675
8676
  */
8676
- async listRuns(id) {
8677
- return this.client.get(`/schedules/${id}/runs`);
8677
+ async listRuns(id, params) {
8678
+ const path = `/schedules/${id}/runs`;
8679
+ return params ? this.client.get(path, params) : this.client.get(path);
8678
8680
  }
8679
8681
  /**
8680
8682
  * Get statistics (success rate, average duration/cost, 7-day history) for a schedule.
@@ -14701,9 +14703,15 @@ var SimulationsEndpoint = class {
14701
14703
  async previewVariant(simulationId, variantId, data) {
14702
14704
  return this.client.post(`/simulations/${segment(simulationId)}/variants/${segment(variantId)}/preview`, data);
14703
14705
  }
14704
- /** Discard a run variant's frozen synthesized answers so its next run synthesizes again. */
14705
- async resynthesizeVariant(runId, variantId) {
14706
- return this.client.post(`/simulations/runs/${segment(runId)}/variants/${segment(variantId)}/resynthesize`);
14706
+ /**
14707
+ * Discard a run variant's frozen synthesized answers so its next run synthesizes again; `tools` limits it to those
14708
+ * server tools' answers.
14709
+ */
14710
+ async resynthesizeVariant(runId, variantId, options) {
14711
+ const query = new URLSearchParams();
14712
+ for (const tool of options?.tools ?? []) query.append("tools", tool);
14713
+ const search = query.toString() ? `?${query.toString()}` : "";
14714
+ return this.client.post(`/simulations/runs/${segment(runId)}/variants/${segment(variantId)}/resynthesize${search}`);
14707
14715
  }
14708
14716
  /** Mark a synthesized answer plausible or implausible; `null` clears the review. */
14709
14717
  async reviewSynthesizedAnswer(runId, exchangeId, plausible) {
@@ -14747,7 +14755,7 @@ function transformQueryParams(params) {
14747
14755
  return result;
14748
14756
  }
14749
14757
  // src/version.ts
14750
- const SDK_VERSION = "11.18.0";
14758
+ const SDK_VERSION = "11.19.0";
14751
14759
  /**
14752
14760
  * Canonical client identity the API uses for attribution
14753
14761
  * (`detectActorSource` in apps/api/src/lib/audit-log.ts keys `'sdk'` off the