@kortyx/hooks 0.23.1 → 0.25.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 +26 -0
- package/README.md +14 -1
- package/dist/index.d.ts +17 -3
- package/dist/index.js +471 -169
- package/dist/index.js.map +1 -1
- package/dist/internal.js +30 -9
- package/dist/internal.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.25.0](https://github.com/kortyx-io/kortyx/compare/hooks-v0.24.0...hooks-v0.25.0) (2026-09-14)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* **errors:** public failure messages and default HTTP statuses change; malformed streams fail explicitly, provider error classes are shared, and retry helpers exclude control flow. Existing calls and legacy records remain supported. See the error-contract migration and release notes.
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **errors:** harden failure contracts across execution and recovery ([#175](https://github.com/kortyx-io/kortyx/issues/175)) ([d231e36](https://github.com/kortyx-io/kortyx/commit/d231e364259a4f23fc3675d8783fde5ba338416e))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Dependencies
|
|
16
|
+
|
|
17
|
+
* The following workspace dependencies were updated
|
|
18
|
+
* dependencies
|
|
19
|
+
* @kortyx/core bumped to 0.9.0
|
|
20
|
+
* @kortyx/providers bumped to 0.7.0
|
|
21
|
+
|
|
22
|
+
## [0.24.0](https://github.com/kortyx-io/kortyx/compare/hooks-v0.23.1...hooks-v0.24.0) (2026-09-11)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **hooks:** support durable parallel child workflows ([#171](https://github.com/kortyx-io/kortyx/issues/171)) ([fdf2d56](https://github.com/kortyx-io/kortyx/commit/fdf2d564d88e921988e8f3e20da9fe0c30bbcdf9))
|
|
28
|
+
|
|
3
29
|
## [0.23.1](https://github.com/kortyx-io/kortyx/compare/hooks-v0.23.0...hooks-v0.23.1) (2026-09-11)
|
|
4
30
|
|
|
5
31
|
|
package/README.md
CHANGED
|
@@ -78,6 +78,19 @@ string ids. Register the same definitions with the agent.
|
|
|
78
78
|
Calls need stable ids. A child interrupt pauses the chain; resuming replays
|
|
79
79
|
the enclosing node and reuses saved child results. Keep effects before calls
|
|
80
80
|
idempotent. Fork/rollback retain nested checkpoints; use Redis for persistence
|
|
81
|
-
across server restarts.
|
|
81
|
+
across server restarts. Join concurrent children with `parallel`:
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
const [first, second] = await parallel([
|
|
85
|
+
useWorkflow({ id: "first", workflow: researchWorkflow, input: { topic: "AI" } }),
|
|
86
|
+
useWorkflow({ id: "second", workflow: researchWorkflow, input: { topic: "Robotics" } }),
|
|
87
|
+
]);
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The tuple follows input order. The join preserves all siblings before pausing and
|
|
91
|
+
presents waiting questions individually through the parent handle. Terminal group
|
|
92
|
+
failures throw `ParallelError`, whose `results` exposes each settled outcome.
|
|
93
|
+
Await groups sequentially within one node; children may contain nested groups.
|
|
94
|
+
Native `Promise.all` calls and parallel graph edges remain unsupported.
|
|
82
95
|
|
|
83
96
|
See [the execution and replay contract](../../docs/design-specs/child-workflows.md).
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as _kortyx_core from '@kortyx/core';
|
|
|
2
2
|
import { WorkflowDefinition, TokenUsage, InterruptInput, GraphState, NodeConfig, InterruptResult } from '@kortyx/core';
|
|
3
3
|
import { K as KortyxTelemetryConfig, R as ReasonTraceAdapter, a as KortyxTraceMetadata, b as KortyxTelemetryEventType } from './tracing-BI6YKHSf.js';
|
|
4
4
|
export { E as EnsureWorkflowTopologyRequest, c as EnsureWorkflowTopologyResponse, d as KortyxTelemetryContentCapture, e as KortyxTelemetryCorrelation, f as KortyxTelemetryEvent, g as KortyxTelemetryPrompt, h as KortyxTelemetryReporter, i as KortyxTelemetryService, j as KortyxTraceAdapter, k as ReasonTraceAttributes, l as ReasonTraceSpan, m as ReasonTraceSpanEndArgs, n as ReasonTraceSpanStartArgs } from './tracing-BI6YKHSf.js';
|
|
5
|
+
import { FailureDescriptor, KortyxError } from '@kortyx/core/errors';
|
|
5
6
|
import { z } from 'zod';
|
|
6
7
|
import { ProviderModelRef, KortyxReasoningOptions, KortyxResponseFormat, KortyxExecutableTool, KortyxUsage, KortyxFinishReason, KortyxProviderMetadata, KortyxWarning, KortyxToolCall, KortyxToolResult } from '@kortyx/providers';
|
|
7
8
|
import '@kortyx/telemetry-contracts';
|
|
@@ -13,6 +14,19 @@ type CompleteResponseOptions = {
|
|
|
13
14
|
/** Finish client delivery, leaving the node and workflow execution running. */
|
|
14
15
|
declare function completeResponse(options?: CompleteResponseOptions): Promise<void>;
|
|
15
16
|
|
|
17
|
+
/** All siblings have settled; results retain the order passed to parallel(). */
|
|
18
|
+
declare class ParallelError extends AggregateError {
|
|
19
|
+
readonly results: readonly PromiseSettledResult<unknown>[];
|
|
20
|
+
readonly code = "PARALLEL_FAILED";
|
|
21
|
+
readonly failure: FailureDescriptor;
|
|
22
|
+
toJSON(): FailureDescriptor;
|
|
23
|
+
constructor(results: readonly PromiseSettledResult<unknown>[]);
|
|
24
|
+
}
|
|
25
|
+
/** Join concurrent child calls, preserving their snapshots before suspending. */
|
|
26
|
+
declare function parallel<const T extends readonly unknown[]>(values: T): Promise<{
|
|
27
|
+
-readonly [K in keyof T]: Awaited<T[K]>;
|
|
28
|
+
}>;
|
|
29
|
+
|
|
16
30
|
type WorkflowCallOutcome = {
|
|
17
31
|
status: "completed";
|
|
18
32
|
data: Record<string, unknown>;
|
|
@@ -33,9 +47,9 @@ type WorkflowCallService = (args: {
|
|
|
33
47
|
response?: string | string[] | undefined;
|
|
34
48
|
callerNodeExecutionId?: string | undefined;
|
|
35
49
|
}) => Promise<WorkflowCallOutcome>;
|
|
36
|
-
declare class WorkflowCallError extends
|
|
50
|
+
declare class WorkflowCallError extends KortyxError {
|
|
37
51
|
readonly workflow: string;
|
|
38
|
-
constructor(workflow: string, message: string);
|
|
52
|
+
constructor(workflow: string, message: string, cause?: unknown, failure?: FailureDescriptor);
|
|
39
53
|
}
|
|
40
54
|
declare function workflowCallFingerprint(value: unknown): string;
|
|
41
55
|
type SchematizedWorkflow = WorkflowDefinition & {
|
|
@@ -236,4 +250,4 @@ declare function useWorkflowState<T>(key: string, ...rest: [] | [T]): [T, StateS
|
|
|
236
250
|
/** Best effort lifecycle facts. Engine snapshots and interrupt tokens never leave the runtime. */
|
|
237
251
|
declare function emitWorkflowCall(telemetry: KortyxTelemetryConfig | undefined, type: KortyxTelemetryEventType, payload: Record<string, unknown>): void;
|
|
238
252
|
|
|
239
|
-
export { type CompleteResponseOptions, type HookRuntimeContext, KortyxTelemetryConfig, KortyxTelemetryEventType, KortyxTraceMetadata, ReasonTraceAdapter, type UseInterruptArgs, type UseReasonArgs, type UseReasonResult, type UseReasonStep, type UseReasonToolExecution, type UseStructuredDataArgs, WorkflowCallError, type WorkflowCallOutcome, type WorkflowCallService, completeResponse, createWorkflowHooks, emitWorkflowCall, runWithHookContext, useAbortSignal, useInterrupt, useNodeState, useReason, useRuntimeContext, useStructuredData, useWorkflow, useWorkflowState, workflowCallFingerprint };
|
|
253
|
+
export { type CompleteResponseOptions, type HookRuntimeContext, KortyxTelemetryConfig, KortyxTelemetryEventType, KortyxTraceMetadata, ParallelError, ReasonTraceAdapter, type UseInterruptArgs, type UseReasonArgs, type UseReasonResult, type UseReasonStep, type UseReasonToolExecution, type UseStructuredDataArgs, WorkflowCallError, type WorkflowCallOutcome, type WorkflowCallService, completeResponse, createWorkflowHooks, emitWorkflowCall, parallel, runWithHookContext, useAbortSignal, useInterrupt, useNodeState, useReason, useRuntimeContext, useStructuredData, useWorkflow, useWorkflowState, workflowCallFingerprint };
|