@runtypelabs/sdk 1.17.1 → 1.18.1
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/README.md +2 -2
- package/dist/index.cjs +20 -28
- package/dist/index.d.cts +73 -21
- package/dist/index.d.ts +73 -21
- package/dist/index.mjs +20 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -98,7 +98,7 @@ const summary = await runtype
|
|
|
98
98
|
{ streamResponse: true },
|
|
99
99
|
{
|
|
100
100
|
onStepStart: (event) => console.log('Starting:', event.name),
|
|
101
|
-
|
|
101
|
+
onStepDelta: (text) => process.stdout.write(text),
|
|
102
102
|
onStepComplete: (result, event) => console.log('Done:', event.name),
|
|
103
103
|
onFlowComplete: (event) => console.log('Complete!'),
|
|
104
104
|
}
|
|
@@ -184,7 +184,7 @@ const allResults = await flowResult.getAllResults()
|
|
|
184
184
|
interface StreamCallbacks {
|
|
185
185
|
onFlowStart?: (event: FlowStartEvent) => void
|
|
186
186
|
onStepStart?: (event: StepStartEvent) => void
|
|
187
|
-
|
|
187
|
+
onStepDelta?: (text: string, event: StepDeltaEvent) => void
|
|
188
188
|
onStepComplete?: (result: any, event: StepCompleteEvent) => void
|
|
189
189
|
onFlowComplete?: (event: FlowCompleteEvent) => void
|
|
190
190
|
onError?: (error: Error) => void
|
package/dist/index.cjs
CHANGED
|
@@ -189,13 +189,9 @@ function handleEvent(event, callbacks, results, summary) {
|
|
|
189
189
|
case "step_start":
|
|
190
190
|
callbacks.onStepStart?.(event);
|
|
191
191
|
break;
|
|
192
|
-
case "step_delta":
|
|
193
|
-
|
|
194
|
-
const deltaEvent = event;
|
|
195
|
-
callbacks.onStepDelta?.(chunkText, deltaEvent);
|
|
196
|
-
callbacks.onStepChunk?.(chunkText, deltaEvent);
|
|
192
|
+
case "step_delta":
|
|
193
|
+
callbacks.onStepDelta?.(event.text, event);
|
|
197
194
|
break;
|
|
198
|
-
}
|
|
199
195
|
case "step_complete":
|
|
200
196
|
results.set(event.name, event.result);
|
|
201
197
|
callbacks.onStepComplete?.(event.result, event);
|
|
@@ -253,10 +249,6 @@ async function* streamEvents(response) {
|
|
|
253
249
|
for (const eventStr of events) {
|
|
254
250
|
try {
|
|
255
251
|
const event = JSON.parse(eventStr);
|
|
256
|
-
if (event.type === "step_delta" && "text" in event && !("chunk" in event)) {
|
|
257
|
-
;
|
|
258
|
-
event.chunk = event.text;
|
|
259
|
-
}
|
|
260
252
|
yield event;
|
|
261
253
|
} catch {
|
|
262
254
|
}
|
|
@@ -266,10 +258,6 @@ async function* streamEvents(response) {
|
|
|
266
258
|
if (finalEvent) {
|
|
267
259
|
try {
|
|
268
260
|
const event = JSON.parse(finalEvent);
|
|
269
|
-
if (event.type === "step_delta" && "text" in event && !("chunk" in event)) {
|
|
270
|
-
;
|
|
271
|
-
event.chunk = event.text;
|
|
272
|
-
}
|
|
273
261
|
yield event;
|
|
274
262
|
} catch {
|
|
275
263
|
}
|
|
@@ -379,7 +367,7 @@ var FlowResult = class {
|
|
|
379
367
|
* ```typescript
|
|
380
368
|
* const summary = await result.stream({
|
|
381
369
|
* onStepStart: (event) => console.log('Starting:', event.name),
|
|
382
|
-
*
|
|
370
|
+
* onStepDelta: (text) => process.stdout.write(text),
|
|
383
371
|
* onStepComplete: (result, event) => console.log('Done:', event.name),
|
|
384
372
|
* onFlowComplete: (event) => console.log('Flow complete!'),
|
|
385
373
|
* })
|
|
@@ -983,7 +971,7 @@ var RuntypeFlowBuilder = class {
|
|
|
983
971
|
...callbacks,
|
|
984
972
|
onFlowStart: (event) => callbacks?.onFlowStart?.(event),
|
|
985
973
|
onStepStart: (event) => callbacks?.onStepStart?.(event),
|
|
986
|
-
|
|
974
|
+
onStepDelta: (text, event) => callbacks?.onStepDelta?.(text, event),
|
|
987
975
|
onStepComplete: (result, event) => callbacks?.onStepComplete?.(result, event),
|
|
988
976
|
onFlowComplete: (event) => callbacks?.onFlowComplete?.(event),
|
|
989
977
|
onError: (error) => callbacks?.onError?.(error)
|
|
@@ -1013,11 +1001,9 @@ var RuntypeFlowBuilder = class {
|
|
|
1013
1001
|
case "step_start":
|
|
1014
1002
|
wrappedCallbacks.onStepStart?.(event);
|
|
1015
1003
|
break;
|
|
1016
|
-
case "step_delta":
|
|
1017
|
-
|
|
1018
|
-
wrappedCallbacks.onStepChunk?.(chunkText, event);
|
|
1004
|
+
case "step_delta":
|
|
1005
|
+
wrappedCallbacks.onStepDelta?.(event.text, event);
|
|
1019
1006
|
break;
|
|
1020
|
-
}
|
|
1021
1007
|
case "step_complete": {
|
|
1022
1008
|
accumulatedSummary.results?.set(event.name, event.result);
|
|
1023
1009
|
wrappedCallbacks.onStepComplete?.(event.result, event);
|
|
@@ -1467,7 +1453,7 @@ var PromptRunner = class {
|
|
|
1467
1453
|
*
|
|
1468
1454
|
* // Process with callbacks
|
|
1469
1455
|
* await result.stream({
|
|
1470
|
-
*
|
|
1456
|
+
* onStepDelta: (text) => process.stdout.write(text),
|
|
1471
1457
|
* onFlowComplete: () => console.log('Done!'),
|
|
1472
1458
|
* })
|
|
1473
1459
|
* ```
|
|
@@ -4376,6 +4362,15 @@ function dispatchAgentEvent(event, callbacks) {
|
|
|
4376
4362
|
case "agent_tool_complete":
|
|
4377
4363
|
callbacks.onToolComplete?.(typedData);
|
|
4378
4364
|
break;
|
|
4365
|
+
case "agent_media":
|
|
4366
|
+
callbacks.onMedia?.(typedData);
|
|
4367
|
+
break;
|
|
4368
|
+
case "agent_approval_start":
|
|
4369
|
+
callbacks.onApprovalStart?.(typedData);
|
|
4370
|
+
break;
|
|
4371
|
+
case "agent_approval_complete":
|
|
4372
|
+
callbacks.onApprovalComplete?.(typedData);
|
|
4373
|
+
break;
|
|
4379
4374
|
case "agent_iteration_complete":
|
|
4380
4375
|
callbacks.onIterationComplete?.(typedData);
|
|
4381
4376
|
break;
|
|
@@ -7671,7 +7666,7 @@ var ClientFlowBuilder = class extends FlowBuilder {
|
|
|
7671
7666
|
};
|
|
7672
7667
|
function isStreamCallbacks(obj) {
|
|
7673
7668
|
if (!obj || typeof obj !== "object") return false;
|
|
7674
|
-
return "onFlowStart" in obj || "onStepStart" in obj || "onStepDelta" in obj || "
|
|
7669
|
+
return "onFlowStart" in obj || "onStepStart" in obj || "onStepDelta" in obj || "onStepComplete" in obj || "onFlowComplete" in obj || "onError" in obj;
|
|
7675
7670
|
}
|
|
7676
7671
|
function createExternalTool(config) {
|
|
7677
7672
|
return {
|
|
@@ -7786,7 +7781,7 @@ var RuntypeClient2 = class {
|
|
|
7786
7781
|
...callbacks,
|
|
7787
7782
|
onFlowStart: (event) => callbacks?.onFlowStart?.(event),
|
|
7788
7783
|
onStepStart: (event) => callbacks?.onStepStart?.(event),
|
|
7789
|
-
|
|
7784
|
+
onStepDelta: (text, event) => callbacks?.onStepDelta?.(text, event),
|
|
7790
7785
|
onStepComplete: (result, event) => callbacks?.onStepComplete?.(result, event),
|
|
7791
7786
|
onFlowComplete: (event) => callbacks?.onFlowComplete?.(event),
|
|
7792
7787
|
onError: (error) => callbacks?.onError?.(error)
|
|
@@ -7821,12 +7816,9 @@ var RuntypeClient2 = class {
|
|
|
7821
7816
|
case "step_start":
|
|
7822
7817
|
wrappedCallbacks.onStepStart?.(event);
|
|
7823
7818
|
break;
|
|
7824
|
-
case "step_delta":
|
|
7825
|
-
|
|
7826
|
-
const chunkText = deltaEvent.chunk || deltaEvent.text || "";
|
|
7827
|
-
wrappedCallbacks.onStepChunk?.(chunkText, deltaEvent);
|
|
7819
|
+
case "step_delta":
|
|
7820
|
+
wrappedCallbacks.onStepDelta?.(event.text, event);
|
|
7828
7821
|
break;
|
|
7829
|
-
}
|
|
7830
7822
|
case "step_complete": {
|
|
7831
7823
|
summary.results?.set(event.name, event.result);
|
|
7832
7824
|
wrappedCallbacks.onStepComplete?.(event.result, event);
|
package/dist/index.d.cts
CHANGED
|
@@ -376,7 +376,8 @@ interface Tool {
|
|
|
376
376
|
}
|
|
377
377
|
type ToolConfig = FlowToolConfig | CustomToolConfig | ExternalToolConfig | LocalToolConfig | SubagentToolConfig;
|
|
378
378
|
interface FlowToolConfig {
|
|
379
|
-
flowId
|
|
379
|
+
flowId?: string;
|
|
380
|
+
toolId?: string;
|
|
380
381
|
parameterMapping: Record<string, string>;
|
|
381
382
|
outputMapping?: string;
|
|
382
383
|
}
|
|
@@ -428,7 +429,7 @@ interface BuiltInTool {
|
|
|
428
429
|
id: string;
|
|
429
430
|
name: string;
|
|
430
431
|
description: string;
|
|
431
|
-
category: 'image_generation' | 'web_search' | 'web_scraping' | 'code_execution' | 'file_operations' | 'data_analysis' | 'knowledge_retrieval' | 'text_to_speech' | 'voice_processing' | 'third_party_api' | 'artifact' | 'data_management' | 'commerce';
|
|
432
|
+
category: 'image_generation' | 'web_search' | 'web_scraping' | 'code_execution' | 'file_operations' | 'data_analysis' | 'knowledge_retrieval' | 'text_to_speech' | 'voice_processing' | 'third_party_api' | 'artifact' | 'data_management' | 'commerce' | 'browser';
|
|
432
433
|
providers: string[];
|
|
433
434
|
parametersSchema: JSONSchema;
|
|
434
435
|
defaultConfig?: JsonObject;
|
|
@@ -596,7 +597,8 @@ interface RuntimeLocalToolConfig {
|
|
|
596
597
|
[key: string]: JsonValue;
|
|
597
598
|
}
|
|
598
599
|
interface RuntimeFlowToolConfig {
|
|
599
|
-
flowId
|
|
600
|
+
flowId?: string;
|
|
601
|
+
toolId?: string;
|
|
600
602
|
parameterMapping?: Record<string, string>;
|
|
601
603
|
outputMapping?: string;
|
|
602
604
|
}
|
|
@@ -1278,11 +1280,10 @@ interface StepStartEvent {
|
|
|
1278
1280
|
interface StepDeltaEvent {
|
|
1279
1281
|
type: 'step_delta';
|
|
1280
1282
|
id: string;
|
|
1281
|
-
chunk: string;
|
|
1282
1283
|
index: number;
|
|
1284
|
+
/** Streaming text fragment. */
|
|
1285
|
+
text: string;
|
|
1283
1286
|
}
|
|
1284
|
-
/** @deprecated Use StepDeltaEvent instead */
|
|
1285
|
-
type StepChunkEvent = StepDeltaEvent;
|
|
1286
1287
|
interface StepCompleteEvent {
|
|
1287
1288
|
type: 'step_complete';
|
|
1288
1289
|
id: string;
|
|
@@ -1329,13 +1330,8 @@ interface StreamCallbacks {
|
|
|
1329
1330
|
onFlowStart?: (event: FlowStartEvent) => void;
|
|
1330
1331
|
/** Called when a step starts executing */
|
|
1331
1332
|
onStepStart?: (event: StepStartEvent) => void;
|
|
1332
|
-
/** Called for each
|
|
1333
|
-
onStepDelta?: (
|
|
1334
|
-
/**
|
|
1335
|
-
* @deprecated Use onStepDelta instead
|
|
1336
|
-
* Called for each chunk of streaming output from a step
|
|
1337
|
-
*/
|
|
1338
|
-
onStepChunk?: (chunk: string, event: StepDeltaEvent) => void;
|
|
1333
|
+
/** Called for each text fragment of streaming output from a step */
|
|
1334
|
+
onStepDelta?: (text: string, event: StepDeltaEvent) => void;
|
|
1339
1335
|
/** Called when a step completes */
|
|
1340
1336
|
onStepComplete?: (result: any, event: StepCompleteEvent) => void;
|
|
1341
1337
|
/** Called when the entire flow completes */
|
|
@@ -1735,7 +1731,7 @@ declare function createExternalTool(config: {
|
|
|
1735
1731
|
*
|
|
1736
1732
|
* // Option 1: Process with callbacks
|
|
1737
1733
|
* const summary = await result.stream({
|
|
1738
|
-
*
|
|
1734
|
+
* onStepDelta: (text) => process.stdout.write(text),
|
|
1739
1735
|
* })
|
|
1740
1736
|
*
|
|
1741
1737
|
* // Option 2: Just get a specific step's result
|
|
@@ -1771,7 +1767,7 @@ declare class FlowResult {
|
|
|
1771
1767
|
* ```typescript
|
|
1772
1768
|
* const summary = await result.stream({
|
|
1773
1769
|
* onStepStart: (event) => console.log('Starting:', event.name),
|
|
1774
|
-
*
|
|
1770
|
+
* onStepDelta: (text) => process.stdout.write(text),
|
|
1775
1771
|
* onStepComplete: (result, event) => console.log('Done:', event.name),
|
|
1776
1772
|
* onFlowComplete: (event) => console.log('Flow complete!'),
|
|
1777
1773
|
* })
|
|
@@ -2232,7 +2228,7 @@ declare class RuntypeFlowBuilder {
|
|
|
2232
2228
|
*
|
|
2233
2229
|
* // Process with callbacks
|
|
2234
2230
|
* await result.stream({
|
|
2235
|
-
*
|
|
2231
|
+
* onStepDelta: (text) => process.stdout.write(text),
|
|
2236
2232
|
* onFlowComplete: () => console.log('Done!'),
|
|
2237
2233
|
* })
|
|
2238
2234
|
*
|
|
@@ -2769,7 +2765,7 @@ declare class PromptRunner {
|
|
|
2769
2765
|
*
|
|
2770
2766
|
* // Process with callbacks
|
|
2771
2767
|
* await result.stream({
|
|
2772
|
-
*
|
|
2768
|
+
* onStepDelta: (text) => process.stdout.write(text),
|
|
2773
2769
|
* onFlowComplete: () => console.log('Done!'),
|
|
2774
2770
|
* })
|
|
2775
2771
|
* ```
|
|
@@ -4116,7 +4112,7 @@ declare class ClientTokensEndpoint {
|
|
|
4116
4112
|
/**
|
|
4117
4113
|
* Agent event types for streaming
|
|
4118
4114
|
*/
|
|
4119
|
-
type AgentEventType = 'agent_start' | 'agent_iteration_start' | 'agent_turn_start' | 'agent_turn_delta' | 'agent_turn_complete' | 'agent_tool_start' | 'agent_tool_delta' | 'agent_tool_input_delta' | 'agent_tool_input_complete' | 'agent_tool_complete' | 'agent_iteration_complete' | 'agent_reflection' | 'agent_complete' | 'agent_error' | 'agent_ping' | 'agent_await';
|
|
4115
|
+
type AgentEventType = 'agent_start' | 'agent_iteration_start' | 'agent_turn_start' | 'agent_turn_delta' | 'agent_turn_complete' | 'agent_tool_start' | 'agent_tool_delta' | 'agent_tool_input_delta' | 'agent_tool_input_complete' | 'agent_tool_complete' | 'agent_media' | 'agent_approval_start' | 'agent_approval_complete' | 'agent_iteration_complete' | 'agent_reflection' | 'agent_complete' | 'agent_error' | 'agent_ping' | 'agent_await';
|
|
4120
4116
|
/**
|
|
4121
4117
|
* Base agent event with common fields
|
|
4122
4118
|
*/
|
|
@@ -4247,6 +4243,59 @@ interface AgentToolCompleteEvent extends BaseAgentEvent {
|
|
|
4247
4243
|
result?: unknown;
|
|
4248
4244
|
executionTime?: number;
|
|
4249
4245
|
}
|
|
4246
|
+
interface AgentMediaEvent extends BaseAgentEvent {
|
|
4247
|
+
type: 'agent_media';
|
|
4248
|
+
iteration: number;
|
|
4249
|
+
toolCallId: string;
|
|
4250
|
+
toolName: string;
|
|
4251
|
+
media: Array<{
|
|
4252
|
+
type: 'media';
|
|
4253
|
+
data: string;
|
|
4254
|
+
mediaType: string;
|
|
4255
|
+
annotations?: {
|
|
4256
|
+
audience?: ('user' | 'assistant')[];
|
|
4257
|
+
};
|
|
4258
|
+
} | {
|
|
4259
|
+
type: 'image-url';
|
|
4260
|
+
url: string;
|
|
4261
|
+
mediaType?: string;
|
|
4262
|
+
annotations?: {
|
|
4263
|
+
audience?: ('user' | 'assistant')[];
|
|
4264
|
+
};
|
|
4265
|
+
} | {
|
|
4266
|
+
type: 'file-url';
|
|
4267
|
+
url: string;
|
|
4268
|
+
mediaType: string;
|
|
4269
|
+
annotations?: {
|
|
4270
|
+
audience?: ('user' | 'assistant')[];
|
|
4271
|
+
};
|
|
4272
|
+
}>;
|
|
4273
|
+
}
|
|
4274
|
+
/**
|
|
4275
|
+
* Agent approval start event — execution paused waiting for user approval.
|
|
4276
|
+
*/
|
|
4277
|
+
interface AgentApprovalStartEvent extends BaseAgentEvent {
|
|
4278
|
+
type: 'agent_approval_start';
|
|
4279
|
+
approvalId: string;
|
|
4280
|
+
iteration?: number;
|
|
4281
|
+
toolCallId: string;
|
|
4282
|
+
toolName: string;
|
|
4283
|
+
toolType: string;
|
|
4284
|
+
description: string;
|
|
4285
|
+
parameters?: Record<string, unknown>;
|
|
4286
|
+
timeout: number;
|
|
4287
|
+
startedAt: string;
|
|
4288
|
+
}
|
|
4289
|
+
/**
|
|
4290
|
+
* Agent approval complete event — user or system resolved the approval.
|
|
4291
|
+
*/
|
|
4292
|
+
interface AgentApprovalCompleteEvent extends BaseAgentEvent {
|
|
4293
|
+
type: 'agent_approval_complete';
|
|
4294
|
+
approvalId: string;
|
|
4295
|
+
decision: 'approved' | 'denied' | 'timeout';
|
|
4296
|
+
completedAt: string;
|
|
4297
|
+
resolvedBy: 'user' | 'system';
|
|
4298
|
+
}
|
|
4250
4299
|
/**
|
|
4251
4300
|
* Agent iteration complete event
|
|
4252
4301
|
*/
|
|
@@ -4312,7 +4361,7 @@ interface AgentPingEvent extends BaseAgentEvent {
|
|
|
4312
4361
|
timestamp: string;
|
|
4313
4362
|
}
|
|
4314
4363
|
/**
|
|
4315
|
-
*
|
|
4364
|
+
* API-emitted agent await event for local tools that must execute on the client.
|
|
4316
4365
|
*/
|
|
4317
4366
|
interface AgentPausedEvent extends BaseAgentEvent {
|
|
4318
4367
|
type: 'agent_await';
|
|
@@ -4349,7 +4398,7 @@ interface LocalToolExecutionCompleteEvent {
|
|
|
4349
4398
|
/**
|
|
4350
4399
|
* Union of all agent event types
|
|
4351
4400
|
*/
|
|
4352
|
-
type AgentEvent = AgentStartEvent | AgentIterationStartEvent | AgentTurnStartEvent | AgentTurnDeltaEvent | AgentTurnCompleteEvent | AgentToolStartEvent | AgentToolDeltaEvent | AgentToolInputDeltaEvent | AgentToolInputCompleteEvent | AgentToolCompleteEvent | AgentIterationCompleteEvent | AgentReflectionEvent | AgentCompleteEvent | AgentErrorEvent | AgentPingEvent | AgentPausedEvent;
|
|
4401
|
+
type AgentEvent = AgentStartEvent | AgentIterationStartEvent | AgentTurnStartEvent | AgentTurnDeltaEvent | AgentTurnCompleteEvent | AgentToolStartEvent | AgentToolDeltaEvent | AgentToolInputDeltaEvent | AgentToolInputCompleteEvent | AgentToolCompleteEvent | AgentMediaEvent | AgentApprovalStartEvent | AgentApprovalCompleteEvent | AgentIterationCompleteEvent | AgentReflectionEvent | AgentCompleteEvent | AgentErrorEvent | AgentPingEvent | AgentPausedEvent;
|
|
4353
4402
|
/**
|
|
4354
4403
|
* Parsed SSE event with event type and data
|
|
4355
4404
|
*/
|
|
@@ -4371,6 +4420,9 @@ interface AgentStreamCallbacks {
|
|
|
4371
4420
|
onToolInputDelta?: (event: AgentToolInputDeltaEvent) => void;
|
|
4372
4421
|
onToolInputComplete?: (event: AgentToolInputCompleteEvent) => void;
|
|
4373
4422
|
onToolComplete?: (event: AgentToolCompleteEvent) => void;
|
|
4423
|
+
onMedia?: (event: AgentMediaEvent) => void;
|
|
4424
|
+
onApprovalStart?: (event: AgentApprovalStartEvent) => void;
|
|
4425
|
+
onApprovalComplete?: (event: AgentApprovalCompleteEvent) => void;
|
|
4374
4426
|
onIterationComplete?: (event: AgentIterationCompleteEvent) => void;
|
|
4375
4427
|
onReflection?: (event: AgentReflectionEvent) => void;
|
|
4376
4428
|
onAgentComplete?: (event: AgentCompleteEvent) => void;
|
|
@@ -5656,4 +5708,4 @@ declare function getLikelySupportingCandidatePaths(bestCandidatePath: string | u
|
|
|
5656
5708
|
declare function getDefaultPlanPath(taskName: string): string;
|
|
5657
5709
|
declare function sanitizeTaskSlug(taskName: string): string;
|
|
5658
5710
|
|
|
5659
|
-
export { type Agent, type AgentCompleteEvent, type AgentErrorEvent, type AgentEvent, type AgentEventType, type AgentExecuteRequest, type AgentExecuteResponse, type AgentIterationCompleteEvent, type AgentIterationStartEvent, type AgentMessage, type AgentPausedEvent, type AgentPingEvent, type AgentReflectionEvent, type AgentRuntimeToolDefinition, type AgentStartEvent, type AgentStreamCallbacks, type AgentSubagentConfig, type AgentToolCompleteEvent, type AgentToolDeltaEvent, type AgentToolInputCompleteEvent, type AgentToolInputDeltaEvent, type AgentToolStartEvent, type AgentTurnCompleteEvent, type AgentTurnDeltaEvent, type AgentTurnStartEvent, AgentsEndpoint, AnalyticsEndpoint, type ApiClient, type ApiKey, ApiKeysEndpoint, type ApiResponse, type ApplyGeneratedProposalOptions, type ApplyGeneratedProposalResult, type AttachRuntimeToolsOptions, type BaseAgentEvent, BatchBuilder, type BatchClient, type BatchListParams, type BatchOptions, type BatchRequest, type BatchResult, type BatchScheduleConfig, type BatchStatus, BatchesNamespace, type BuiltInTool, type BulkEditCondition, type BulkEditRequest, type BulkEditResponse, type BulkEditResult, ChatEndpoint, ClientBatchBuilder, type ClientConfig, type ClientConversation, ClientEvalBuilder, ClientFlowBuilder, type ClientToken, type ClientTokenConfig, type ClientTokenEnvironment, type ClientTokenVersionPin, ClientTokensEndpoint, type ClientWidgetTheme, type ConditionalStepConfig$1 as ConditionalStepConfig, type ContextErrorHandling, type ContextFallback, ContextTemplatesEndpoint, type CreateApiKeyRequest, type CreateClientTokenRequest, type CreateClientTokenResponse, type CreateFlowRequest, type CreateModelConfigRequest, type CreatePromptData, type CreatePromptRequest, type CreateProviderKeyRequest, type CreateRecordRequest, type CreateToolRequest, type CustomMCPServer, type CustomMCPServerAuth, type CustomToolConfig, type DeployCfSandboxRequest, type DeployCfSandboxResponse, type DeploySandboxRequest, type DeploySandboxResponse, type DispatchClient, DispatchEndpoint, type DispatchEnvironment, type DispatchOptions$1 as DispatchOptions, type DispatchRequest, type ErrorHandlingMode, EvalBuilder, type EvalClient, EvalEndpoint, type EvalListParams, type EvalOptions, type EvalRecord, type EvalRequest, type EvalResult, type EvalRunConfig, EvalRunner, type EvalStatus, EvalsNamespace, type ExecuteToolRequest, type ExecuteToolResponse, type ExternalToolConfig, type FallbackFailEvent, type FallbackStartEvent, type FallbackSuccessEvent, type FallbacksExhaustedEvent, type FallbacksInitiatedEvent, type FetchGitHubStepConfig$1 as FetchGitHubStepConfig, type FetchUrlStepConfig$1 as FetchUrlStepConfig, type FileContentPart, type Flow, type FlowAttachment, FlowBuilder, type FlowCompleteEvent, type FlowConfig$1 as FlowConfig, type FlowErrorEvent, type FlowFallback, type FlowPausedEvent, FlowResult, type FlowStartEvent, type FlowStep, FlowStepsEndpoint, type FlowSummary, type FlowToolConfig, FlowsEndpoint, FlowsNamespace, type GenerateEmbeddingStepConfig$1 as GenerateEmbeddingStepConfig, type GeneratedRuntimeToolGateDecision, type GeneratedRuntimeToolGateOptions, type ImageContentPart, type JSONSchema, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type ListConversationsResponse, type ListParams, type LocalToolConfig, type LocalToolDefinition, type LocalToolExecutionCompleteEvent, type LocalToolExecutionLoopSnapshotSlice, type LocalToolExecutionStartEvent, type Message$1 as Message, type MessageContent, type Metadata, type ModelConfig, ModelConfigsEndpoint, type ModelFallback, type ModelOverride, type ModelUsageDetail, type ModelUsageQueryParams, type ModelUsageResponse, type ModelUsageSummary, type ModelUsageTimeSeries, type PaginationResponse, type Prompt$1 as Prompt, type PromptErrorHandling, type PromptFallback, type PromptListParams, type PromptRunOptions, PromptRunner, type PromptStepConfig$1 as PromptStepConfig, PromptsEndpoint, PromptsNamespace, type ProviderApiKey, type ReasoningConfig, type ReasoningValue, type RecordConfig$1 as RecordConfig, type RecordListParams, RecordsEndpoint, type RetrieveRecordStepConfig$1 as RetrieveRecordStepConfig, type RetryFallback, type RunTaskContextBudgetBreakdown, type RunTaskContextCompactionEvent, type RunTaskContextCompactionStrategy, type RunTaskContextNoticeEvent, type RunTaskContinuation, type RunTaskOnContextCompaction, type RunTaskOnContextNotice, type RunTaskOnSession, type RunTaskOptions, type RunTaskResult, type RunTaskResumeState, type RunTaskSessionSummary, type RunTaskState, type RunTaskStateSlice, type RunTaskStatus, type RunTaskToolTraceSlice, type RuntimeCustomToolConfig, type RuntimeExternalToolConfig, type RuntimeFlowToolConfig, type RuntimeLocalToolConfig, type RuntimeSubagentToolConfig, type RuntimeTool, type RuntimeToolConfig, Runtype, RuntypeApiError, RuntypeClient, type ConditionalStepConfig as RuntypeConditionalStepConfig, type RuntypeConfig, type FetchGitHubStepConfig as RuntypeFetchGitHubStepConfig, type FetchUrlStepConfig as RuntypeFetchUrlStepConfig, RuntypeFlowBuilder, type FlowConfig as RuntypeFlowConfig, type GenerateEmbeddingStepConfig as RuntypeGenerateEmbeddingStepConfig, type Message as RuntypeMessage, type ModelOverride$1 as RuntypeModelOverride, type Prompt as RuntypePrompt, type PromptStepConfig as RuntypePromptStepConfig, type RuntypeRecord, type RecordConfig as RuntypeRecordConfig, type RetrieveRecordStepConfig as RuntypeRetrieveRecordStepConfig, type SearchStepConfig as RuntypeSearchStepConfig, type SendEmailStepConfig as RuntypeSendEmailStepConfig, type SendEventStepConfig as RuntypeSendEventStepConfig, type SendStreamStepConfig as RuntypeSendStreamStepConfig, type SendTextStepConfig as RuntypeSendTextStepConfig, type SetVariableStepConfig as RuntypeSetVariableStepConfig, type TransformDataStepConfig as RuntypeTransformDataStepConfig, type UpsertFlowConfig as RuntypeUpsertFlowConfig, type UpsertRecordStepConfig as RuntypeUpsertRecordStepConfig, type VectorSearchStepConfig as RuntypeVectorSearchStepConfig, type WaitUntilStepConfig as RuntypeWaitUntilStepConfig, type SearchStepConfig$1 as SearchStepConfig, type SendEmailStepConfig$1 as SendEmailStepConfig, type SendEventStepConfig$1 as SendEventStepConfig, type SendStreamStepConfig$1 as SendStreamStepConfig, type SendTextStepConfig$1 as SendTextStepConfig, type SetVariableStepConfig$1 as SetVariableStepConfig, type
|
|
5711
|
+
export { type Agent, type AgentApprovalCompleteEvent, type AgentApprovalStartEvent, type AgentCompleteEvent, type AgentErrorEvent, type AgentEvent, type AgentEventType, type AgentExecuteRequest, type AgentExecuteResponse, type AgentIterationCompleteEvent, type AgentIterationStartEvent, type AgentMediaEvent, type AgentMessage, type AgentPausedEvent, type AgentPingEvent, type AgentReflectionEvent, type AgentRuntimeToolDefinition, type AgentStartEvent, type AgentStreamCallbacks, type AgentSubagentConfig, type AgentToolCompleteEvent, type AgentToolDeltaEvent, type AgentToolInputCompleteEvent, type AgentToolInputDeltaEvent, type AgentToolStartEvent, type AgentTurnCompleteEvent, type AgentTurnDeltaEvent, type AgentTurnStartEvent, AgentsEndpoint, AnalyticsEndpoint, type ApiClient, type ApiKey, ApiKeysEndpoint, type ApiResponse, type ApplyGeneratedProposalOptions, type ApplyGeneratedProposalResult, type AttachRuntimeToolsOptions, type BaseAgentEvent, BatchBuilder, type BatchClient, type BatchListParams, type BatchOptions, type BatchRequest, type BatchResult, type BatchScheduleConfig, type BatchStatus, BatchesNamespace, type BuiltInTool, type BulkEditCondition, type BulkEditRequest, type BulkEditResponse, type BulkEditResult, ChatEndpoint, ClientBatchBuilder, type ClientConfig, type ClientConversation, ClientEvalBuilder, ClientFlowBuilder, type ClientToken, type ClientTokenConfig, type ClientTokenEnvironment, type ClientTokenVersionPin, ClientTokensEndpoint, type ClientWidgetTheme, type ConditionalStepConfig$1 as ConditionalStepConfig, type ContextErrorHandling, type ContextFallback, ContextTemplatesEndpoint, type CreateApiKeyRequest, type CreateClientTokenRequest, type CreateClientTokenResponse, type CreateFlowRequest, type CreateModelConfigRequest, type CreatePromptData, type CreatePromptRequest, type CreateProviderKeyRequest, type CreateRecordRequest, type CreateToolRequest, type CustomMCPServer, type CustomMCPServerAuth, type CustomToolConfig, type DeployCfSandboxRequest, type DeployCfSandboxResponse, type DeploySandboxRequest, type DeploySandboxResponse, type DispatchClient, DispatchEndpoint, type DispatchEnvironment, type DispatchOptions$1 as DispatchOptions, type DispatchRequest, type ErrorHandlingMode, EvalBuilder, type EvalClient, EvalEndpoint, type EvalListParams, type EvalOptions, type EvalRecord, type EvalRequest, type EvalResult, type EvalRunConfig, EvalRunner, type EvalStatus, EvalsNamespace, type ExecuteToolRequest, type ExecuteToolResponse, type ExternalToolConfig, type FallbackFailEvent, type FallbackStartEvent, type FallbackSuccessEvent, type FallbacksExhaustedEvent, type FallbacksInitiatedEvent, type FetchGitHubStepConfig$1 as FetchGitHubStepConfig, type FetchUrlStepConfig$1 as FetchUrlStepConfig, type FileContentPart, type Flow, type FlowAttachment, FlowBuilder, type FlowCompleteEvent, type FlowConfig$1 as FlowConfig, type FlowErrorEvent, type FlowFallback, type FlowPausedEvent, FlowResult, type FlowStartEvent, type FlowStep, FlowStepsEndpoint, type FlowSummary, type FlowToolConfig, FlowsEndpoint, FlowsNamespace, type GenerateEmbeddingStepConfig$1 as GenerateEmbeddingStepConfig, type GeneratedRuntimeToolGateDecision, type GeneratedRuntimeToolGateOptions, type ImageContentPart, type JSONSchema, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type ListConversationsResponse, type ListParams, type LocalToolConfig, type LocalToolDefinition, type LocalToolExecutionCompleteEvent, type LocalToolExecutionLoopSnapshotSlice, type LocalToolExecutionStartEvent, type Message$1 as Message, type MessageContent, type Metadata, type ModelConfig, ModelConfigsEndpoint, type ModelFallback, type ModelOverride, type ModelUsageDetail, type ModelUsageQueryParams, type ModelUsageResponse, type ModelUsageSummary, type ModelUsageTimeSeries, type PaginationResponse, type Prompt$1 as Prompt, type PromptErrorHandling, type PromptFallback, type PromptListParams, type PromptRunOptions, PromptRunner, type PromptStepConfig$1 as PromptStepConfig, PromptsEndpoint, PromptsNamespace, type ProviderApiKey, type ReasoningConfig, type ReasoningValue, type RecordConfig$1 as RecordConfig, type RecordListParams, RecordsEndpoint, type RetrieveRecordStepConfig$1 as RetrieveRecordStepConfig, type RetryFallback, type RunTaskContextBudgetBreakdown, type RunTaskContextCompactionEvent, type RunTaskContextCompactionStrategy, type RunTaskContextNoticeEvent, type RunTaskContinuation, type RunTaskOnContextCompaction, type RunTaskOnContextNotice, type RunTaskOnSession, type RunTaskOptions, type RunTaskResult, type RunTaskResumeState, type RunTaskSessionSummary, type RunTaskState, type RunTaskStateSlice, type RunTaskStatus, type RunTaskToolTraceSlice, type RuntimeCustomToolConfig, type RuntimeExternalToolConfig, type RuntimeFlowToolConfig, type RuntimeLocalToolConfig, type RuntimeSubagentToolConfig, type RuntimeTool, type RuntimeToolConfig, Runtype, RuntypeApiError, RuntypeClient, type ConditionalStepConfig as RuntypeConditionalStepConfig, type RuntypeConfig, type FetchGitHubStepConfig as RuntypeFetchGitHubStepConfig, type FetchUrlStepConfig as RuntypeFetchUrlStepConfig, RuntypeFlowBuilder, type FlowConfig as RuntypeFlowConfig, type GenerateEmbeddingStepConfig as RuntypeGenerateEmbeddingStepConfig, type Message as RuntypeMessage, type ModelOverride$1 as RuntypeModelOverride, type Prompt as RuntypePrompt, type PromptStepConfig as RuntypePromptStepConfig, type RuntypeRecord, type RecordConfig as RuntypeRecordConfig, type RetrieveRecordStepConfig as RuntypeRetrieveRecordStepConfig, type SearchStepConfig as RuntypeSearchStepConfig, type SendEmailStepConfig as RuntypeSendEmailStepConfig, type SendEventStepConfig as RuntypeSendEventStepConfig, type SendStreamStepConfig as RuntypeSendStreamStepConfig, type SendTextStepConfig as RuntypeSendTextStepConfig, type SetVariableStepConfig as RuntypeSetVariableStepConfig, type TransformDataStepConfig as RuntypeTransformDataStepConfig, type UpsertFlowConfig as RuntypeUpsertFlowConfig, type UpsertRecordStepConfig as RuntypeUpsertRecordStepConfig, type VectorSearchStepConfig as RuntypeVectorSearchStepConfig, type WaitUntilStepConfig as RuntypeWaitUntilStepConfig, type SearchStepConfig$1 as SearchStepConfig, type SendEmailStepConfig$1 as SendEmailStepConfig, type SendEventStepConfig$1 as SendEventStepConfig, type SendStreamStepConfig$1 as SendStreamStepConfig, type SendTextStepConfig$1 as SendTextStepConfig, type SetVariableStepConfig$1 as SetVariableStepConfig, type StepCompleteEvent, type StepDeltaEvent, type StepFallback, type StepStartEvent, type StepWaitingLocalEvent, type StreamCallbacks, type StreamEvent, type SubagentToolConfig, type TextContentPart, type Tool, type ToolConfig, type ToolExecution, type ToolsConfig, ToolsEndpoint, type TransformDataStepConfig$1 as TransformDataStepConfig, type UpdateClientTokenRequest, type UpdatePromptData, type UpdateProviderKeyRequest, type UpdateToolRequest, type UpsertFlowConfig$1 as UpsertFlowConfig, type UpsertOptions$2 as UpsertOptions, type UpsertRecordStepConfig$1 as UpsertRecordStepConfig, type UserProfile, UsersEndpoint, type VectorSearchStepConfig$1 as VectorSearchStepConfig, type WaitUntilStepConfig$1 as WaitUntilStepConfig, type WorkflowContext, type WorkflowDefinition, type WorkflowPhase, applyGeneratedRuntimeToolProposalToDispatchRequest, attachRuntimeToolsToDispatchRequest, buildGeneratedRuntimeToolGateOutput, createClient, createExternalTool, defaultWorkflow, deployWorkflow, evaluateGeneratedRuntimeToolProposal, gameWorkflow, getDefaultPlanPath, getLikelySupportingCandidatePaths, isDiscoveryToolName, isMarathonArtifactPath, isPreservationSensitiveTask, normalizeCandidatePath, parseFinalBuffer, parseSSEChunk, processStream, sanitizeTaskSlug, streamEvents };
|
package/dist/index.d.ts
CHANGED
|
@@ -376,7 +376,8 @@ interface Tool {
|
|
|
376
376
|
}
|
|
377
377
|
type ToolConfig = FlowToolConfig | CustomToolConfig | ExternalToolConfig | LocalToolConfig | SubagentToolConfig;
|
|
378
378
|
interface FlowToolConfig {
|
|
379
|
-
flowId
|
|
379
|
+
flowId?: string;
|
|
380
|
+
toolId?: string;
|
|
380
381
|
parameterMapping: Record<string, string>;
|
|
381
382
|
outputMapping?: string;
|
|
382
383
|
}
|
|
@@ -428,7 +429,7 @@ interface BuiltInTool {
|
|
|
428
429
|
id: string;
|
|
429
430
|
name: string;
|
|
430
431
|
description: string;
|
|
431
|
-
category: 'image_generation' | 'web_search' | 'web_scraping' | 'code_execution' | 'file_operations' | 'data_analysis' | 'knowledge_retrieval' | 'text_to_speech' | 'voice_processing' | 'third_party_api' | 'artifact' | 'data_management' | 'commerce';
|
|
432
|
+
category: 'image_generation' | 'web_search' | 'web_scraping' | 'code_execution' | 'file_operations' | 'data_analysis' | 'knowledge_retrieval' | 'text_to_speech' | 'voice_processing' | 'third_party_api' | 'artifact' | 'data_management' | 'commerce' | 'browser';
|
|
432
433
|
providers: string[];
|
|
433
434
|
parametersSchema: JSONSchema;
|
|
434
435
|
defaultConfig?: JsonObject;
|
|
@@ -596,7 +597,8 @@ interface RuntimeLocalToolConfig {
|
|
|
596
597
|
[key: string]: JsonValue;
|
|
597
598
|
}
|
|
598
599
|
interface RuntimeFlowToolConfig {
|
|
599
|
-
flowId
|
|
600
|
+
flowId?: string;
|
|
601
|
+
toolId?: string;
|
|
600
602
|
parameterMapping?: Record<string, string>;
|
|
601
603
|
outputMapping?: string;
|
|
602
604
|
}
|
|
@@ -1278,11 +1280,10 @@ interface StepStartEvent {
|
|
|
1278
1280
|
interface StepDeltaEvent {
|
|
1279
1281
|
type: 'step_delta';
|
|
1280
1282
|
id: string;
|
|
1281
|
-
chunk: string;
|
|
1282
1283
|
index: number;
|
|
1284
|
+
/** Streaming text fragment. */
|
|
1285
|
+
text: string;
|
|
1283
1286
|
}
|
|
1284
|
-
/** @deprecated Use StepDeltaEvent instead */
|
|
1285
|
-
type StepChunkEvent = StepDeltaEvent;
|
|
1286
1287
|
interface StepCompleteEvent {
|
|
1287
1288
|
type: 'step_complete';
|
|
1288
1289
|
id: string;
|
|
@@ -1329,13 +1330,8 @@ interface StreamCallbacks {
|
|
|
1329
1330
|
onFlowStart?: (event: FlowStartEvent) => void;
|
|
1330
1331
|
/** Called when a step starts executing */
|
|
1331
1332
|
onStepStart?: (event: StepStartEvent) => void;
|
|
1332
|
-
/** Called for each
|
|
1333
|
-
onStepDelta?: (
|
|
1334
|
-
/**
|
|
1335
|
-
* @deprecated Use onStepDelta instead
|
|
1336
|
-
* Called for each chunk of streaming output from a step
|
|
1337
|
-
*/
|
|
1338
|
-
onStepChunk?: (chunk: string, event: StepDeltaEvent) => void;
|
|
1333
|
+
/** Called for each text fragment of streaming output from a step */
|
|
1334
|
+
onStepDelta?: (text: string, event: StepDeltaEvent) => void;
|
|
1339
1335
|
/** Called when a step completes */
|
|
1340
1336
|
onStepComplete?: (result: any, event: StepCompleteEvent) => void;
|
|
1341
1337
|
/** Called when the entire flow completes */
|
|
@@ -1735,7 +1731,7 @@ declare function createExternalTool(config: {
|
|
|
1735
1731
|
*
|
|
1736
1732
|
* // Option 1: Process with callbacks
|
|
1737
1733
|
* const summary = await result.stream({
|
|
1738
|
-
*
|
|
1734
|
+
* onStepDelta: (text) => process.stdout.write(text),
|
|
1739
1735
|
* })
|
|
1740
1736
|
*
|
|
1741
1737
|
* // Option 2: Just get a specific step's result
|
|
@@ -1771,7 +1767,7 @@ declare class FlowResult {
|
|
|
1771
1767
|
* ```typescript
|
|
1772
1768
|
* const summary = await result.stream({
|
|
1773
1769
|
* onStepStart: (event) => console.log('Starting:', event.name),
|
|
1774
|
-
*
|
|
1770
|
+
* onStepDelta: (text) => process.stdout.write(text),
|
|
1775
1771
|
* onStepComplete: (result, event) => console.log('Done:', event.name),
|
|
1776
1772
|
* onFlowComplete: (event) => console.log('Flow complete!'),
|
|
1777
1773
|
* })
|
|
@@ -2232,7 +2228,7 @@ declare class RuntypeFlowBuilder {
|
|
|
2232
2228
|
*
|
|
2233
2229
|
* // Process with callbacks
|
|
2234
2230
|
* await result.stream({
|
|
2235
|
-
*
|
|
2231
|
+
* onStepDelta: (text) => process.stdout.write(text),
|
|
2236
2232
|
* onFlowComplete: () => console.log('Done!'),
|
|
2237
2233
|
* })
|
|
2238
2234
|
*
|
|
@@ -2769,7 +2765,7 @@ declare class PromptRunner {
|
|
|
2769
2765
|
*
|
|
2770
2766
|
* // Process with callbacks
|
|
2771
2767
|
* await result.stream({
|
|
2772
|
-
*
|
|
2768
|
+
* onStepDelta: (text) => process.stdout.write(text),
|
|
2773
2769
|
* onFlowComplete: () => console.log('Done!'),
|
|
2774
2770
|
* })
|
|
2775
2771
|
* ```
|
|
@@ -4116,7 +4112,7 @@ declare class ClientTokensEndpoint {
|
|
|
4116
4112
|
/**
|
|
4117
4113
|
* Agent event types for streaming
|
|
4118
4114
|
*/
|
|
4119
|
-
type AgentEventType = 'agent_start' | 'agent_iteration_start' | 'agent_turn_start' | 'agent_turn_delta' | 'agent_turn_complete' | 'agent_tool_start' | 'agent_tool_delta' | 'agent_tool_input_delta' | 'agent_tool_input_complete' | 'agent_tool_complete' | 'agent_iteration_complete' | 'agent_reflection' | 'agent_complete' | 'agent_error' | 'agent_ping' | 'agent_await';
|
|
4115
|
+
type AgentEventType = 'agent_start' | 'agent_iteration_start' | 'agent_turn_start' | 'agent_turn_delta' | 'agent_turn_complete' | 'agent_tool_start' | 'agent_tool_delta' | 'agent_tool_input_delta' | 'agent_tool_input_complete' | 'agent_tool_complete' | 'agent_media' | 'agent_approval_start' | 'agent_approval_complete' | 'agent_iteration_complete' | 'agent_reflection' | 'agent_complete' | 'agent_error' | 'agent_ping' | 'agent_await';
|
|
4120
4116
|
/**
|
|
4121
4117
|
* Base agent event with common fields
|
|
4122
4118
|
*/
|
|
@@ -4247,6 +4243,59 @@ interface AgentToolCompleteEvent extends BaseAgentEvent {
|
|
|
4247
4243
|
result?: unknown;
|
|
4248
4244
|
executionTime?: number;
|
|
4249
4245
|
}
|
|
4246
|
+
interface AgentMediaEvent extends BaseAgentEvent {
|
|
4247
|
+
type: 'agent_media';
|
|
4248
|
+
iteration: number;
|
|
4249
|
+
toolCallId: string;
|
|
4250
|
+
toolName: string;
|
|
4251
|
+
media: Array<{
|
|
4252
|
+
type: 'media';
|
|
4253
|
+
data: string;
|
|
4254
|
+
mediaType: string;
|
|
4255
|
+
annotations?: {
|
|
4256
|
+
audience?: ('user' | 'assistant')[];
|
|
4257
|
+
};
|
|
4258
|
+
} | {
|
|
4259
|
+
type: 'image-url';
|
|
4260
|
+
url: string;
|
|
4261
|
+
mediaType?: string;
|
|
4262
|
+
annotations?: {
|
|
4263
|
+
audience?: ('user' | 'assistant')[];
|
|
4264
|
+
};
|
|
4265
|
+
} | {
|
|
4266
|
+
type: 'file-url';
|
|
4267
|
+
url: string;
|
|
4268
|
+
mediaType: string;
|
|
4269
|
+
annotations?: {
|
|
4270
|
+
audience?: ('user' | 'assistant')[];
|
|
4271
|
+
};
|
|
4272
|
+
}>;
|
|
4273
|
+
}
|
|
4274
|
+
/**
|
|
4275
|
+
* Agent approval start event — execution paused waiting for user approval.
|
|
4276
|
+
*/
|
|
4277
|
+
interface AgentApprovalStartEvent extends BaseAgentEvent {
|
|
4278
|
+
type: 'agent_approval_start';
|
|
4279
|
+
approvalId: string;
|
|
4280
|
+
iteration?: number;
|
|
4281
|
+
toolCallId: string;
|
|
4282
|
+
toolName: string;
|
|
4283
|
+
toolType: string;
|
|
4284
|
+
description: string;
|
|
4285
|
+
parameters?: Record<string, unknown>;
|
|
4286
|
+
timeout: number;
|
|
4287
|
+
startedAt: string;
|
|
4288
|
+
}
|
|
4289
|
+
/**
|
|
4290
|
+
* Agent approval complete event — user or system resolved the approval.
|
|
4291
|
+
*/
|
|
4292
|
+
interface AgentApprovalCompleteEvent extends BaseAgentEvent {
|
|
4293
|
+
type: 'agent_approval_complete';
|
|
4294
|
+
approvalId: string;
|
|
4295
|
+
decision: 'approved' | 'denied' | 'timeout';
|
|
4296
|
+
completedAt: string;
|
|
4297
|
+
resolvedBy: 'user' | 'system';
|
|
4298
|
+
}
|
|
4250
4299
|
/**
|
|
4251
4300
|
* Agent iteration complete event
|
|
4252
4301
|
*/
|
|
@@ -4312,7 +4361,7 @@ interface AgentPingEvent extends BaseAgentEvent {
|
|
|
4312
4361
|
timestamp: string;
|
|
4313
4362
|
}
|
|
4314
4363
|
/**
|
|
4315
|
-
*
|
|
4364
|
+
* API-emitted agent await event for local tools that must execute on the client.
|
|
4316
4365
|
*/
|
|
4317
4366
|
interface AgentPausedEvent extends BaseAgentEvent {
|
|
4318
4367
|
type: 'agent_await';
|
|
@@ -4349,7 +4398,7 @@ interface LocalToolExecutionCompleteEvent {
|
|
|
4349
4398
|
/**
|
|
4350
4399
|
* Union of all agent event types
|
|
4351
4400
|
*/
|
|
4352
|
-
type AgentEvent = AgentStartEvent | AgentIterationStartEvent | AgentTurnStartEvent | AgentTurnDeltaEvent | AgentTurnCompleteEvent | AgentToolStartEvent | AgentToolDeltaEvent | AgentToolInputDeltaEvent | AgentToolInputCompleteEvent | AgentToolCompleteEvent | AgentIterationCompleteEvent | AgentReflectionEvent | AgentCompleteEvent | AgentErrorEvent | AgentPingEvent | AgentPausedEvent;
|
|
4401
|
+
type AgentEvent = AgentStartEvent | AgentIterationStartEvent | AgentTurnStartEvent | AgentTurnDeltaEvent | AgentTurnCompleteEvent | AgentToolStartEvent | AgentToolDeltaEvent | AgentToolInputDeltaEvent | AgentToolInputCompleteEvent | AgentToolCompleteEvent | AgentMediaEvent | AgentApprovalStartEvent | AgentApprovalCompleteEvent | AgentIterationCompleteEvent | AgentReflectionEvent | AgentCompleteEvent | AgentErrorEvent | AgentPingEvent | AgentPausedEvent;
|
|
4353
4402
|
/**
|
|
4354
4403
|
* Parsed SSE event with event type and data
|
|
4355
4404
|
*/
|
|
@@ -4371,6 +4420,9 @@ interface AgentStreamCallbacks {
|
|
|
4371
4420
|
onToolInputDelta?: (event: AgentToolInputDeltaEvent) => void;
|
|
4372
4421
|
onToolInputComplete?: (event: AgentToolInputCompleteEvent) => void;
|
|
4373
4422
|
onToolComplete?: (event: AgentToolCompleteEvent) => void;
|
|
4423
|
+
onMedia?: (event: AgentMediaEvent) => void;
|
|
4424
|
+
onApprovalStart?: (event: AgentApprovalStartEvent) => void;
|
|
4425
|
+
onApprovalComplete?: (event: AgentApprovalCompleteEvent) => void;
|
|
4374
4426
|
onIterationComplete?: (event: AgentIterationCompleteEvent) => void;
|
|
4375
4427
|
onReflection?: (event: AgentReflectionEvent) => void;
|
|
4376
4428
|
onAgentComplete?: (event: AgentCompleteEvent) => void;
|
|
@@ -5656,4 +5708,4 @@ declare function getLikelySupportingCandidatePaths(bestCandidatePath: string | u
|
|
|
5656
5708
|
declare function getDefaultPlanPath(taskName: string): string;
|
|
5657
5709
|
declare function sanitizeTaskSlug(taskName: string): string;
|
|
5658
5710
|
|
|
5659
|
-
export { type Agent, type AgentCompleteEvent, type AgentErrorEvent, type AgentEvent, type AgentEventType, type AgentExecuteRequest, type AgentExecuteResponse, type AgentIterationCompleteEvent, type AgentIterationStartEvent, type AgentMessage, type AgentPausedEvent, type AgentPingEvent, type AgentReflectionEvent, type AgentRuntimeToolDefinition, type AgentStartEvent, type AgentStreamCallbacks, type AgentSubagentConfig, type AgentToolCompleteEvent, type AgentToolDeltaEvent, type AgentToolInputCompleteEvent, type AgentToolInputDeltaEvent, type AgentToolStartEvent, type AgentTurnCompleteEvent, type AgentTurnDeltaEvent, type AgentTurnStartEvent, AgentsEndpoint, AnalyticsEndpoint, type ApiClient, type ApiKey, ApiKeysEndpoint, type ApiResponse, type ApplyGeneratedProposalOptions, type ApplyGeneratedProposalResult, type AttachRuntimeToolsOptions, type BaseAgentEvent, BatchBuilder, type BatchClient, type BatchListParams, type BatchOptions, type BatchRequest, type BatchResult, type BatchScheduleConfig, type BatchStatus, BatchesNamespace, type BuiltInTool, type BulkEditCondition, type BulkEditRequest, type BulkEditResponse, type BulkEditResult, ChatEndpoint, ClientBatchBuilder, type ClientConfig, type ClientConversation, ClientEvalBuilder, ClientFlowBuilder, type ClientToken, type ClientTokenConfig, type ClientTokenEnvironment, type ClientTokenVersionPin, ClientTokensEndpoint, type ClientWidgetTheme, type ConditionalStepConfig$1 as ConditionalStepConfig, type ContextErrorHandling, type ContextFallback, ContextTemplatesEndpoint, type CreateApiKeyRequest, type CreateClientTokenRequest, type CreateClientTokenResponse, type CreateFlowRequest, type CreateModelConfigRequest, type CreatePromptData, type CreatePromptRequest, type CreateProviderKeyRequest, type CreateRecordRequest, type CreateToolRequest, type CustomMCPServer, type CustomMCPServerAuth, type CustomToolConfig, type DeployCfSandboxRequest, type DeployCfSandboxResponse, type DeploySandboxRequest, type DeploySandboxResponse, type DispatchClient, DispatchEndpoint, type DispatchEnvironment, type DispatchOptions$1 as DispatchOptions, type DispatchRequest, type ErrorHandlingMode, EvalBuilder, type EvalClient, EvalEndpoint, type EvalListParams, type EvalOptions, type EvalRecord, type EvalRequest, type EvalResult, type EvalRunConfig, EvalRunner, type EvalStatus, EvalsNamespace, type ExecuteToolRequest, type ExecuteToolResponse, type ExternalToolConfig, type FallbackFailEvent, type FallbackStartEvent, type FallbackSuccessEvent, type FallbacksExhaustedEvent, type FallbacksInitiatedEvent, type FetchGitHubStepConfig$1 as FetchGitHubStepConfig, type FetchUrlStepConfig$1 as FetchUrlStepConfig, type FileContentPart, type Flow, type FlowAttachment, FlowBuilder, type FlowCompleteEvent, type FlowConfig$1 as FlowConfig, type FlowErrorEvent, type FlowFallback, type FlowPausedEvent, FlowResult, type FlowStartEvent, type FlowStep, FlowStepsEndpoint, type FlowSummary, type FlowToolConfig, FlowsEndpoint, FlowsNamespace, type GenerateEmbeddingStepConfig$1 as GenerateEmbeddingStepConfig, type GeneratedRuntimeToolGateDecision, type GeneratedRuntimeToolGateOptions, type ImageContentPart, type JSONSchema, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type ListConversationsResponse, type ListParams, type LocalToolConfig, type LocalToolDefinition, type LocalToolExecutionCompleteEvent, type LocalToolExecutionLoopSnapshotSlice, type LocalToolExecutionStartEvent, type Message$1 as Message, type MessageContent, type Metadata, type ModelConfig, ModelConfigsEndpoint, type ModelFallback, type ModelOverride, type ModelUsageDetail, type ModelUsageQueryParams, type ModelUsageResponse, type ModelUsageSummary, type ModelUsageTimeSeries, type PaginationResponse, type Prompt$1 as Prompt, type PromptErrorHandling, type PromptFallback, type PromptListParams, type PromptRunOptions, PromptRunner, type PromptStepConfig$1 as PromptStepConfig, PromptsEndpoint, PromptsNamespace, type ProviderApiKey, type ReasoningConfig, type ReasoningValue, type RecordConfig$1 as RecordConfig, type RecordListParams, RecordsEndpoint, type RetrieveRecordStepConfig$1 as RetrieveRecordStepConfig, type RetryFallback, type RunTaskContextBudgetBreakdown, type RunTaskContextCompactionEvent, type RunTaskContextCompactionStrategy, type RunTaskContextNoticeEvent, type RunTaskContinuation, type RunTaskOnContextCompaction, type RunTaskOnContextNotice, type RunTaskOnSession, type RunTaskOptions, type RunTaskResult, type RunTaskResumeState, type RunTaskSessionSummary, type RunTaskState, type RunTaskStateSlice, type RunTaskStatus, type RunTaskToolTraceSlice, type RuntimeCustomToolConfig, type RuntimeExternalToolConfig, type RuntimeFlowToolConfig, type RuntimeLocalToolConfig, type RuntimeSubagentToolConfig, type RuntimeTool, type RuntimeToolConfig, Runtype, RuntypeApiError, RuntypeClient, type ConditionalStepConfig as RuntypeConditionalStepConfig, type RuntypeConfig, type FetchGitHubStepConfig as RuntypeFetchGitHubStepConfig, type FetchUrlStepConfig as RuntypeFetchUrlStepConfig, RuntypeFlowBuilder, type FlowConfig as RuntypeFlowConfig, type GenerateEmbeddingStepConfig as RuntypeGenerateEmbeddingStepConfig, type Message as RuntypeMessage, type ModelOverride$1 as RuntypeModelOverride, type Prompt as RuntypePrompt, type PromptStepConfig as RuntypePromptStepConfig, type RuntypeRecord, type RecordConfig as RuntypeRecordConfig, type RetrieveRecordStepConfig as RuntypeRetrieveRecordStepConfig, type SearchStepConfig as RuntypeSearchStepConfig, type SendEmailStepConfig as RuntypeSendEmailStepConfig, type SendEventStepConfig as RuntypeSendEventStepConfig, type SendStreamStepConfig as RuntypeSendStreamStepConfig, type SendTextStepConfig as RuntypeSendTextStepConfig, type SetVariableStepConfig as RuntypeSetVariableStepConfig, type TransformDataStepConfig as RuntypeTransformDataStepConfig, type UpsertFlowConfig as RuntypeUpsertFlowConfig, type UpsertRecordStepConfig as RuntypeUpsertRecordStepConfig, type VectorSearchStepConfig as RuntypeVectorSearchStepConfig, type WaitUntilStepConfig as RuntypeWaitUntilStepConfig, type SearchStepConfig$1 as SearchStepConfig, type SendEmailStepConfig$1 as SendEmailStepConfig, type SendEventStepConfig$1 as SendEventStepConfig, type SendStreamStepConfig$1 as SendStreamStepConfig, type SendTextStepConfig$1 as SendTextStepConfig, type SetVariableStepConfig$1 as SetVariableStepConfig, type
|
|
5711
|
+
export { type Agent, type AgentApprovalCompleteEvent, type AgentApprovalStartEvent, type AgentCompleteEvent, type AgentErrorEvent, type AgentEvent, type AgentEventType, type AgentExecuteRequest, type AgentExecuteResponse, type AgentIterationCompleteEvent, type AgentIterationStartEvent, type AgentMediaEvent, type AgentMessage, type AgentPausedEvent, type AgentPingEvent, type AgentReflectionEvent, type AgentRuntimeToolDefinition, type AgentStartEvent, type AgentStreamCallbacks, type AgentSubagentConfig, type AgentToolCompleteEvent, type AgentToolDeltaEvent, type AgentToolInputCompleteEvent, type AgentToolInputDeltaEvent, type AgentToolStartEvent, type AgentTurnCompleteEvent, type AgentTurnDeltaEvent, type AgentTurnStartEvent, AgentsEndpoint, AnalyticsEndpoint, type ApiClient, type ApiKey, ApiKeysEndpoint, type ApiResponse, type ApplyGeneratedProposalOptions, type ApplyGeneratedProposalResult, type AttachRuntimeToolsOptions, type BaseAgentEvent, BatchBuilder, type BatchClient, type BatchListParams, type BatchOptions, type BatchRequest, type BatchResult, type BatchScheduleConfig, type BatchStatus, BatchesNamespace, type BuiltInTool, type BulkEditCondition, type BulkEditRequest, type BulkEditResponse, type BulkEditResult, ChatEndpoint, ClientBatchBuilder, type ClientConfig, type ClientConversation, ClientEvalBuilder, ClientFlowBuilder, type ClientToken, type ClientTokenConfig, type ClientTokenEnvironment, type ClientTokenVersionPin, ClientTokensEndpoint, type ClientWidgetTheme, type ConditionalStepConfig$1 as ConditionalStepConfig, type ContextErrorHandling, type ContextFallback, ContextTemplatesEndpoint, type CreateApiKeyRequest, type CreateClientTokenRequest, type CreateClientTokenResponse, type CreateFlowRequest, type CreateModelConfigRequest, type CreatePromptData, type CreatePromptRequest, type CreateProviderKeyRequest, type CreateRecordRequest, type CreateToolRequest, type CustomMCPServer, type CustomMCPServerAuth, type CustomToolConfig, type DeployCfSandboxRequest, type DeployCfSandboxResponse, type DeploySandboxRequest, type DeploySandboxResponse, type DispatchClient, DispatchEndpoint, type DispatchEnvironment, type DispatchOptions$1 as DispatchOptions, type DispatchRequest, type ErrorHandlingMode, EvalBuilder, type EvalClient, EvalEndpoint, type EvalListParams, type EvalOptions, type EvalRecord, type EvalRequest, type EvalResult, type EvalRunConfig, EvalRunner, type EvalStatus, EvalsNamespace, type ExecuteToolRequest, type ExecuteToolResponse, type ExternalToolConfig, type FallbackFailEvent, type FallbackStartEvent, type FallbackSuccessEvent, type FallbacksExhaustedEvent, type FallbacksInitiatedEvent, type FetchGitHubStepConfig$1 as FetchGitHubStepConfig, type FetchUrlStepConfig$1 as FetchUrlStepConfig, type FileContentPart, type Flow, type FlowAttachment, FlowBuilder, type FlowCompleteEvent, type FlowConfig$1 as FlowConfig, type FlowErrorEvent, type FlowFallback, type FlowPausedEvent, FlowResult, type FlowStartEvent, type FlowStep, FlowStepsEndpoint, type FlowSummary, type FlowToolConfig, FlowsEndpoint, FlowsNamespace, type GenerateEmbeddingStepConfig$1 as GenerateEmbeddingStepConfig, type GeneratedRuntimeToolGateDecision, type GeneratedRuntimeToolGateOptions, type ImageContentPart, type JSONSchema, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type ListConversationsResponse, type ListParams, type LocalToolConfig, type LocalToolDefinition, type LocalToolExecutionCompleteEvent, type LocalToolExecutionLoopSnapshotSlice, type LocalToolExecutionStartEvent, type Message$1 as Message, type MessageContent, type Metadata, type ModelConfig, ModelConfigsEndpoint, type ModelFallback, type ModelOverride, type ModelUsageDetail, type ModelUsageQueryParams, type ModelUsageResponse, type ModelUsageSummary, type ModelUsageTimeSeries, type PaginationResponse, type Prompt$1 as Prompt, type PromptErrorHandling, type PromptFallback, type PromptListParams, type PromptRunOptions, PromptRunner, type PromptStepConfig$1 as PromptStepConfig, PromptsEndpoint, PromptsNamespace, type ProviderApiKey, type ReasoningConfig, type ReasoningValue, type RecordConfig$1 as RecordConfig, type RecordListParams, RecordsEndpoint, type RetrieveRecordStepConfig$1 as RetrieveRecordStepConfig, type RetryFallback, type RunTaskContextBudgetBreakdown, type RunTaskContextCompactionEvent, type RunTaskContextCompactionStrategy, type RunTaskContextNoticeEvent, type RunTaskContinuation, type RunTaskOnContextCompaction, type RunTaskOnContextNotice, type RunTaskOnSession, type RunTaskOptions, type RunTaskResult, type RunTaskResumeState, type RunTaskSessionSummary, type RunTaskState, type RunTaskStateSlice, type RunTaskStatus, type RunTaskToolTraceSlice, type RuntimeCustomToolConfig, type RuntimeExternalToolConfig, type RuntimeFlowToolConfig, type RuntimeLocalToolConfig, type RuntimeSubagentToolConfig, type RuntimeTool, type RuntimeToolConfig, Runtype, RuntypeApiError, RuntypeClient, type ConditionalStepConfig as RuntypeConditionalStepConfig, type RuntypeConfig, type FetchGitHubStepConfig as RuntypeFetchGitHubStepConfig, type FetchUrlStepConfig as RuntypeFetchUrlStepConfig, RuntypeFlowBuilder, type FlowConfig as RuntypeFlowConfig, type GenerateEmbeddingStepConfig as RuntypeGenerateEmbeddingStepConfig, type Message as RuntypeMessage, type ModelOverride$1 as RuntypeModelOverride, type Prompt as RuntypePrompt, type PromptStepConfig as RuntypePromptStepConfig, type RuntypeRecord, type RecordConfig as RuntypeRecordConfig, type RetrieveRecordStepConfig as RuntypeRetrieveRecordStepConfig, type SearchStepConfig as RuntypeSearchStepConfig, type SendEmailStepConfig as RuntypeSendEmailStepConfig, type SendEventStepConfig as RuntypeSendEventStepConfig, type SendStreamStepConfig as RuntypeSendStreamStepConfig, type SendTextStepConfig as RuntypeSendTextStepConfig, type SetVariableStepConfig as RuntypeSetVariableStepConfig, type TransformDataStepConfig as RuntypeTransformDataStepConfig, type UpsertFlowConfig as RuntypeUpsertFlowConfig, type UpsertRecordStepConfig as RuntypeUpsertRecordStepConfig, type VectorSearchStepConfig as RuntypeVectorSearchStepConfig, type WaitUntilStepConfig as RuntypeWaitUntilStepConfig, type SearchStepConfig$1 as SearchStepConfig, type SendEmailStepConfig$1 as SendEmailStepConfig, type SendEventStepConfig$1 as SendEventStepConfig, type SendStreamStepConfig$1 as SendStreamStepConfig, type SendTextStepConfig$1 as SendTextStepConfig, type SetVariableStepConfig$1 as SetVariableStepConfig, type StepCompleteEvent, type StepDeltaEvent, type StepFallback, type StepStartEvent, type StepWaitingLocalEvent, type StreamCallbacks, type StreamEvent, type SubagentToolConfig, type TextContentPart, type Tool, type ToolConfig, type ToolExecution, type ToolsConfig, ToolsEndpoint, type TransformDataStepConfig$1 as TransformDataStepConfig, type UpdateClientTokenRequest, type UpdatePromptData, type UpdateProviderKeyRequest, type UpdateToolRequest, type UpsertFlowConfig$1 as UpsertFlowConfig, type UpsertOptions$2 as UpsertOptions, type UpsertRecordStepConfig$1 as UpsertRecordStepConfig, type UserProfile, UsersEndpoint, type VectorSearchStepConfig$1 as VectorSearchStepConfig, type WaitUntilStepConfig$1 as WaitUntilStepConfig, type WorkflowContext, type WorkflowDefinition, type WorkflowPhase, applyGeneratedRuntimeToolProposalToDispatchRequest, attachRuntimeToolsToDispatchRequest, buildGeneratedRuntimeToolGateOutput, createClient, createExternalTool, defaultWorkflow, deployWorkflow, evaluateGeneratedRuntimeToolProposal, gameWorkflow, getDefaultPlanPath, getLikelySupportingCandidatePaths, isDiscoveryToolName, isMarathonArtifactPath, isPreservationSensitiveTask, normalizeCandidatePath, parseFinalBuffer, parseSSEChunk, processStream, sanitizeTaskSlug, streamEvents };
|
package/dist/index.mjs
CHANGED
|
@@ -177,13 +177,9 @@ function handleEvent(event, callbacks, results, summary) {
|
|
|
177
177
|
case "step_start":
|
|
178
178
|
callbacks.onStepStart?.(event);
|
|
179
179
|
break;
|
|
180
|
-
case "step_delta":
|
|
181
|
-
|
|
182
|
-
const deltaEvent = event;
|
|
183
|
-
callbacks.onStepDelta?.(chunkText, deltaEvent);
|
|
184
|
-
callbacks.onStepChunk?.(chunkText, deltaEvent);
|
|
180
|
+
case "step_delta":
|
|
181
|
+
callbacks.onStepDelta?.(event.text, event);
|
|
185
182
|
break;
|
|
186
|
-
}
|
|
187
183
|
case "step_complete":
|
|
188
184
|
results.set(event.name, event.result);
|
|
189
185
|
callbacks.onStepComplete?.(event.result, event);
|
|
@@ -241,10 +237,6 @@ async function* streamEvents(response) {
|
|
|
241
237
|
for (const eventStr of events) {
|
|
242
238
|
try {
|
|
243
239
|
const event = JSON.parse(eventStr);
|
|
244
|
-
if (event.type === "step_delta" && "text" in event && !("chunk" in event)) {
|
|
245
|
-
;
|
|
246
|
-
event.chunk = event.text;
|
|
247
|
-
}
|
|
248
240
|
yield event;
|
|
249
241
|
} catch {
|
|
250
242
|
}
|
|
@@ -254,10 +246,6 @@ async function* streamEvents(response) {
|
|
|
254
246
|
if (finalEvent) {
|
|
255
247
|
try {
|
|
256
248
|
const event = JSON.parse(finalEvent);
|
|
257
|
-
if (event.type === "step_delta" && "text" in event && !("chunk" in event)) {
|
|
258
|
-
;
|
|
259
|
-
event.chunk = event.text;
|
|
260
|
-
}
|
|
261
249
|
yield event;
|
|
262
250
|
} catch {
|
|
263
251
|
}
|
|
@@ -309,7 +297,7 @@ var FlowResult = class {
|
|
|
309
297
|
* ```typescript
|
|
310
298
|
* const summary = await result.stream({
|
|
311
299
|
* onStepStart: (event) => console.log('Starting:', event.name),
|
|
312
|
-
*
|
|
300
|
+
* onStepDelta: (text) => process.stdout.write(text),
|
|
313
301
|
* onStepComplete: (result, event) => console.log('Done:', event.name),
|
|
314
302
|
* onFlowComplete: (event) => console.log('Flow complete!'),
|
|
315
303
|
* })
|
|
@@ -913,7 +901,7 @@ var RuntypeFlowBuilder = class {
|
|
|
913
901
|
...callbacks,
|
|
914
902
|
onFlowStart: (event) => callbacks?.onFlowStart?.(event),
|
|
915
903
|
onStepStart: (event) => callbacks?.onStepStart?.(event),
|
|
916
|
-
|
|
904
|
+
onStepDelta: (text, event) => callbacks?.onStepDelta?.(text, event),
|
|
917
905
|
onStepComplete: (result, event) => callbacks?.onStepComplete?.(result, event),
|
|
918
906
|
onFlowComplete: (event) => callbacks?.onFlowComplete?.(event),
|
|
919
907
|
onError: (error) => callbacks?.onError?.(error)
|
|
@@ -943,11 +931,9 @@ var RuntypeFlowBuilder = class {
|
|
|
943
931
|
case "step_start":
|
|
944
932
|
wrappedCallbacks.onStepStart?.(event);
|
|
945
933
|
break;
|
|
946
|
-
case "step_delta":
|
|
947
|
-
|
|
948
|
-
wrappedCallbacks.onStepChunk?.(chunkText, event);
|
|
934
|
+
case "step_delta":
|
|
935
|
+
wrappedCallbacks.onStepDelta?.(event.text, event);
|
|
949
936
|
break;
|
|
950
|
-
}
|
|
951
937
|
case "step_complete": {
|
|
952
938
|
accumulatedSummary.results?.set(event.name, event.result);
|
|
953
939
|
wrappedCallbacks.onStepComplete?.(event.result, event);
|
|
@@ -1397,7 +1383,7 @@ var PromptRunner = class {
|
|
|
1397
1383
|
*
|
|
1398
1384
|
* // Process with callbacks
|
|
1399
1385
|
* await result.stream({
|
|
1400
|
-
*
|
|
1386
|
+
* onStepDelta: (text) => process.stdout.write(text),
|
|
1401
1387
|
* onFlowComplete: () => console.log('Done!'),
|
|
1402
1388
|
* })
|
|
1403
1389
|
* ```
|
|
@@ -4306,6 +4292,15 @@ function dispatchAgentEvent(event, callbacks) {
|
|
|
4306
4292
|
case "agent_tool_complete":
|
|
4307
4293
|
callbacks.onToolComplete?.(typedData);
|
|
4308
4294
|
break;
|
|
4295
|
+
case "agent_media":
|
|
4296
|
+
callbacks.onMedia?.(typedData);
|
|
4297
|
+
break;
|
|
4298
|
+
case "agent_approval_start":
|
|
4299
|
+
callbacks.onApprovalStart?.(typedData);
|
|
4300
|
+
break;
|
|
4301
|
+
case "agent_approval_complete":
|
|
4302
|
+
callbacks.onApprovalComplete?.(typedData);
|
|
4303
|
+
break;
|
|
4309
4304
|
case "agent_iteration_complete":
|
|
4310
4305
|
callbacks.onIterationComplete?.(typedData);
|
|
4311
4306
|
break;
|
|
@@ -7601,7 +7596,7 @@ var ClientFlowBuilder = class extends FlowBuilder {
|
|
|
7601
7596
|
};
|
|
7602
7597
|
function isStreamCallbacks(obj) {
|
|
7603
7598
|
if (!obj || typeof obj !== "object") return false;
|
|
7604
|
-
return "onFlowStart" in obj || "onStepStart" in obj || "onStepDelta" in obj || "
|
|
7599
|
+
return "onFlowStart" in obj || "onStepStart" in obj || "onStepDelta" in obj || "onStepComplete" in obj || "onFlowComplete" in obj || "onError" in obj;
|
|
7605
7600
|
}
|
|
7606
7601
|
function createExternalTool(config) {
|
|
7607
7602
|
return {
|
|
@@ -7716,7 +7711,7 @@ var RuntypeClient2 = class {
|
|
|
7716
7711
|
...callbacks,
|
|
7717
7712
|
onFlowStart: (event) => callbacks?.onFlowStart?.(event),
|
|
7718
7713
|
onStepStart: (event) => callbacks?.onStepStart?.(event),
|
|
7719
|
-
|
|
7714
|
+
onStepDelta: (text, event) => callbacks?.onStepDelta?.(text, event),
|
|
7720
7715
|
onStepComplete: (result, event) => callbacks?.onStepComplete?.(result, event),
|
|
7721
7716
|
onFlowComplete: (event) => callbacks?.onFlowComplete?.(event),
|
|
7722
7717
|
onError: (error) => callbacks?.onError?.(error)
|
|
@@ -7751,12 +7746,9 @@ var RuntypeClient2 = class {
|
|
|
7751
7746
|
case "step_start":
|
|
7752
7747
|
wrappedCallbacks.onStepStart?.(event);
|
|
7753
7748
|
break;
|
|
7754
|
-
case "step_delta":
|
|
7755
|
-
|
|
7756
|
-
const chunkText = deltaEvent.chunk || deltaEvent.text || "";
|
|
7757
|
-
wrappedCallbacks.onStepChunk?.(chunkText, deltaEvent);
|
|
7749
|
+
case "step_delta":
|
|
7750
|
+
wrappedCallbacks.onStepDelta?.(event.text, event);
|
|
7758
7751
|
break;
|
|
7759
|
-
}
|
|
7760
7752
|
case "step_complete": {
|
|
7761
7753
|
summary.results?.set(event.name, event.result);
|
|
7762
7754
|
wrappedCallbacks.onStepComplete?.(event.result, event);
|
package/package.json
CHANGED