@anvia/core 0.6.1 → 0.6.3

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.
Files changed (68) hide show
  1. package/dist/agent/index.d.ts +8 -8
  2. package/dist/agent/index.js +8 -6
  3. package/dist/{agent-MQdfhE7y.d.ts → agent-CFMdNB6O.d.ts} +11 -4
  4. package/dist/audio-generation/index.d.ts +1 -1
  5. package/dist/{chunk-AER5FGPK.js → chunk-5OGAUWM5.js} +14 -30
  6. package/dist/chunk-5OGAUWM5.js.map +1 -0
  7. package/dist/{chunk-I47EHI45.js → chunk-66IJDP6L.js} +8 -6
  8. package/dist/chunk-66IJDP6L.js.map +1 -0
  9. package/dist/{chunk-2SSND6H4.js → chunk-AYR3BJWH.js} +10 -11
  10. package/dist/chunk-AYR3BJWH.js.map +1 -0
  11. package/dist/{chunk-EFGX3EX5.js → chunk-FTO3W4UP.js} +2 -2
  12. package/dist/chunk-FTO3W4UP.js.map +1 -0
  13. package/dist/{chunk-YLN6QF5S.js → chunk-GBBMMU5E.js} +120 -65
  14. package/dist/chunk-GBBMMU5E.js.map +1 -0
  15. package/dist/chunk-MMHG7WAM.js +19 -0
  16. package/dist/chunk-MMHG7WAM.js.map +1 -0
  17. package/dist/chunk-S5IGJ4RB.js +224 -0
  18. package/dist/chunk-S5IGJ4RB.js.map +1 -0
  19. package/dist/{chunk-GNNNJZ2P.js → chunk-SYMAVW5T.js} +3 -3
  20. package/dist/{chunk-ZQQYFVO5.js → chunk-WJO6NVE2.js} +4 -217
  21. package/dist/chunk-WJO6NVE2.js.map +1 -0
  22. package/dist/{chunk-SHHSMV7O.js → chunk-ZT2YH2GA.js} +5 -5
  23. package/dist/chunk-ZT2YH2GA.js.map +1 -0
  24. package/dist/completion/index.d.ts +3 -3
  25. package/dist/completion/index.js +15 -7
  26. package/dist/{create-completion-B7-k4LsF.d.ts → create-completion-BEbtU5pX.d.ts} +3 -2
  27. package/dist/embeddings/index.js +1 -1
  28. package/dist/evals/index.d.ts +4 -4
  29. package/dist/evals/index.js +30 -26
  30. package/dist/evals/index.js.map +1 -1
  31. package/dist/extractor/index.d.ts +4 -4
  32. package/dist/extractor/index.js +9 -7
  33. package/dist/image-generation/index.d.ts +1 -1
  34. package/dist/index.d.ts +8 -8
  35. package/dist/index.js +14 -11
  36. package/dist/internal/agent.d.ts +4 -4
  37. package/dist/internal/agent.js +7 -5
  38. package/dist/loaders/index.d.ts +1 -1
  39. package/dist/mcp/index.d.ts +4 -4
  40. package/dist/mcp/index.js +5 -4
  41. package/dist/mcp/index.js.map +1 -1
  42. package/dist/memory/index.d.ts +1 -1
  43. package/dist/{middleware-D6Wu0AcC.d.ts → middleware-C0eXGwoh.d.ts} +2 -2
  44. package/dist/observability/index.d.ts +2 -2
  45. package/dist/pipeline/index.d.ts +4 -4
  46. package/dist/pipeline/index.js +17 -12
  47. package/dist/pipeline/index.js.map +1 -1
  48. package/dist/skills/index.d.ts +4 -4
  49. package/dist/skills/index.js +6 -4
  50. package/dist/{think-tool-DTDGH1Q1.d.ts → think-tool-DQw-Oz9J.d.ts} +1 -1
  51. package/dist/tool/index.d.ts +4 -4
  52. package/dist/tool/index.js +9 -6
  53. package/dist/{tool-OU7OZS0t.d.ts → tool-Bwj_zoTx.d.ts} +3 -4
  54. package/dist/transcription/index.d.ts +1 -1
  55. package/dist/{types-DXkaLs4s.d.ts → types-BLyF-Tub.d.ts} +2 -2
  56. package/dist/{types-Bpjngcxq.d.ts → types-BfEFm6zu.d.ts} +1 -1
  57. package/dist/{types-_boSLqrx.d.ts → types-C8loR4il.d.ts} +3 -1
  58. package/dist/vector-store/index.d.ts +2 -2
  59. package/dist/vector-store/index.js +3 -2
  60. package/package.json +1 -1
  61. package/dist/chunk-2SSND6H4.js.map +0 -1
  62. package/dist/chunk-AER5FGPK.js.map +0 -1
  63. package/dist/chunk-EFGX3EX5.js.map +0 -1
  64. package/dist/chunk-I47EHI45.js.map +0 -1
  65. package/dist/chunk-SHHSMV7O.js.map +0 -1
  66. package/dist/chunk-YLN6QF5S.js.map +0 -1
  67. package/dist/chunk-ZQQYFVO5.js.map +0 -1
  68. /package/dist/{chunk-GNNNJZ2P.js.map → chunk-SYMAVW5T.js.map} +0 -0
