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