@kortyx/agent 0.18.0 → 0.20.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 +37 -0
- package/dist/index.d.ts +54 -6
- package/dist/index.js +1116 -683
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.20.0](https://github.com/kortyx-io/kortyx/compare/agent-v0.19.0...agent-v0.20.0) (2026-09-11)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* **openai:** OpenAI now defaults to Responses. Select api: chat-completions on the provider or model to keep the previous transport. Raw payloads remain transport-specific.
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **openai:** support Responses reasoning tool workflows ([#167](https://github.com/kortyx-io/kortyx/issues/167)) ([b55ba6e](https://github.com/kortyx-io/kortyx/commit/b55ba6e9a16a6f0f39511c4e60961c41f689abd0))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Dependencies
|
|
16
|
+
|
|
17
|
+
* The following workspace dependencies were updated
|
|
18
|
+
* dependencies
|
|
19
|
+
* @kortyx/providers bumped to 0.6.0
|
|
20
|
+
* @kortyx/runtime bumped to 0.15.1
|
|
21
|
+
* devDependencies
|
|
22
|
+
* @kortyx/hooks bumped to 0.23.0
|
|
23
|
+
|
|
24
|
+
## [0.19.0](https://github.com/kortyx-io/kortyx/compare/agent-v0.18.0...agent-v0.19.0) (2026-09-11)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* complete client responses while workflows continue in background ([#165](https://github.com/kortyx-io/kortyx/issues/165)) ([a8a08cd](https://github.com/kortyx-io/kortyx/commit/a8a08cd1e9533e4b44efa4af54a2d2cec54431ae))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Dependencies
|
|
33
|
+
|
|
34
|
+
* The following workspace dependencies were updated
|
|
35
|
+
* dependencies
|
|
36
|
+
* @kortyx/runtime bumped to 0.15.0
|
|
37
|
+
* devDependencies
|
|
38
|
+
* @kortyx/hooks bumped to 0.22.0
|
|
39
|
+
|
|
3
40
|
## [0.18.0](https://github.com/kortyx-io/kortyx/compare/agent-v0.17.0...agent-v0.18.0) (2026-09-10)
|
|
4
41
|
|
|
5
42
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { WorkflowDefinition, ExecutionLimits, TokenUsage, ExecutionLimitReached, ExecutionBudget, GraphState } from '@kortyx/core';
|
|
2
2
|
import { GetProviderFn } from '@kortyx/providers';
|
|
3
|
-
import { PendingRequestRecord, CheckpointSummary, CheckpointId, SessionCheckpointRecord, RollbackSessionCheckpointResult, ForkSessionCheckpointResult, WorkflowRegistry, FrameworkAdapter, ExecutionRuntimeConfig } from '@kortyx/runtime';
|
|
3
|
+
import { PendingRequestRecord, PendingRequestStore, CheckpointSummary, CheckpointId, SessionCheckpointRecord, RollbackSessionCheckpointResult, ForkSessionCheckpointResult, WorkflowRegistry, FrameworkAdapter, ExecutionRuntimeConfig } from '@kortyx/runtime';
|
|
4
4
|
import { StreamChunk } from '@kortyx/stream';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
+
import * as _kortyx_hooks from '@kortyx/hooks';
|
|
6
7
|
import { KortyxTelemetryConfig, EnsureWorkflowTopologyRequest } from '@kortyx/hooks';
|
|
7
8
|
import { C as ChatMessage } from './browser-wjeg_MwV.js';
|
|
8
9
|
export { S as StreamChatFromRouteArgs, s as streamChatFromRoute } from './browser-wjeg_MwV.js';
|
|
@@ -87,6 +88,42 @@ declare class ExecutionRequestError extends Error {
|
|
|
87
88
|
constructor(code: string, message: string);
|
|
88
89
|
}
|
|
89
90
|
|
|
91
|
+
declare const scopeSchema: z.ZodObject<{
|
|
92
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
93
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
94
|
+
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
|
|
95
|
+
}, z.core.$strict>;
|
|
96
|
+
type InterruptScope = z.input<typeof scopeSchema>;
|
|
97
|
+
type ListInterruptsOptions = InterruptScope & {
|
|
98
|
+
status?: "pending";
|
|
99
|
+
afterResponseCompleted?: boolean;
|
|
100
|
+
};
|
|
101
|
+
type PendingInterrupt = {
|
|
102
|
+
id: string;
|
|
103
|
+
status: "pending";
|
|
104
|
+
runId: string;
|
|
105
|
+
sessionId: string;
|
|
106
|
+
workflow: string;
|
|
107
|
+
node: string;
|
|
108
|
+
createdAt: string;
|
|
109
|
+
expiresAt: string;
|
|
110
|
+
afterResponseCompleted: boolean;
|
|
111
|
+
input: Omit<PendingRequestRecord["schema"], "meta"> & {
|
|
112
|
+
options: Array<{
|
|
113
|
+
id: string;
|
|
114
|
+
label: string;
|
|
115
|
+
description?: string;
|
|
116
|
+
}>;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
type ResumableInterrupt = PendingInterrupt & {
|
|
120
|
+
resume: ResumeHandle;
|
|
121
|
+
};
|
|
122
|
+
declare function createInterruptDiscovery(store: PendingRequestStore): {
|
|
123
|
+
listInterrupts(options: ListInterruptsOptions): Promise<PendingInterrupt[]>;
|
|
124
|
+
getInterrupt(id: string, scope: InterruptScope): Promise<ResumableInterrupt | null>;
|
|
125
|
+
};
|
|
126
|
+
|
|
90
127
|
/** Produces the topology-only, deterministic Contract A snapshot. */
|
|
91
128
|
declare const projectWorkflowTopology: (args: {
|
|
92
129
|
workflow: WorkflowDefinition;
|
|
@@ -96,6 +133,8 @@ declare const projectWorkflowTopology: (args: {
|
|
|
96
133
|
}) => EnsureWorkflowTopologyRequest;
|
|
97
134
|
|
|
98
135
|
interface AgentProcessOptions {
|
|
136
|
+
executionSignal?: AbortSignal | undefined;
|
|
137
|
+
onExecution?: ((completion: Promise<void>) => void) | undefined;
|
|
99
138
|
limits?: ExecutionLimits | undefined;
|
|
100
139
|
abortSignal?: AbortSignal | undefined;
|
|
101
140
|
sessionId?: string | undefined;
|
|
@@ -117,7 +156,7 @@ interface CreateAgentArgs {
|
|
|
117
156
|
frameworkAdapter?: FrameworkAdapter;
|
|
118
157
|
telemetry?: ExecutionRuntimeConfig["telemetry"];
|
|
119
158
|
}
|
|
120
|
-
interface Agent {
|
|
159
|
+
interface Agent extends ReturnType<typeof createInterruptDiscovery> {
|
|
121
160
|
execute<W extends ExecutableWorkflow>(args: ExecuteOptions<W>): Promise<ExecutionResult<z.output<W["outputSchema"]>>>;
|
|
122
161
|
execute(args: {
|
|
123
162
|
limits?: ExecutionLimits;
|
|
@@ -171,10 +210,12 @@ declare function parseChatRequestBody(value: unknown): ChatRequestBody;
|
|
|
171
210
|
declare function parseCheckpointRequestBody(value: unknown): CheckpointRequestBody;
|
|
172
211
|
declare function handleChatRequestBody(args: {
|
|
173
212
|
abortSignal?: AbortSignal | undefined;
|
|
213
|
+
onExecution?: ((completion: Promise<void>) => void) | undefined;
|
|
174
214
|
agent: Agent;
|
|
175
215
|
body: ChatRequestBody;
|
|
176
216
|
}): Promise<Response>;
|
|
177
217
|
declare function createChatRouteHandler(args: {
|
|
218
|
+
onExecution?: ((completion: Promise<void>) => void) | undefined;
|
|
178
219
|
agent: Agent;
|
|
179
220
|
errorStatus?: number | undefined;
|
|
180
221
|
}): (request: Request) => Promise<Response>;
|
|
@@ -193,6 +234,7 @@ interface CompiledGraphLike {
|
|
|
193
234
|
execution?: {
|
|
194
235
|
abortSignal?: AbortSignal | undefined;
|
|
195
236
|
budget?: ExecutionBudget | undefined;
|
|
237
|
+
completeResponse?: ((options: _kortyx_hooks.CompleteResponseOptions, state: GraphState) => Promise<void>) | undefined;
|
|
196
238
|
};
|
|
197
239
|
config?: Record<string, unknown>;
|
|
198
240
|
streamEvents: (state: GraphState, options?: {
|
|
@@ -211,6 +253,8 @@ type OrchestrationOutcome = {
|
|
|
211
253
|
error?: unknown;
|
|
212
254
|
};
|
|
213
255
|
interface OrchestrateArgs {
|
|
256
|
+
executionSignal?: AbortSignal | undefined;
|
|
257
|
+
onExecution?: ((completion: Promise<void>) => void) | undefined;
|
|
214
258
|
abortSignal?: AbortSignal | undefined;
|
|
215
259
|
emitOutput?: boolean | undefined;
|
|
216
260
|
onOutcome?: ((outcome: OrchestrationOutcome) => void) | undefined;
|
|
@@ -227,7 +271,7 @@ interface OrchestrateArgs {
|
|
|
227
271
|
* Orchestrates runtime execution with mid-stream transitions emitted by
|
|
228
272
|
* runtime events.
|
|
229
273
|
*/
|
|
230
|
-
declare function orchestrateGraphStream({ sessionId, runId, graph, state, config: initialConfig, abortSignal: requestSignal, emitOutput, onOutcome, selectWorkflow, knownWorkflowIds, frameworkAdapter, }: OrchestrateArgs): Promise<NodeJS.ReadableStream>;
|
|
274
|
+
declare function orchestrateGraphStream({ sessionId, runId, graph, state, config: initialConfig, abortSignal: requestSignal, executionSignal, onExecution, emitOutput, onOutcome, selectWorkflow, knownWorkflowIds, frameworkAdapter, }: OrchestrateArgs): Promise<NodeJS.ReadableStream>;
|
|
231
275
|
|
|
232
276
|
interface ResumeMeta {
|
|
233
277
|
token: string;
|
|
@@ -243,6 +287,8 @@ declare function parseResumeMeta(msg: ChatMessage | undefined): ResumeMeta | nul
|
|
|
243
287
|
interface TryResumeArgs {
|
|
244
288
|
limits?: ExecutionLimits | undefined;
|
|
245
289
|
abortSignal?: AbortSignal | undefined;
|
|
290
|
+
executionSignal?: AbortSignal | undefined;
|
|
291
|
+
onExecution?: ((completion: Promise<void>) => void) | undefined;
|
|
246
292
|
lastMessage?: ChatMessage | undefined;
|
|
247
293
|
meta?: ResumeMeta | undefined;
|
|
248
294
|
emitOutput?: boolean | undefined;
|
|
@@ -256,7 +302,7 @@ interface TryResumeArgs {
|
|
|
256
302
|
applyResumeSelection?: ApplyResumeSelection;
|
|
257
303
|
frameworkAdapter?: FrameworkAdapter;
|
|
258
304
|
}
|
|
259
|
-
declare function tryPrepareResumeStream({ limits, abortSignal, lastMessage, meta: suppliedMeta, emitOutput, onOutcome, validatePending, sessionId, config, selectWorkflow, knownWorkflowIds, defaultWorkflowId, applyResumeSelection, frameworkAdapter, }: TryResumeArgs): Promise<AsyncIterable<StreamChunk> | null>;
|
|
305
|
+
declare function tryPrepareResumeStream({ limits, abortSignal, executionSignal, onExecution, lastMessage, meta: suppliedMeta, emitOutput, onOutcome, validatePending, sessionId, config, selectWorkflow, knownWorkflowIds, defaultWorkflowId, applyResumeSelection, frameworkAdapter, }: TryResumeArgs): Promise<AsyncIterable<StreamChunk> | null>;
|
|
260
306
|
|
|
261
307
|
interface RuntimeConfig {
|
|
262
308
|
session?: {
|
|
@@ -266,6 +312,8 @@ interface RuntimeConfig {
|
|
|
266
312
|
}
|
|
267
313
|
interface StreamChatArgs<Options> {
|
|
268
314
|
abortSignal?: AbortSignal | undefined;
|
|
315
|
+
executionSignal?: AbortSignal | undefined;
|
|
316
|
+
onExecution?: ((completion: Promise<void>) => void) | undefined;
|
|
269
317
|
messages: ChatMessage[];
|
|
270
318
|
options?: Options | undefined;
|
|
271
319
|
sessionId?: string;
|
|
@@ -278,7 +326,7 @@ interface StreamChatArgs<Options> {
|
|
|
278
326
|
getProvider: GetProviderFn;
|
|
279
327
|
applyResumeSelection?: ApplyResumeSelection;
|
|
280
328
|
}
|
|
281
|
-
declare function streamChat<Options = unknown>({ messages, abortSignal, options, sessionId, defaultWorkflowId, loadRuntimeConfig, selectWorkflow, workflowRegistry, knownWorkflowIds, frameworkAdapter, getProvider, applyResumeSelection, }: StreamChatArgs<Options>): Promise<AsyncIterable<StreamChunk>>;
|
|
329
|
+
declare function streamChat<Options = unknown>({ messages, abortSignal, executionSignal, onExecution, options, sessionId, defaultWorkflowId, loadRuntimeConfig, selectWorkflow, workflowRegistry, knownWorkflowIds, frameworkAdapter, getProvider, applyResumeSelection, }: StreamChatArgs<Options>): Promise<AsyncIterable<StreamChunk>>;
|
|
282
330
|
|
|
283
331
|
interface TransformOptions {
|
|
284
332
|
debug?: boolean;
|
|
@@ -294,4 +342,4 @@ declare function transformGraphStreamForUI(stream: AsyncIterable<StreamEvent>, o
|
|
|
294
342
|
|
|
295
343
|
declare function extractLatestUserMessage(messages: ChatMessage[]): string;
|
|
296
344
|
|
|
297
|
-
export { type Agent, type AgentProcessOptions, type AgentProjectTopologyOptions, type ApplyResumeSelection, ChatMessage, type ChatRequestBody, type CheckpointRequestBody, type CompiledGraphLike, type CreateAgentArgs, type ExecutableWorkflow, type ExecuteOptions, type ExecutionInfo, type ExecutionInterrupt, ExecutionRequestError, type ExecutionResult, type OrchestrateArgs, type ResumeHandle, type ResumeMeta, type ResumeOptions, type ResumeResponse, type SaveMemoryFn, type SelectWorkflowFn, type StreamChatArgs, createAgent, createChatRouteHandler, createCheckpointRouteHandler, extractLatestUserMessage, handleChatRequestBody, handleCheckpointRequestBody, orchestrateGraphStream, parseChatRequestBody, parseCheckpointRequestBody, parseResumeMeta, projectWorkflowTopology, streamChat, transformGraphStreamForUI, tryPrepareResumeStream };
|
|
345
|
+
export { type Agent, type AgentProcessOptions, type AgentProjectTopologyOptions, type ApplyResumeSelection, ChatMessage, type ChatRequestBody, type CheckpointRequestBody, type CompiledGraphLike, type CreateAgentArgs, type ExecutableWorkflow, type ExecuteOptions, type ExecutionInfo, type ExecutionInterrupt, ExecutionRequestError, type ExecutionResult, type InterruptScope, type ListInterruptsOptions, type OrchestrateArgs, type PendingInterrupt, type ResumableInterrupt, type ResumeHandle, type ResumeMeta, type ResumeOptions, type ResumeResponse, type SaveMemoryFn, type SelectWorkflowFn, type StreamChatArgs, createAgent, createChatRouteHandler, createCheckpointRouteHandler, extractLatestUserMessage, handleChatRequestBody, handleCheckpointRequestBody, orchestrateGraphStream, parseChatRequestBody, parseCheckpointRequestBody, parseResumeMeta, projectWorkflowTopology, streamChat, transformGraphStreamForUI, tryPrepareResumeStream };
|