@@ -7,18 +7,24 @@ import {
7
7
  import {
8
8
  ToolSet,
9
9
  toolResultContentToText
10
- } from "./chunk-AER5FGPK.js";
10
+ } from "./chunk-5OGAUWM5.js";
11
11
  import {
12
12
  createTool
13
- } from "./chunk-I47EHI45.js";
13
+ } from "./chunk-66IJDP6L.js";
14
+ import {
15
+ compact
16
+ } from "./chunk-MMHG7WAM.js";
14
17
  import {
15
18
  CompletionRequestBuilder,
19
+ isStreamingCompletionModel
20
+ } from "./chunk-S5IGJ4RB.js";
21
+ import {
16
22
  Message,
17
23
  ToolContent,
18
24
  Usage,
19
25
  assertCompletionRequestSupported,
20
26
  textFromAssistantContent
21
- } from "./chunk-ZQQYFVO5.js";
27
+ } from "./chunk-WJO6NVE2.js";
22
28
  import {
23
29
  mapWithConcurrency
24
30
  } from "./chunk-OIMLU4SF.js";
@@ -58,11 +64,11 @@ function skipTool(reason) {
58
64
  return { type: "skip", reason };
59
65
  }
60
66
  function requestToolApproval(options = {}) {
61
- return {
67
+ return compact({
62
68
  type: "approval_request",
63
- ...options.reason === void 0 ? {} : { reason: options.reason },
64
- ...options.rejectMessage === void 0 ? {} : { rejectMessage: options.rejectMessage }
65
- };
69
+ reason: options.reason,
70
+ rejectMessage: options.rejectMessage
71
+ });
66
72
  }
