@kortyx/runtime 0.20.1 → 0.21.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.21.0](https://github.com/kortyx-io/kortyx/compare/runtime-v0.20.1...runtime-v0.21.0) (2026-09-21)
4
+
5
+
6
+ ### Features
7
+
8
+ * **hooks:** add model-driven interrupt contracts to useReason ([#224](https://github.com/kortyx-io/kortyx/issues/224)) ([e0147d5](https://github.com/kortyx-io/kortyx/commit/e0147d5234ca38d450d452af924b242f8cbdeb16))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @kortyx/stream bumped to 0.13.0
16
+ * @kortyx/core bumped to 0.10.0
17
+ * @kortyx/hooks bumped to 0.28.0
18
+ * @kortyx/providers bumped to 0.8.1
19
+ * @kortyx/utils bumped to 0.3.1
20
+
3
21
  ## [0.20.1](https://github.com/kortyx-io/kortyx/compare/runtime-v0.20.0...runtime-v0.20.1) (2026-09-21)
4
22
 
5
23
 
package/dist/index.d.ts CHANGED
@@ -38,7 +38,7 @@ type GraphSnapshotBundle = CheckpointTuple;
38
38
  declare function captureGraphSnapshot(saver: BaseCheckpointSaver, threadId: string, checkpointId?: string): Promise<GraphSnapshotBundle | undefined>;
39
39
  declare function restoreGraphSnapshot(saver: BaseCheckpointSaver, snapshot: GraphSnapshotBundle, threadId: string): Promise<void>;
40
40
 
41
- type HumanInputKind = "choice" | "multi-choice" | "text";
41
+ type HumanInputKind = "choice" | "multi-choice" | "text" | "custom";
42
42
  interface HumanInputOption {
43
43
  id: string;
44
44
  label: string;
@@ -72,6 +72,8 @@ interface PendingRequestRecord {
72
72
  id?: string;
73
73
  schemaId?: string;
74
74
  schemaVersion?: string;
75
+ contract?: string;
76
+ request?: unknown;
75
77
  meta?: Record<string, unknown>;
76
78
  };
77
79
  options: HumanInputOption[];
package/dist/index.js CHANGED
@@ -3278,14 +3278,23 @@ async function createExecutionGraph(workflow, config, execution = {}) {
3278
3278
  (0, import_core3.throwIfExecutionAborted)(execution.abortSignal);
3279
3279
  if (execution.budget) (0, import_core3.assertExecutionBudget)(execution.budget);
3280
3280
  const { kind, question } = interruptConfig;
3281
- const isMulti = kind === "multi-choice" || interruptConfig.kind !== "text" && interruptConfig.multiple === true;
3281
+ const isCustom = kind === "custom";
3282
+ const isMulti = kind === "multi-choice" || interruptConfig.kind === "choice" && interruptConfig.multiple === true;
3282
3283
  const sharedInterruptFields = {
3283
3284
  ...typeof interruptConfig.id === "string" && interruptConfig.id.length > 0 ? { id: interruptConfig.id } : {},
3284
3285
  ...typeof interruptConfig.schemaId === "string" && interruptConfig.schemaId.length > 0 ? { schemaId: interruptConfig.schemaId } : {},
3285
3286
  ...typeof interruptConfig.schemaVersion === "string" && interruptConfig.schemaVersion.length > 0 ? { schemaVersion: interruptConfig.schemaVersion } : {},
3286
3287
  ...interruptConfig.meta && typeof interruptConfig.meta === "object" && !Array.isArray(interruptConfig.meta) ? { meta: interruptConfig.meta } : {}
3287
3288
  };
3288
- const payload = interruptConfig.kind === "text" ? {
3289
+ const payload = isCustom ? {
3290
+ kind: "custom",
3291
+ request: interruptConfig.request,
3292
+ ...question ? { question } : {},
3293
+ ...interruptConfig.contract ? { contract: interruptConfig.contract } : {},
3294
+ schemaId: interruptConfig.schemaId,
3295
+ schemaVersion: interruptConfig.schemaVersion,
3296
+ ...sharedInterruptFields
3297
+ } : interruptConfig.kind === "text" ? {
3289
3298
  kind: "text",
3290
3299
  ...question ? { question } : {},
3291
3300
  ...sharedInterruptFields
@@ -3309,6 +3318,7 @@ async function createExecutionGraph(workflow, config, execution = {}) {
3309
3318
  });
3310
3319
  throw error;
3311
3320
  }
3321
+ if (isCustom) return resumed;
3312
3322
  if (isMulti) {
3313
3323
  if (Array.isArray(resumed)) {
3314
3324
  return resumed.map(