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