@kortyx/runtime 0.19.0 → 0.20.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/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.20.1](https://github.com/kortyx-io/kortyx/compare/runtime-v0.20.0...runtime-v0.20.1) (2026-09-21)
4
+
5
+
6
+ ### Dependencies
7
+
8
+ * The following workspace dependencies were updated
9
+ * dependencies
10
+ * @kortyx/hooks bumped to 0.27.0
11
+
12
+ ## [0.20.0](https://github.com/kortyx-io/kortyx/compare/runtime-v0.19.0...runtime-v0.20.0) (2026-09-18)
13
+
14
+
15
+ ### Features
16
+
17
+ * **tools:** add useTool and first-class Studio observability ([#215](https://github.com/kortyx-io/kortyx/issues/215)) ([224c92d](https://github.com/kortyx-io/kortyx/commit/224c92d73caead320dd14582d8b624efc3252c9f))
18
+
19
+
20
+ ### Dependencies
21
+
22
+ * The following workspace dependencies were updated
23
+ * dependencies
24
+ * @kortyx/hooks bumped to 0.26.0
25
+ * @kortyx/providers bumped to 0.8.0
26
+
3
27
  ## [0.19.0](https://github.com/kortyx-io/kortyx/compare/runtime-v0.18.0...runtime-v0.19.0) (2026-09-16)
4
28
 
5
29
 
package/dist/index.js CHANGED
@@ -2346,6 +2346,7 @@ var import_promises = require("timers/promises");
2346
2346
  var import_core3 = require("@kortyx/core");
2347
2347
  var import_errors13 = require("@kortyx/core/errors");
2348
2348
  var import_hooks2 = require("@kortyx/hooks");
2349
+ var import_internal2 = require("@kortyx/hooks/internal");
2349
2350
  var import_utils2 = require("@kortyx/utils");
2350
2351
  var import_langgraph3 = require("@langchain/langgraph");
2351
2352
 
@@ -2433,6 +2434,7 @@ async function resolveNodeHandler(args) {
2433
2434
  var import_core = require("@kortyx/core");
2434
2435
  var import_errors11 = require("@kortyx/core/errors");
2435
2436
  var import_hooks = require("@kortyx/hooks");
2437
+ var import_internal = require("@kortyx/hooks/internal");
2436
2438
  var import_singletons = require("@langchain/core/singletons");
2437
2439
  var import_langgraph = require("@langchain/langgraph");
2438
2440
  function createWorkflowCallService(config, _parent, execution = {}) {
@@ -2643,11 +2645,13 @@ function createWorkflowCallService(config, _parent, execution = {}) {
2643
2645
  return {
2644
2646
  status: "completed",
2645
2647
  data,
2648
+ toolObservations: result.runtime.__kortyx?.workflowState?.__kortyxToolObservations ?? [],
2646
2649
  usage: result.runtime.tokenUsage
2647
2650
  };
2648
2651
  };
2649
2652
  const trace = config.telemetry?.trace ?? config.reasonTrace;
2650
- return trace?.withSpan ? trace.withSpan(
2653
+ return (0, import_internal.withSafeTraceSpan)(
2654
+ trace,
2651
2655
  {
2652
2656
  name: "kortyx.workflow.call",
2653
2657
  attributes: {
@@ -2661,7 +2665,7 @@ function createWorkflowCallService(config, _parent, execution = {}) {
2661
2665
  }
2662
2666
  },
2663
2667
  execute
2664
- ) : execute();
2668
+ );
2665
2669
  };
2666
2670
  }
2667
2671
 
@@ -2745,6 +2749,20 @@ function addParallelGraphCoordinator(builder, workflow, config, execution, execu
2745
2749
  for (const parent of parents) {
2746
2750
  for (const [key, field] of Object.entries(parent[property])) {
2747
2751
  const previous = Object.hasOwn(merged, key) ? merged[key] : void 0;
2752
+ if (property === "workflowFields" && key === "__kortyxToolObservations" && previous && Array.isArray(previous.value) && Array.isArray(field.value)) {
2753
+ const observations = /* @__PURE__ */ new Map();
2754
+ for (const observation of [...previous.value, ...field.value]) {
2755
+ if (record(observation) && typeof observation.attemptId === "string")
2756
+ observations.set(observation.attemptId, observation);
2757
+ }
2758
+ Object.defineProperty(merged, key, {
2759
+ value: { writer: field.writer, value: [...observations.values()] },
2760
+ enumerable: true,
2761
+ configurable: true,
2762
+ writable: true
2763
+ });
2764
+ continue;
2765
+ }
2748
2766
  if (previous && previous.writer !== field.writer) {
2749
2767
  if (journal.nodes[previous.writer]?.ancestors.includes(field.writer))
2750
2768
  continue;
@@ -3368,15 +3386,18 @@ async function createExecutionGraph(workflow, config, execution = {}) {
3368
3386
  ...typeof context?.tenantId === "string" ? { tenantId: context.tenantId } : {}
3369
3387
  },
3370
3388
  telemetry: {
3371
- metadata: {
3372
- ...runtimeConfig.telemetry?.metadata ?? {},
3373
- ...context ?? {}
3374
- },
3389
+ metadata: (0, import_internal2.safeTelemetryMetadata)({
3390
+ ...runtimeConfig.telemetry?.metadata ?? {}
3391
+ }),
3375
3392
  tags: runtimeConfig.telemetry?.tags,
3376
3393
  captureContent: runtimeConfig.telemetry?.captureContent
3377
3394
  }
3378
3395
  };
3379
- const hookRun = activeTrace?.withSpan ? await activeTrace.withSpan(spanArgs, runNode) : await runNode();
3396
+ const hookRun = await (0, import_internal2.withSafeTraceSpan)(
3397
+ activeTrace,
3398
+ spanArgs,
3399
+ runNode
3400
+ );
3380
3401
  nodeResult = hookRun.result;
3381
3402
  hookRuntimeUpdates = hookRun.runtimeUpdates;
3382
3403
  break;