@kortyx/hooks 0.9.0 → 0.10.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,30 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.10.0](https://github.com/kortyx-io/kortyx/compare/hooks-v0.9.1...hooks-v0.10.0) (2026-04-25)
4
+
5
+
6
+ ### Features
7
+
8
+ * **google, hooks:** reasoning fallback and structured reason parsing ([b12d404](https://github.com/kortyx-io/kortyx/commit/b12d404d42c184f5dd076d00ccf8af28bb463d45))
9
+ * **hooks:** track reason usage and tracing spans ([7dd9bf1](https://github.com/kortyx-io/kortyx/commit/7dd9bf1a207c7ce127cb64a090cf9b123924d1c6))
10
+ * **providers:** normalize reason model call metadata ([1a59e64](https://github.com/kortyx-io/kortyx/commit/1a59e6438c555a7536128501114a1382e6f90be4))
11
+ * **providers:** use provider instances in model refs ([e6183f0](https://github.com/kortyx-io/kortyx/commit/e6183f06b17c66e35cc336ef05019148ac631390))
12
+
13
+
14
+ ### Dependencies
15
+
16
+ * The following workspace dependencies were updated
17
+ * dependencies
18
+ * @kortyx/providers bumped to 0.4.0
19
+
20
+ ## [0.9.1](https://github.com/kortyx-io/kortyx/compare/hooks-v0.9.0...hooks-v0.9.1) (2026-04-22)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * **stream:** enforce structured chunk contract semantics ([bdbc518](https://github.com/kortyx-io/kortyx/commit/bdbc518366baacddb1a2ebb890b19e6564e2bee4))
26
+ * **stream:** enforce structured chunk contract semantics ([249d6e4](https://github.com/kortyx-io/kortyx/commit/249d6e47e1960debb0f396a4e7251bf9df38d7d2))
27
+
3
28
  ## [0.9.0](https://github.com/kortyx-io/kortyx/compare/hooks-v0.8.0...hooks-v0.9.0) (2026-04-17)
4
29
 
5
30
 
package/dist/index.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import { NodeContext, GraphState, InterruptInput, InterruptResult } from '@kortyx/core';
2
- import { GetProviderFn, ProviderModelRef } from '@kortyx/providers';
2
+ import { R as ReasonTraceAdapter } from './tracing-BG-j1cer.js';
3
+ export { a as ReasonTraceAttributes, b as ReasonTraceSpan, c as ReasonTraceSpanEndArgs, d as ReasonTraceSpanStartArgs } from './tracing-BG-j1cer.js';
4
+ import { ProviderModelRef, KortyxReasoningOptions, KortyxResponseFormat, KortyxUsage, KortyxFinishReason, KortyxProviderMetadata, KortyxWarning } from '@kortyx/providers';
3
5
 
4
6
  type HookRuntimeContext = {
5
7
  node: NodeContext;
6
8
  state: GraphState;
7
- getProvider?: GetProviderFn;
9
+ reasonTrace?: ReasonTraceAdapter | undefined;
8
10
  };
9
11
  declare function runWithHookContext<T>(ctx: HookRuntimeContext, fn: () => Promise<T>): Promise<{
10
12
  result: T;
@@ -22,6 +24,10 @@ type SchemaLike<T> = {
22
24
  };
23
25
  };
24
26
  };
27
+ type StructuredPath = string;
28
+ type UseReasonStructuredFieldMode = "append" | "text-delta" | "set";
29
+ type UseReasonStructuredFieldKey = string;
30
+ type UseReasonStructuredFields = Record<UseReasonStructuredFieldKey, UseReasonStructuredFieldMode>;
25
31
  type UseStructuredDataBaseArgs = {
26
32
  dataType?: string | undefined;
27
33
  schemaId?: string | undefined;
@@ -36,19 +42,19 @@ type UseStructuredDataFinalArgs<TData = unknown> = UseStructuredDataBaseArgs & {
36
42
  };
37
43
  type UseStructuredDataSetArgs<TValue = unknown> = UseStructuredDataBaseArgs & {
38
44
  kind: "set";
39
- path: string;
45
+ path: StructuredPath;
40
46
  value: TValue;
41
47
  valueSchema?: SchemaLike<TValue> | undefined;
42
48
  };
43
49
  type UseStructuredDataAppendArgs<TItem = unknown> = UseStructuredDataBaseArgs & {
44
50
  kind: "append";
45
- path: string;
51
+ path: StructuredPath;
46
52
  items: TItem[];
47
53
  itemSchema?: SchemaLike<TItem> | undefined;
48
54
  };
49
55
  type UseStructuredDataTextDeltaArgs = UseStructuredDataBaseArgs & {
50
56
  kind: "text-delta";
51
- path: string;
57
+ path: StructuredPath;
52
58
  delta: string;
53
59
  };
54
60
  type UseStructuredDataArgs<TData = unknown, TValue = unknown, TItem = unknown> = UseStructuredDataFinalArgs<TData> | UseStructuredDataSetArgs<TValue> | UseStructuredDataAppendArgs<TItem> | UseStructuredDataTextDeltaArgs;
@@ -58,7 +64,12 @@ type UseReasonStructuredConfig = {
58
64
  dataType?: string | undefined;
59
65
  schemaId?: string | undefined;
60
66
  schemaVersion?: string | undefined;
61
- fields?: Record<string, "append" | "text-delta" | "set"> | undefined;
67
+ /**
68
+ * Incremental extraction keys for useReason. These are top-level JSON field
69
+ * names only; dotted paths are reserved for raw structured chunks and
70
+ * useStructuredData(...).
71
+ */
72
+ fields?: UseReasonStructuredFields | undefined;
62
73
  };
63
74
  type UseReasonInterruptConfig<TRequest extends InterruptInput = InterruptInput, TResponse = InterruptResult> = {
64
75
  requestSchema: SchemaLike<TRequest>;
@@ -71,6 +82,12 @@ type UseReasonArgs<TOutput = unknown, TRequest extends InterruptInput = Interrup
71
82
  input: string;
72
83
  system?: string | undefined;
73
84
  temperature?: number | undefined;
85
+ maxOutputTokens?: number | undefined;
86
+ stopSequences?: string[] | undefined;
87
+ abortSignal?: AbortSignal | undefined;
88
+ reasoning?: KortyxReasoningOptions | undefined;
89
+ responseFormat?: KortyxResponseFormat | undefined;
90
+ providerOptions?: Record<string, unknown> | undefined;
74
91
  emit?: boolean | undefined;
75
92
  stream?: boolean | undefined;
76
93
  id?: string | undefined;
@@ -83,6 +100,10 @@ type UseReasonResult<TOutput = unknown, TResponse = InterruptResult> = {
83
100
  opId: string;
84
101
  text: string;
85
102
  raw?: unknown;
103
+ usage?: KortyxUsage;
104
+ finishReason?: KortyxFinishReason;
105
+ providerMetadata?: KortyxProviderMetadata;
106
+ warnings?: KortyxWarning[];
86
107
  output?: TOutput;
87
108
  interruptResponse?: TResponse;
88
109
  };
@@ -103,4 +124,4 @@ declare function useInterrupt<TRequest extends InterruptInput = InterruptInput,
103
124
  declare function useNodeState<T>(initialValue: T): [T, StateSetter<T>];
104
125
  declare function useWorkflowState<T>(key: string, ...rest: [] | [T]): [T, StateSetter<T>];
105
126
 
106
- export { type HookRuntimeContext, type UseInterruptArgs, type UseReasonArgs, type UseReasonResult, type UseStructuredDataArgs, runWithHookContext, useInterrupt, useNodeState, useReason, useStructuredData, useWorkflowState };
127
+ export { type HookRuntimeContext, ReasonTraceAdapter, type UseInterruptArgs, type UseReasonArgs, type UseReasonResult, type UseStructuredDataArgs, runWithHookContext, useInterrupt, useNodeState, useReason, useStructuredData, useWorkflowState };