@runtypelabs/sdk 11.10.0 → 11.12.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
@@ -8781,6 +8781,28 @@ var LogsEndpoint = class {
8781
8781
  async traceConversation(conversationId) {
8782
8782
  return this.client.get(`/logs/trace/conversation/${conversationId}`);
8783
8783
  }
8784
+ /**
8785
+ * Filter runs and group them by one or two dimensions into aggregates (count, failure rate,
8786
+ * tokens, cost, duration, tool calls, signal fire rate), each with sample execution ids.
8787
+ * Model and tool-call metrics read spans, which caps the window at 7 days.
8788
+ */
8789
+ async queryTraces(request = {}) {
8790
+ return this.client.post("/logs/trace/query", request);
8791
+ }
8792
+ /**
8793
+ * Read a bounded window of one trace: by span index range, span kind, tool name, or around
8794
+ * the first failed span. Content stays previews-only unless `includeContent` is set.
8795
+ */
8796
+ async readTraceSlice(executionId, params) {
8797
+ return this.client.get(`/logs/trace/execution/${encodeURIComponent(executionId)}/slice`, params ? { ...params } : void 0);
8798
+ }
8799
+ /**
8800
+ * Compare two executions (tool-call alignment and first divergence) or two cohorts of runs
8801
+ * (failure rate, stop reasons, tool usage, signal rates).
8802
+ */
8803
+ async compareTrace(request) {
8804
+ return this.client.post("/logs/trace/compare", request);
8805
+ }
8784
8806
  };
8785
8807
  /**
8786
8808
  * Agent Versions endpoint handlers
@@ -9677,8 +9699,48 @@ function normalizeConfigForHash(config) {
9677
9699
  }
9678
9700
  return normalized;
9679
9701
  }
9702
+ const CONDITIONAL_STEP_LIST_KEYS = [
9703
+ "trueSteps",
9704
+ "falseSteps",
9705
+ "true_steps",
9706
+ "false_steps",
9707
+ "otherwiseSteps"
9708
+ ];
9709
+ function withoutStepIds(steps) {
9710
+ return steps.map((child) => {
9711
+ if (!isPlainObject$1(child)) return child;
9712
+ const { id: _id, ...rest } = child;
9713
+ return stripNestedStepIdsForHash(rest);
9714
+ });
9715
+ }
9716
+ /** Mirrors shared `stripNestedStepIds`: nested step ids are server-minted, so they are not content. */
9717
+ function stripNestedStepIdsForHash(step) {
9718
+ const config = step.config;
9719
+ if (!isPlainObject$1(config)) return step;
9720
+ if (step.type === "loop") return Array.isArray(config.steps) ? {
9721
+ ...step,
9722
+ config: {
9723
+ ...config,
9724
+ steps: withoutStepIds(config.steps)
9725
+ }
9726
+ } : step;
9727
+ if (step.type !== "conditional") return step;
9728
+ const next = { ...config };
9729
+ for (const key of CONDITIONAL_STEP_LIST_KEYS) {
9730
+ const list = config[key];
9731
+ if (Array.isArray(list)) next[key] = withoutStepIds(list);
9732
+ }
9733
+ if (Array.isArray(config.branches)) next.branches = config.branches.map((branch) => isPlainObject$1(branch) && Array.isArray(branch.steps) ? {
9734
+ ...branch,
9735
+ steps: withoutStepIds(branch.steps)
9736
+ } : branch);
9737
+ return {
9738
+ ...step,
9739
+ config: next
9740
+ };
9741
+ }
9680
9742
  function normalizeStepForHash(step) {
9681
- const stepObj = isPlainObject$1(step) ? step : {};
9743
+ const stepObj = isPlainObject$1(step) ? stripNestedStepIdsForHash(step) : {};
9682
9744
  return {
9683
9745
  type: typeof stepObj.type === "string" ? stepObj.type : "",
9684
9746
  name: typeof stepObj.name === "string" ? stepObj.name : "",
@@ -11929,25 +11991,28 @@ const AGENT_CONFIG_KEYS = [
11929
11991
  "tenancyStrategy",
11930
11992
  "durability",
11931
11993
  "busyMessageRouting",
11932
- "state"
11994
+ "state",
11995
+ "output"
11933
11996
  ];
11934
11997
  const AGENT_CONFIG_KEY_LIST = [...AGENT_CONFIG_KEYS].sort();
11935
11998
  function isPlainObject(value) {
11936
11999
  return value !== null && typeof value === "object" && !Array.isArray(value);
11937
12000
  }
11938
- function normalizeValue(value) {
11939
- if (Array.isArray(value)) return value.map((item) => normalizeValue(item));
12001
+ function normalizeValue(value, keepNulls = false) {
12002
+ if (Array.isArray(value)) return value.map((item) => normalizeValue(item, keepNulls));
11940
12003
  if (isPlainObject(value)) {
11941
12004
  const normalized = {};
11942
12005
  for (const key of Object.keys(value).sort()) {
11943
12006
  const entry = value[key];
11944
- if (entry === void 0 || entry === null) continue;
11945
- normalized[key] = normalizeValue(entry);
12007
+ if (entry === void 0 || entry === null && !keepNulls) continue;
12008
+ normalized[key] = normalizeValue(entry, keepNulls);
11946
12009
  }
11947
12010
  return normalized;
11948
12011
  }
11949
12012
  return value;
11950
12013
  }
12014
+ /** Config keys whose nested nulls are literal values (a validator schema's `const: null`), not "unset". */
12015
+ const NULL_LITERAL_CONFIG_KEYS = /* @__PURE__ */ new Set(["output"]);
11951
12016
  /** Canonical normalized form — must stay byte-identical to the shared impl. */
11952
12017
  function normalizeAgentDefinition(definition) {
11953
12018
  const config = {};
@@ -11955,7 +12020,7 @@ function normalizeAgentDefinition(definition) {
11955
12020
  for (const key of AGENT_CONFIG_KEY_LIST) {
11956
12021
  const value = rawConfig[key];
11957
12022
  if (value === void 0 || value === null) continue;
11958
- config[key] = normalizeValue(value);
12023
+ config[key] = normalizeValue(value, NULL_LITERAL_CONFIG_KEYS.has(key));
11959
12024
  }
11960
12025
  return {
11961
12026
  name: definition.name,
@@ -14653,7 +14718,7 @@ function transformQueryParams(params) {
14653
14718
  return result;
14654
14719
  }
14655
14720
  // src/version.ts
14656
- const SDK_VERSION = "11.10.0";
14721
+ const SDK_VERSION = "11.12.0";
14657
14722
  /**
14658
14723
  * Canonical client identity the API uses for attribution
14659
14724
  * (`detectActorSource` in apps/api/src/lib/audit-log.ts keys `'sdk'` off the