67
73
  var runControl = {
68
74
  continue() {
@@ -338,6 +344,24 @@ var ActiveToolObservers = class {
338
344
  }
339
345
  };
340
346
 
347
+ // src/agent/request-types.ts
348
+ function addTurn(turn, event) {
349
+ if (event.type === "text_delta") {
350
+ return { type: "text_delta", turn, delta: event.delta };
351
+ }
352
+ if (event.type === "reasoning_delta") {
353
+ const mapped = { type: "reasoning_delta", turn, delta: event.delta };
354
+ if (event.id !== void 0) mapped.id = event.id;
355
+ if (event.contentType !== void 0) mapped.contentType = event.contentType;
356
+ if (event.signature !== void 0) mapped.signature = event.signature;
357
+ return mapped;
358
+ }
359
+ return { type: "tool_call", turn, toolCall: event.toolCall };
360
+ }
361
+ function isGenerationDeltaEvent(type) {
362
+ return type === "text_delta" || type === "reasoning_delta" || type === "tool_call_delta" || type === "tool_call";
363
+ }
364
+
341
365
  // src/agent/request-memory.ts
342
366
  var PromptRequestMemory = class {
343
367
  constructor(agent, memoryContext, initialHistory) {
@@ -449,11 +473,11 @@ async function fetchDynamicContext(agent, ragText) {
449
473
  documents.push(formatted);
450
474
  } else {
451
475
  const metadata = formatMetadata(result.metadata);
452
- documents.push({
476
+ documents.push(compact({
453
477
  id: result.id,
454
478
  text: typeof result.document === "string" ? result.document : JSON.stringify(result.document, null, 2),
455
- ...metadata === void 0 ? {} : { additionalProps: metadata }
456
- });
479
+ additionalProps: metadata
480
+ }));
457
481
  }
458
482
  }
459
483
  }
@@ -491,9 +515,6 @@ function formatMetadata(metadata) {
491
515
  }
492
516
 
493
517
  // src/agent/utils.ts
494
- function isStreamingCompletionModel(model) {
495
- return "streamCompletion" in model && typeof model.streamCompletion === "function";
496
- }
497
518
  function extractRagText(message) {
498
519
  if (message.role === "user") {
499
520
  return message.content.flatMap((item) => item.type === "text" ? [item.text] : []).join("\n");
@@ -774,16 +795,16 @@ var ToolCallExecutor = class {
774
795
  (definition) => definition.name === toolCall.function.name
775
796
  );
776
797
  const toolMetadata = toolTraceMetadata(tool);
777
- const toolObservers = await observation?.runObservers.startTool({
798
+ const toolObservers = await observation?.runObservers.startTool(compact({
778
799
  turn: observation.turn,
779
800
  toolCall,
780
801
  toolName: toolCall.function.name,
781
802
  internalCallId,
782
803
  args,
783
804
  toolCallId: toolCall.callId,
784
- ...toolDefinition === void 0 ? {} : { toolDefinition },
785
- ...toolMetadata === void 0 ? {} : { toolMetadata }
786
- });
805
+ toolDefinition,
806
+ toolMetadata
807
+ }));
787
808
  const callAction = await this.activeHook?.onToolCall?.({
788
809
  ...hookArgs,
789
810
  tool: toolCallControl
@@ -826,15 +847,17 @@ var ToolCallExecutor = class {
826
847
  try {
827
848
  output = await this.agent.callTool(toolCall.function.name, effectiveArgs, {
828
849
  emitStreamEvent: async (event) => {
829
- await toolObservers?.streamEvent({
830
- turn: observation?.turn ?? 0,
831
- toolCall,
832
- toolName: toolCall.function.name,
833
- internalCallId,
834
- args: effectiveArgs,
835
- ...toolCall.callId === void 0 ? {} : { toolCallId: toolCall.callId },
836
- event
837
- });
850
+ await toolObservers?.streamEvent(
851
+ compact({
852
+ turn: observation?.turn ?? 0,
853
+ toolCall,
854
+ toolName: toolCall.function.name,
855
+ internalCallId,
856
+ args: effectiveArgs,
857
+ toolCallId: toolCall.callId,
858
+ event
859
+ })
860
+ );
838
861
  const payload = agentToolEventPayload(toolCall, internalCallId, event);
839
862
  if (payload !== void 0) {
840
863
  onStreamEvent?.(payload);
@@ -854,7 +877,7 @@ var ToolCallExecutor = class {
854
877
  toolName: toolCall.function.name,
855
878
  internalCallId,
856
879
  args: effectiveArgs,
857
- ...toolCall.callId === void 0 ? {} : { toolCallId: toolCall.callId },
880
+ ...toolCall.callId !== void 0 && { toolCallId: toolCall.callId },
858
881
  error
859
882
  });
860
883
  if (errorAction?.type === "terminate") {
@@ -1007,15 +1030,15 @@ function agentToolEventPayload(toolCall, internalCallId, event) {
1007
1030
  if (typeof event.agentId !== "string" || event.agentId.length === 0) {
1008
1031
  return void 0;
1009
1032
  }
1010
- return {
1033
+ return compact({
1011
1034
  type: "agent_tool_event",
1012
1035
  toolName: toolCall.function.name,
1013
- ...toolCall.callId === void 0 ? {} : { toolCallId: toolCall.callId },
1036
+ toolCallId: toolCall.callId,
1014
1037
  internalCallId,
1015
1038
  agentId: event.agentId,
1016
- ...event.agentName === void 0 ? {} : { agentName: event.agentName },
1039
+ agentName: event.agentName,
1017
1040
  event: event.event
1018
- };
1041
+ });
1019
1042
  }
1020
1043
 
1021
1044
  // src/agent/request.ts
@@ -1036,6 +1059,8 @@ var PromptRequest = class _PromptRequest {
1036
1059
  concurrency = 1;
1037
1060
  traceOptions;
1038
1061
  requestMiddlewares = [];
1062
+ steeringMessages = [];
1063
+ runState = "idle";
1039
1064
  memoryRecorder;
1040
1065
  static fromAgent(agent, prompt, options = {}) {
1041
1066
  const normalized = normalizePromptInput(prompt);
@@ -1083,7 +1108,15 @@ var PromptRequest = class _PromptRequest {
1083
1108
  this.traceOptions = trace;
1084
1109
  return this;
1085
1110
  }
1111
+ steer(input) {
1112
+ if (this.isTerminal()) {
1113
+ return false;
1114
+ }
1115
+ this.steeringMessages.push(...normalizeSteeringInput(input));
1116
+ return true;
1117
+ }
1086
1118
  async send() {
1119
+ this.startRun();
1087
1120
  const runId = globalThis.crypto.randomUUID();
1088
1121
  const newMessages = [this.promptMessage];
1089
1122
  this.chatHistory = await this.memoryRecorder.prepareRun(runId, newMessages);
@@ -1132,6 +1165,10 @@ var PromptRequest = class _PromptRequest {
1132
1165
  (item) => item.type === "tool_call"
1133
1166
  );
1134
1167
  if (toolCalls.length === 0) {
1168
+ if (await this.drainSteeringMessages(runId, currentTurns, newMessages, pendingTurnMessages)) {
1169
+ await this.memoryRecorder.commitCompletedTurn(runId, currentTurns, pendingTurnMessages);
1170
+ continue;
1171
+ }
1135
1172
  await this.memoryRecorder.commitCompletedRun(
1136
1173
  runId,
1137
1174
  currentTurns,
@@ -1144,6 +1181,7 @@ var PromptRequest = class _PromptRequest {
1144
1181
  messages: [...newMessages],
1145
1182
  trace: runObservers.trace
1146
1183
  };
1184
+ this.runState = "completed";
1147
1185
  await this.runRunEndHook(result, newMessages);
1148
1186
  await runObservers.end(result);
1149
1187
  return result;
@@ -1167,11 +1205,13 @@ var PromptRequest = class _PromptRequest {
1167
1205
  [toolMessage],
1168
1206
  pendingTurnMessages
1169
1207
  );
1208
+ await this.drainSteeringMessages(runId, currentTurns, newMessages, pendingTurnMessages);
1170
1209
  await this.memoryRecorder.commitCompletedTurn(runId, currentTurns, pendingTurnMessages);
1171
1210
  }
1172
1211
  throw new MaxTurnsError(this.maxTurnCount, [...this.chatHistory, ...newMessages], lastPrompt);
1173
1212
  } catch (error) {
1174
1213
  const finalError = await this.runRunErrorHook(error, usage, newMessages);
1214
+ this.runState = finalError instanceof PromptCancelledError ? "cancelled" : "errored";
1175
1215
  await runObservers.error({ error: finalError, usage, messages: [...newMessages] });
1176
1216
  await this.memoryRecorder.recordError(runId, finalError, newMessages);
1177
1217
  throw finalError;
@@ -1181,6 +1221,7 @@ var PromptRequest = class _PromptRequest {
1181
1221
  if (!this.agent.model.capabilities.streaming || !isStreamingCompletionModel(this.agent.model)) {
1182
1222
  throw new Error("This completion model does not support streaming");
1183
1223
  }
1224
+ this.startRun();
1184
1225
  const runId = globalThis.crypto.randomUUID();
1185
1226
  const newMessages = [this.promptMessage];
1186
1227
  this.chatHistory = await this.memoryRecorder.prepareRun(runId, newMessages);
@@ -1218,16 +1259,16 @@ var PromptRequest = class _PromptRequest {
1218
1259
  request = await this.runCompletionRequestMiddlewares(request, currentTurns);
1219
1260
  assertCompletionRequestSupported(this.agent.model, request, { streaming: true });
1220
1261
  const providerRequest = this.providerTraceRequest(request, { stream: true });
1221
- const generationObservers = await runObservers.startGeneration({
1262
+ const generationObservers = await runObservers.startGeneration(compact({
1222
1263
  turn: currentTurns,
1223
1264
  request,
1224
- ...providerRequest === void 0 ? {} : { providerRequest },
1265
+ providerRequest,
1225
1266
  modelInfo: {
1226
1267
  provider: this.agent.model.provider,
1227
1268
  defaultModel: this.agent.model.defaultModel,
1228
1269
  capabilities: this.agent.model.capabilities
1229
1270
  }
1230
- });
1271
+ }));
1231
1272
  const accumulator = new CompletionStreamAccumulator();
1232
1273
  const generationStartedAt = Date.now();
1233
1274
  let firstDeltaMs;
@@ -1250,11 +1291,11 @@ var PromptRequest = class _PromptRequest {
1250
1291
  throw error;
1251
1292
  }
1252
1293
  let response = accumulator.response();
1253
- await generationObservers.end({
1294
+ await generationObservers.end(compact({
1254
1295
  turn: currentTurns,
1255
1296
  response,
1256
- ...firstDeltaMs === void 0 ? {} : { firstDeltaMs }
1257
- });
1297
+ firstDeltaMs
1298
+ }));
1258
1299
  response = await this.runCompletionResponseMiddlewares(request, response, currentTurns);
1259
1300
  usage = Usage.add(usage, response.usage);
1260
1301
  await this.runCompletionResponseHook(prompt, response, newMessages);
@@ -1275,6 +1316,10 @@ var PromptRequest = class _PromptRequest {
1275
1316
  }
1276
1317
  yield await emit({ type: "turn_end", turn: currentTurns, response });
1277
1318
  if (toolCalls.length === 0) {
1319
+ if (await this.drainSteeringMessages(runId, currentTurns, newMessages, pendingTurnMessages)) {
1320
+ await this.memoryRecorder.commitCompletedTurn(runId, currentTurns, pendingTurnMessages);
1321
+ continue;
1322
+ }
1278
1323
  const output = textFromAssistantContent(response.choice);
1279
1324
  await this.memoryRecorder.commitCompletedRun(
1280
1325
  runId,
@@ -1290,6 +1335,7 @@ var PromptRequest = class _PromptRequest {
1290
1335
  messages: [...newMessages],
1291
1336
  trace: runObservers.trace
1292
1337
  });
1338
+ this.runState = "completed";
1293
1339
  await this.runRunEndHook({ output, usage, messages: [...newMessages] }, newMessages);
1294
1340
  await runObservers.end({ output, usage, messages: [...newMessages] });
1295
1341
  return;
@@ -1326,11 +1372,13 @@ var PromptRequest = class _PromptRequest {
1326
1372
  [toolMessage],
1327
1373
  pendingTurnMessages
1328
1374
  );
1375
+ await this.drainSteeringMessages(runId, currentTurns, newMessages, pendingTurnMessages);
1329
1376
  await this.memoryRecorder.commitCompletedTurn(runId, currentTurns, pendingTurnMessages);
1330
1377
  }
1331
1378
  throw new MaxTurnsError(this.maxTurnCount, [...this.chatHistory, ...newMessages], lastPrompt);
1332
1379
  } catch (error) {
1333
1380
  const finalError = await this.runRunErrorHook(error, usage, newMessages);
1381
+ this.runState = finalError instanceof PromptCancelledError ? "cancelled" : "errored";
1334
1382
  await runObservers.error({ error: finalError, usage, messages: [...newMessages] });
1335
1383
  await this.memoryRecorder.recordError(runId, finalError, newMessages);
1336
1384
  yield await emit({ type: "error", error: finalError });
@@ -1343,16 +1391,16 @@ var PromptRequest = class _PromptRequest {
1343
1391
  async runCompletion(request, turn, runObservers) {
1344
1392
  assertCompletionRequestSupported(this.agent.model, request);
1345
1393
  const providerRequest = this.providerTraceRequest(request);
1346
- const generationObservers = await runObservers.startGeneration({
1394
+ const generationObservers = await runObservers.startGeneration(compact({
1347
1395
  turn,
1348
1396
  request,
1349
- ...providerRequest === void 0 ? {} : { providerRequest },
1397
+ providerRequest,
1350
1398
  modelInfo: {
1351
1399
  provider: this.agent.model.provider,
1352
1400
  defaultModel: this.agent.model.defaultModel,
1353
1401
  capabilities: this.agent.model.capabilities
1354
1402
  }
1355
- });
1403
+ }));
1356
1404
  try {
1357
1405
  const response = await this.agent.model.completion(request);
1358
1406
  await generationObservers.end({ turn, response });
@@ -1411,13 +1459,12 @@ var PromptRequest = class _PromptRequest {
1411
1459
  await registration.store.append({
1412
1460
  runId,
1413
1461
  agentId,
1414
- ...agentName === void 0 ? {} : { agentName },
1415
- ...turn === void 0 ? {} : { turn },
1416
- ...event.type === "agent_tool_event" ? {
1462
+ ...compact({ agentName, turn }),
1463
+ ...event.type === "agent_tool_event" ? compact({
1417
1464
  toolName: event.toolName,
1418
- ...event.toolCallId === void 0 ? {} : { toolCallId: event.toolCallId },
1465
+ toolCallId: event.toolCallId,
1419
1466
  internalCallId: event.internalCallId
1420
- } : {},
1467
+ }) : {},
1421
1468
  event
1422
1469
  });
1423
1470
  }
@@ -1538,6 +1585,23 @@ var PromptRequest = class _PromptRequest {
1538
1585
  activeMiddlewares() {
1539
1586
  return [...this.agent.middlewares, ...this.requestMiddlewares];
1540
1587
  }
1588
+ async drainSteeringMessages(runId, turn, newMessages, pendingTurnMessages) {
1589
+ const messages = this.steeringMessages.splice(0);
1590
+ if (messages.length === 0) {
1591
+ return false;
1592
+ }
1593
+ newMessages.push(...messages);
1594
+ await this.memoryRecorder.commitMessages(runId, turn, messages, pendingTurnMessages);
1595
+ return true;
1596
+ }
1597
+ startRun() {
1598
+ if (!this.isTerminal()) {
1599
+ this.runState = "running";
1600
+ }
1601
+ }
1602
+ isTerminal() {
1603
+ return this.runState === "completed" || this.runState === "errored" || this.runState === "cancelled";
1604
+ }
1541
1605
  cancelled(newMessages, reason) {
1542
1606
  return new PromptCancelledError([...this.chatHistory, ...newMessages], reason);
1543
1607
  }
@@ -1561,21 +1625,11 @@ function normalizePromptInput(prompt) {
1561
1625
  history: prompt.slice(0, -1)
1562
1626
  };
1563
1627
  }
1564
- function addTurn(turn, event) {
1565
- if (event.type === "text_delta") {
1566
- return { type: "text_delta", turn, delta: event.delta };
1567
- }
1568
- if (event.type === "reasoning_delta") {
1569
- const mapped = { type: "reasoning_delta", turn, delta: event.delta };
1570
- if (event.id !== void 0) mapped.id = event.id;
1571
- if (event.contentType !== void 0) mapped.contentType = event.contentType;
1572
- if (event.signature !== void 0) mapped.signature = event.signature;
1573
- return mapped;
1628
+ function normalizeSteeringInput(input) {
1629
+ if (typeof input === "string") {
1630
+ return [Message.user(input)];
1574
1631
  }
1575
- return { type: "tool_call", turn, toolCall: event.toolCall };
1576
- }
1577
- function isGenerationDeltaEvent(type) {
1578
- return type === "text_delta" || type === "reasoning_delta" || type === "tool_call_delta" || type === "tool_call";
1632
+ return Array.isArray(input) ? [...input] : [input];
1579
1633
  }
1580
1634
 
1581
1635
  // src/agent/agent.ts
@@ -1641,8 +1695,8 @@ var Agent = class {
1641
1695
  }
1642
1696
  return new AgentSession(this, {
1643
1697
  sessionId: normalized,
1644
- ...options.userId === void 0 ? {} : { userId: options.userId },
1645
- ...options.metadata === void 0 ? {} : { metadata: options.metadata }
1698
+ ...options.userId !== void 0 && { userId: options.userId },
1699
+ ...options.metadata !== void 0 && { metadata: options.metadata }
1646
1700
  });
1647
1701
  }
1648
1702
  asTool(options) {
@@ -1660,11 +1714,11 @@ var Agent = class {
1660
1714
  if (options.stream === true && context.emitStreamEvent !== void 0 && this.model.capabilities.streaming && isStreamingCompletionModel(this.model)) {
1661
1715
  let output = "";
1662
1716
  for await (const event of childRequest.stream()) {
1663
- await context.emitStreamEvent({
1717
+ await context.emitStreamEvent(compact({
1664
1718
  agentId: this.id,
1665
- ...this.name === void 0 ? {} : { agentName: this.name },
1719
+ agentName: this.name,
1666
1720
  event
1667
- });
1721
+ }));
1668
1722
  if (event.type === "final") {
1669
1723
  output = event.output;
1670
1724
  }
@@ -1748,8 +1802,9 @@ export {
1748
1802
  requestToolApproval,
1749
1803
  runControl,
1750
1804
  toolCallControl,
1805
+ extractRagText,
1751
1806
  DEFAULT_MAX_TURNS,
1752
1807
  Agent,
1753
1808
  AgentSession
1754
1809
  };
1755
- //# sourceMappingURL=chunk-YLN6QF5S.js.map
1810
+ //# sourceMappingURL=chunk-GBBMMU5E.js.map