@kortyx/hooks 0.7.0 → 0.9.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,26 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.9.0](https://github.com/kortyx-io/kortyx/compare/hooks-v0.8.0...hooks-v0.9.0) (2026-04-17)
4
+
5
+
6
+ ### Features
7
+
8
+ * **hooks:** support incremental structured data streaming ([05e9678](https://github.com/kortyx-io/kortyx/commit/05e96789a9a132549c9245b1feb76d20916da42a))
9
+ * **hooks:** support incremental structured data streaming ([05e9678](https://github.com/kortyx-io/kortyx/commit/05e96789a9a132549c9245b1feb76d20916da42a))
10
+ * **hooks:** support incremental structured data streaming ([4023fda](https://github.com/kortyx-io/kortyx/commit/4023fda42bfecc81782e474e6d442b379a3fa3d4))
11
+
12
+ ## [0.8.0](https://github.com/kortyx-io/kortyx/compare/hooks-v0.7.0...hooks-v0.8.0) (2026-03-11)
13
+
14
+
15
+ ### ⚠ BREAKING CHANGES
16
+
17
+ * remove @kortyx/memory and clarify runtime persistence
18
+
19
+ ### Bug Fixes
20
+
21
+ * **dx:** simplify streamChat API route surface and docs ([6ac69da](https://github.com/kortyx-io/kortyx/commit/6ac69da30945e48d251b3f16b979177cf5a4d108))
22
+ * remove @kortyx/memory and clarify runtime persistence ([613574d](https://github.com/kortyx-io/kortyx/commit/613574d535de680a7b9671e801613a8222052dd5))
23
+
3
24
  ## [0.7.0](https://github.com/kortyx-io/kortyx/compare/hooks-v0.6.0...hooks-v0.7.0) (2026-03-09)
4
25
 
5
26
 
package/dist/index.d.ts CHANGED
@@ -1,16 +1,14 @@
1
1
  import { NodeContext, GraphState, InterruptInput, InterruptResult } from '@kortyx/core';
2
- import { MemoryAdapter } from '@kortyx/memory';
3
2
  import { GetProviderFn, ProviderModelRef } from '@kortyx/providers';
4
3
 
5
4
  type HookRuntimeContext = {
6
5
  node: NodeContext;
7
6
  state: GraphState;
8
7
  getProvider?: GetProviderFn;
9
- memoryAdapter?: MemoryAdapter;
10
8
  };
11
9
  declare function runWithHookContext<T>(ctx: HookRuntimeContext, fn: () => Promise<T>): Promise<{
12
10
  result: T;
13
- memoryUpdates: Record<string, unknown> | null;
11
+ runtimeUpdates: Record<string, unknown> | null;
14
12
  }>;
15
13
 
16
14
  type SchemaLike<T> = {
@@ -24,24 +22,43 @@ type SchemaLike<T> = {
24
22
  };
25
23
  };
26
24
  };
27
- type StructuredDataMode = "final" | "patch" | "snapshot";
28
- type UseStructuredDataArgs<TData = unknown> = {
29
- data: TData;
25
+ type UseStructuredDataBaseArgs = {
30
26
  dataType?: string | undefined;
31
- dataSchema?: SchemaLike<TData> | undefined;
32
- mode?: StructuredDataMode | undefined;
33
27
  schemaId?: string | undefined;
34
28
  schemaVersion?: string | undefined;
35
29
  id?: string | undefined;
36
- opId?: string | undefined;
30
+ streamId?: string | undefined;
31
+ };
32
+ type UseStructuredDataFinalArgs<TData = unknown> = UseStructuredDataBaseArgs & {
33
+ kind?: "final" | undefined;
34
+ data: TData;
35
+ dataSchema?: SchemaLike<TData> | undefined;
37
36
  };
38
- type UseReasonStructuredStreamMode = "off" | "patch" | "snapshot";
37
+ type UseStructuredDataSetArgs<TValue = unknown> = UseStructuredDataBaseArgs & {
38
+ kind: "set";
39
+ path: string;
40
+ value: TValue;
41
+ valueSchema?: SchemaLike<TValue> | undefined;
42
+ };
43
+ type UseStructuredDataAppendArgs<TItem = unknown> = UseStructuredDataBaseArgs & {
44
+ kind: "append";
45
+ path: string;
46
+ items: TItem[];
47
+ itemSchema?: SchemaLike<TItem> | undefined;
48
+ };
49
+ type UseStructuredDataTextDeltaArgs = UseStructuredDataBaseArgs & {
50
+ kind: "text-delta";
51
+ path: string;
52
+ delta: string;
53
+ };
54
+ type UseStructuredDataArgs<TData = unknown, TValue = unknown, TItem = unknown> = UseStructuredDataFinalArgs<TData> | UseStructuredDataSetArgs<TValue> | UseStructuredDataAppendArgs<TItem> | UseStructuredDataTextDeltaArgs;
39
55
  type UseReasonStructuredConfig = {
40
- stream?: UseReasonStructuredStreamMode | undefined;
56
+ stream?: boolean | undefined;
41
57
  optimistic?: boolean | undefined;
42
58
  dataType?: string | undefined;
43
59
  schemaId?: string | undefined;
44
60
  schemaVersion?: string | undefined;
61
+ fields?: Record<string, "append" | "text-delta" | "set"> | undefined;
45
62
  };
46
63
  type UseReasonInterruptConfig<TRequest extends InterruptInput = InterruptInput, TResponse = InterruptResult> = {
47
64
  requestSchema: SchemaLike<TRequest>;
@@ -82,9 +99,8 @@ type UseInterruptArgs<TRequest extends InterruptInput = InterruptInput, TRespons
82
99
  type StateSetter<T> = (next: T | ((prev: T) => T)) => void;
83
100
  declare function useStructuredData<TData = unknown>(args: UseStructuredDataArgs<TData>): void;
84
101
  declare function useReason<TOutput = unknown, TRequest extends InterruptInput = InterruptInput, TResponse = InterruptResult>(args: UseReasonArgs<TOutput, TRequest, TResponse>): Promise<UseReasonResult<TOutput, TResponse>>;
85
- declare function useAiMemory(): MemoryAdapter;
86
102
  declare function useInterrupt<TRequest extends InterruptInput = InterruptInput, TResponse = InterruptResult>(args: UseInterruptArgs<TRequest, TResponse>): Promise<TResponse>;
87
103
  declare function useNodeState<T>(initialValue: T): [T, StateSetter<T>];
88
- declare function useWorkflowState<T>(key: string, initialValue?: T): [T, StateSetter<T>];
104
+ declare function useWorkflowState<T>(key: string, ...rest: [] | [T]): [T, StateSetter<T>];
89
105
 
90
- export { type HookRuntimeContext, type UseInterruptArgs, type UseReasonArgs, type UseReasonResult, type UseStructuredDataArgs, runWithHookContext, useAiMemory, useInterrupt, useNodeState, useReason, useStructuredData, useWorkflowState };
106
+ export { type HookRuntimeContext, type UseInterruptArgs, type UseReasonArgs, type UseReasonResult, type UseStructuredDataArgs, runWithHookContext, useInterrupt, useNodeState, useReason, useStructuredData, useWorkflowState };