@agentscope-ai/agentscope 0.0.2 → 0.0.4
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/LICENSE +202 -0
- package/dist/agent/index.d.mts +10 -10
- package/dist/agent/index.d.ts +10 -10
- package/dist/agent/index.js +104 -93
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/index.mjs +104 -93
- package/dist/agent/index.mjs.map +1 -1
- package/dist/{base-BOx3UzOl.d.mts → base-1YVBgB4n.d.mts} +2 -2
- package/dist/{base-DYlBMCy_.d.mts → base-B_MQMHWr.d.mts} +3 -3
- package/dist/{base-Cwi4bjze.d.ts → base-BherSLRs.d.ts} +3 -3
- package/dist/{base-NX-knWOv.d.ts → base-CY4DMBH1.d.ts} +1 -1
- package/dist/{base-BoIps2RL.d.ts → base-ChWjyzPL.d.ts} +2 -2
- package/dist/{base-C7jwyH4Z.d.mts → base-ClilytRZ.d.mts} +1 -1
- package/dist/{block-VsnHrllL.d.mts → block-B72uPF1H.d.mts} +7 -5
- package/dist/{block-VsnHrllL.d.ts → block-B72uPF1H.d.ts} +7 -5
- package/dist/event/index.d.mts +105 -89
- package/dist/event/index.d.ts +105 -89
- package/dist/event/index.js +8 -8
- package/dist/event/index.js.map +1 -1
- package/dist/event/index.mjs +8 -8
- package/dist/event/index.mjs.map +1 -1
- package/dist/formatter/index.d.mts +4 -3
- package/dist/formatter/index.d.ts +4 -3
- package/dist/formatter/index.js +17 -17
- package/dist/formatter/index.js.map +1 -1
- package/dist/formatter/index.mjs +17 -17
- package/dist/formatter/index.mjs.map +1 -1
- package/dist/{index-BcatlwXQ.d.ts → index-BNfyKbQN.d.ts} +1 -1
- package/dist/{index-BTJDlKvQ.d.mts → index-UQCwdfet.d.mts} +1 -1
- package/dist/mcp/index.d.mts +2 -2
- package/dist/mcp/index.d.ts +2 -2
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/index.mjs +1 -1
- package/dist/mcp/index.mjs.map +1 -1
- package/dist/message/index.d.mts +3 -2
- package/dist/message/index.d.ts +3 -2
- package/dist/message/index.js +204 -5
- package/dist/message/index.js.map +1 -1
- package/dist/message/index.mjs +200 -5
- package/dist/message/index.mjs.map +1 -1
- package/dist/message-CPZd0NIc.d.ts +133 -0
- package/dist/message-DgpfAaHK.d.mts +133 -0
- package/dist/model/index.d.mts +6 -5
- package/dist/model/index.d.ts +6 -5
- package/dist/model/index.js +39 -28
- package/dist/model/index.js.map +1 -1
- package/dist/model/index.mjs +39 -28
- package/dist/model/index.mjs.map +1 -1
- package/dist/storage/index.d.mts +4 -3
- package/dist/storage/index.d.ts +4 -3
- package/dist/storage/index.js +4 -4
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/index.mjs +4 -4
- package/dist/storage/index.mjs.map +1 -1
- package/dist/tool/index.d.mts +4 -4
- package/dist/tool/index.d.ts +4 -4
- package/dist/{toolkit-CEpulFi0.d.ts → toolkit-DeOlul5Y.d.ts} +2 -2
- package/dist/{toolkit-CGEZSZPa.d.mts → toolkit-jwe7NmVJ.d.mts} +2 -2
- package/package.json +87 -87
- package/src/agent/agent.test.ts +104 -71
- package/src/agent/agent.ts +112 -104
- package/src/agent/test-compression.ts +1 -1
- package/src/event/index.ts +96 -98
- package/src/formatter/base.ts +3 -3
- package/src/formatter/dashscope-chat-formatter.test.ts +11 -8
- package/src/formatter/dashscope-chat-formatter.ts +3 -3
- package/src/formatter/openai-chat-formatter.test.ts +13 -5
- package/src/formatter/openai-chat-formatter.ts +6 -6
- package/src/mcp/base.ts +1 -1
- package/src/mcp/http.test.ts +2 -0
- package/src/mcp/stdio.test.ts +1 -0
- package/src/message/append-event.test.ts +783 -0
- package/src/message/block.ts +8 -4
- package/src/message/index.ts +12 -1
- package/src/message/message.test.ts +3 -1
- package/src/message/message.ts +310 -47
- package/src/model/dashscope-model.test.ts +4 -0
- package/src/model/dashscope-model.ts +3 -0
- package/src/model/deepseek-model.test.ts +2 -0
- package/src/model/deepseek-model.ts +3 -0
- package/src/model/ollama-model.test.ts +1 -0
- package/src/model/ollama-model.ts +2 -0
- package/src/model/openai-model.ts +3 -0
- package/src/permission/index.ts +13 -0
- package/src/storage/file-system.test.ts +4 -3
- package/src/storage/file-system.ts +4 -4
- package/src/tool/toolkit.test.ts +12 -0
- package/dist/message-CkN21KaY.d.mts +0 -99
- package/dist/message-CzLeTlua.d.ts +0 -99
package/src/agent/agent.ts
CHANGED
|
@@ -14,10 +14,10 @@ import { ActingOptions, ObserveOptions, ReasoningOptions, ReplyOptions } from '.
|
|
|
14
14
|
import {
|
|
15
15
|
AgentEvent,
|
|
16
16
|
EventType,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
ModelCallEndEvent,
|
|
18
|
+
ModelCallStartEvent,
|
|
19
|
+
ReplyEndEvent,
|
|
20
|
+
ReplyStartEvent,
|
|
21
21
|
TextBlockDeltaEvent,
|
|
22
22
|
TextBlockEndEvent,
|
|
23
23
|
TextBlockStartEvent,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
ToolCallDeltaEvent,
|
|
28
28
|
ToolCallEndEvent,
|
|
29
29
|
ToolCallStartEvent,
|
|
30
|
-
|
|
30
|
+
ToolResultDataDeltaEvent,
|
|
31
31
|
ToolResultEndEvent,
|
|
32
32
|
ToolResultStartEvent,
|
|
33
33
|
ToolResultTextDeltaEvent,
|
|
@@ -322,7 +322,7 @@ export class Agent {
|
|
|
322
322
|
this.toolkit.requireUserConfirm(toolCall.name) &&
|
|
323
323
|
!this.confirmedToolCallIds.includes(toolCall.id)
|
|
324
324
|
) {
|
|
325
|
-
toolCall.
|
|
325
|
+
toolCall.state = 'asking';
|
|
326
326
|
// Find the continuous tool calls that require user confirmation
|
|
327
327
|
let i = index + 1;
|
|
328
328
|
for (; i < pendingToolCalls.length; i++) {
|
|
@@ -332,7 +332,7 @@ export class Agent {
|
|
|
332
332
|
this.confirmedToolCallIds.includes(nextToolCall.id)
|
|
333
333
|
)
|
|
334
334
|
break;
|
|
335
|
-
nextToolCall.
|
|
335
|
+
nextToolCall.state = 'asking';
|
|
336
336
|
}
|
|
337
337
|
return {
|
|
338
338
|
awaitingType: EventType.REQUIRE_USER_CONFIRM,
|
|
@@ -383,47 +383,47 @@ export class Agent {
|
|
|
383
383
|
const event = options.event;
|
|
384
384
|
if (event.type === EventType.EXTERNAL_EXECUTION_RESULT) {
|
|
385
385
|
// Record the tool results into context and go on acting
|
|
386
|
-
this._saveToContext(event.
|
|
386
|
+
this._saveToContext(event.execution_results);
|
|
387
387
|
} else if (event.type === EventType.USER_CONFIRM_RESULT) {
|
|
388
|
-
for (const result of event.
|
|
388
|
+
for (const result of event.confirm_results) {
|
|
389
389
|
if (result.confirmed) {
|
|
390
|
-
this.confirmedToolCallIds.push(result.
|
|
390
|
+
this.confirmedToolCallIds.push(result.tool_call.id);
|
|
391
391
|
} else {
|
|
392
392
|
// If user rejected, add a rejection result and handle the pending tool calls
|
|
393
|
-
const rejectionRes = `<system-info>**Note** the user rejected the execution of tool "${result.
|
|
393
|
+
const rejectionRes = `<system-info>**Note** the user rejected the execution of tool "${result.tool_call.name}"!</system-info>`;
|
|
394
394
|
yield {
|
|
395
395
|
id: crypto.randomUUID(),
|
|
396
|
-
|
|
396
|
+
created_at: new Date().toISOString(),
|
|
397
397
|
type: EventType.TOOL_RESULT_START,
|
|
398
|
-
|
|
399
|
-
|
|
398
|
+
reply_id: this.replyId,
|
|
399
|
+
tool_call_id: result.tool_call.id,
|
|
400
400
|
} as ToolResultStartEvent;
|
|
401
401
|
yield {
|
|
402
402
|
id: crypto.randomUUID(),
|
|
403
|
-
|
|
403
|
+
created_at: new Date().toISOString(),
|
|
404
404
|
type: EventType.TOOL_RESULT_TEXT_DELTA,
|
|
405
|
-
|
|
406
|
-
|
|
405
|
+
reply_id: this.replyId,
|
|
406
|
+
tool_call_id: result.tool_call.id,
|
|
407
407
|
delta: rejectionRes,
|
|
408
408
|
} as ToolResultTextDeltaEvent;
|
|
409
409
|
yield {
|
|
410
410
|
id: crypto.randomUUID(),
|
|
411
|
-
|
|
411
|
+
created_at: new Date().toISOString(),
|
|
412
412
|
type: EventType.TOOL_RESULT_END,
|
|
413
|
-
|
|
414
|
-
|
|
413
|
+
reply_id: this.replyId,
|
|
414
|
+
tool_call_id: result.tool_call.id,
|
|
415
415
|
state: 'interrupted',
|
|
416
416
|
} as ToolResultEndEvent;
|
|
417
417
|
this._saveToContext([
|
|
418
418
|
{
|
|
419
419
|
type: 'tool_result',
|
|
420
|
-
id: result.
|
|
421
|
-
name: result.
|
|
420
|
+
id: result.tool_call.id,
|
|
421
|
+
name: result.tool_call.name,
|
|
422
422
|
output: [
|
|
423
423
|
{
|
|
424
424
|
id: crypto.randomUUID(),
|
|
425
425
|
type: 'text',
|
|
426
|
-
text: `<system-info>**Note** the user rejected the execution of tool "${result.
|
|
426
|
+
text: `<system-info>**Note** the user rejected the execution of tool "${result.tool_call.name}"!</system-info>`,
|
|
427
427
|
},
|
|
428
428
|
],
|
|
429
429
|
state: 'interrupted',
|
|
@@ -431,12 +431,20 @@ export class Agent {
|
|
|
431
431
|
]);
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
|
-
//
|
|
435
|
-
const
|
|
436
|
-
|
|
434
|
+
// Update tool call states based on confirm results
|
|
435
|
+
const confirmedIds = new Set(
|
|
436
|
+
event.confirm_results.filter(r => r.confirmed).map(r => r.tool_call.id)
|
|
437
|
+
);
|
|
438
|
+
const deniedIds = new Set(
|
|
439
|
+
event.confirm_results.filter(r => !r.confirmed).map(r => r.tool_call.id)
|
|
440
|
+
);
|
|
437
441
|
this.context.at(-1)?.content.forEach(content => {
|
|
438
|
-
if (content.type === 'tool_call'
|
|
439
|
-
|
|
442
|
+
if (content.type === 'tool_call') {
|
|
443
|
+
if (confirmedIds.has(content.id)) {
|
|
444
|
+
content.state = 'allowed';
|
|
445
|
+
} else if (deniedIds.has(content.id)) {
|
|
446
|
+
content.state = 'finished';
|
|
447
|
+
}
|
|
440
448
|
}
|
|
441
449
|
});
|
|
442
450
|
}
|
|
@@ -449,13 +457,13 @@ export class Agent {
|
|
|
449
457
|
// Yield the run started event
|
|
450
458
|
yield {
|
|
451
459
|
id: crypto.randomUUID(),
|
|
452
|
-
type: EventType.
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
460
|
+
type: EventType.REPLY_START,
|
|
461
|
+
created_at: new Date().toISOString(),
|
|
462
|
+
session_id: '',
|
|
463
|
+
reply_id: this.replyId,
|
|
456
464
|
name: this.name,
|
|
457
465
|
role: 'assistant',
|
|
458
|
-
} as
|
|
466
|
+
} as ReplyStartEvent;
|
|
459
467
|
}
|
|
460
468
|
|
|
461
469
|
// Store the incoming message into memory
|
|
@@ -490,10 +498,10 @@ export class Agent {
|
|
|
490
498
|
if (awaitingType) {
|
|
491
499
|
yield {
|
|
492
500
|
id: crypto.randomUUID(),
|
|
493
|
-
|
|
501
|
+
created_at: new Date().toISOString(),
|
|
494
502
|
type: awaitingType,
|
|
495
|
-
|
|
496
|
-
|
|
503
|
+
reply_id: this.replyId,
|
|
504
|
+
tool_calls: awaitingToolCalls,
|
|
497
505
|
};
|
|
498
506
|
|
|
499
507
|
return createMsg({
|
|
@@ -528,11 +536,11 @@ export class Agent {
|
|
|
528
536
|
// Yield the run finished event
|
|
529
537
|
yield {
|
|
530
538
|
id: crypto.randomUUID(),
|
|
531
|
-
type: EventType.
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
} as
|
|
539
|
+
type: EventType.REPLY_END,
|
|
540
|
+
created_at: new Date().toISOString(),
|
|
541
|
+
session_id: '',
|
|
542
|
+
reply_id: this.replyId,
|
|
543
|
+
} as ReplyEndEvent;
|
|
536
544
|
|
|
537
545
|
return createMsg({
|
|
538
546
|
id: this.replyId,
|
|
@@ -557,11 +565,11 @@ export class Agent {
|
|
|
557
565
|
const tools = this.toolkit.getJSONSchemas();
|
|
558
566
|
yield {
|
|
559
567
|
id: crypto.randomUUID(),
|
|
560
|
-
|
|
561
|
-
type: EventType.
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
} as
|
|
568
|
+
created_at: new Date().toISOString(),
|
|
569
|
+
type: EventType.MODEL_CALL_START,
|
|
570
|
+
reply_id: this.replyId,
|
|
571
|
+
model_name: this.model.modelName,
|
|
572
|
+
} as ModelCallStartEvent;
|
|
565
573
|
const res = await this.model.call({
|
|
566
574
|
messages: [
|
|
567
575
|
createMsg({
|
|
@@ -620,41 +628,41 @@ export class Agent {
|
|
|
620
628
|
if (blockIds.textBlockId) {
|
|
621
629
|
yield {
|
|
622
630
|
id: crypto.randomUUID(),
|
|
623
|
-
|
|
631
|
+
created_at: new Date().toISOString(),
|
|
624
632
|
type: EventType.TEXT_BLOCK_END,
|
|
625
|
-
|
|
626
|
-
|
|
633
|
+
reply_id: this.replyId,
|
|
634
|
+
block_id: blockIds.textBlockId,
|
|
627
635
|
} as TextBlockEndEvent;
|
|
628
636
|
}
|
|
629
637
|
if (blockIds.thinkingBlockId) {
|
|
630
638
|
yield {
|
|
631
639
|
id: crypto.randomUUID(),
|
|
632
|
-
|
|
640
|
+
created_at: new Date().toISOString(),
|
|
633
641
|
type: EventType.THINKING_BLOCK_END,
|
|
634
|
-
|
|
635
|
-
|
|
642
|
+
reply_id: this.replyId,
|
|
643
|
+
block_id: blockIds.thinkingBlockId,
|
|
636
644
|
} as ThinkingBlockEndEvent;
|
|
637
645
|
}
|
|
638
646
|
if (blockIds.toolCallIds.length > 0) {
|
|
639
|
-
for (const
|
|
647
|
+
for (const tool_call_id of blockIds.toolCallIds) {
|
|
640
648
|
yield {
|
|
641
649
|
id: crypto.randomUUID(),
|
|
642
|
-
|
|
650
|
+
created_at: new Date().toISOString(),
|
|
643
651
|
type: EventType.TOOL_CALL_END,
|
|
644
|
-
|
|
645
|
-
|
|
652
|
+
reply_id: this.replyId,
|
|
653
|
+
tool_call_id,
|
|
646
654
|
} as ToolCallEndEvent;
|
|
647
655
|
}
|
|
648
656
|
}
|
|
649
657
|
|
|
650
658
|
yield {
|
|
651
659
|
id: crypto.randomUUID(),
|
|
652
|
-
|
|
653
|
-
type: EventType.
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
} as
|
|
660
|
+
created_at: new Date().toISOString(),
|
|
661
|
+
type: EventType.MODEL_CALL_END,
|
|
662
|
+
reply_id: this.replyId,
|
|
663
|
+
input_tokens: completedResponse.usage?.inputTokens || 0,
|
|
664
|
+
output_tokens: completedResponse.usage?.outputTokens || 0,
|
|
665
|
+
} as ModelCallEndEvent;
|
|
658
666
|
|
|
659
667
|
return completedResponse;
|
|
660
668
|
}
|
|
@@ -672,10 +680,10 @@ export class Agent {
|
|
|
672
680
|
yield {
|
|
673
681
|
type: EventType.TOOL_RESULT_START,
|
|
674
682
|
id: crypto.randomUUID(),
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
683
|
+
created_at: new Date().toISOString(),
|
|
684
|
+
reply_id: this.replyId,
|
|
685
|
+
tool_call_id: options.toolCall.id,
|
|
686
|
+
tool_call_name: options.toolCall.name,
|
|
679
687
|
} as ToolResultStartEvent;
|
|
680
688
|
|
|
681
689
|
while (true) {
|
|
@@ -741,18 +749,18 @@ export class Agent {
|
|
|
741
749
|
responseId.textBlockId = crypto.randomUUID();
|
|
742
750
|
yield {
|
|
743
751
|
id: crypto.randomUUID(),
|
|
744
|
-
|
|
752
|
+
created_at: new Date().toISOString(),
|
|
745
753
|
type: EventType.TEXT_BLOCK_START,
|
|
746
|
-
|
|
747
|
-
|
|
754
|
+
reply_id: this.replyId,
|
|
755
|
+
block_id: responseId.textBlockId,
|
|
748
756
|
} as TextBlockStartEvent;
|
|
749
757
|
}
|
|
750
758
|
yield {
|
|
751
759
|
id: crypto.randomUUID(),
|
|
752
|
-
|
|
760
|
+
created_at: new Date().toISOString(),
|
|
753
761
|
type: EventType.TEXT_BLOCK_DELTA,
|
|
754
|
-
|
|
755
|
-
|
|
762
|
+
reply_id: this.replyId,
|
|
763
|
+
block_id: responseId.textBlockId,
|
|
756
764
|
delta: block.text,
|
|
757
765
|
} as TextBlockDeltaEvent;
|
|
758
766
|
break;
|
|
@@ -762,18 +770,18 @@ export class Agent {
|
|
|
762
770
|
responseId.thinkingBlockId = crypto.randomUUID();
|
|
763
771
|
yield {
|
|
764
772
|
id: crypto.randomUUID(),
|
|
765
|
-
|
|
773
|
+
created_at: new Date().toISOString(),
|
|
766
774
|
type: EventType.THINKING_BLOCK_START,
|
|
767
|
-
|
|
768
|
-
|
|
775
|
+
reply_id: this.replyId,
|
|
776
|
+
block_id: responseId.thinkingBlockId,
|
|
769
777
|
} as ThinkingBlockStartEvent;
|
|
770
778
|
}
|
|
771
779
|
yield {
|
|
772
780
|
id: crypto.randomUUID(),
|
|
773
|
-
|
|
781
|
+
created_at: new Date().toISOString(),
|
|
774
782
|
type: EventType.THINKING_BLOCK_DELTA,
|
|
775
|
-
|
|
776
|
-
|
|
783
|
+
reply_id: this.replyId,
|
|
784
|
+
block_id: responseId.thinkingBlockId,
|
|
777
785
|
delta: block.thinking,
|
|
778
786
|
} as ThinkingBlockDeltaEvent;
|
|
779
787
|
break;
|
|
@@ -784,19 +792,19 @@ export class Agent {
|
|
|
784
792
|
yield {
|
|
785
793
|
id: crypto.randomUUID(),
|
|
786
794
|
type: EventType.TOOL_CALL_START,
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
795
|
+
created_at: new Date().toISOString(),
|
|
796
|
+
reply_id: this.replyId,
|
|
797
|
+
tool_call_id: block.id,
|
|
798
|
+
tool_call_name: block.name,
|
|
791
799
|
} as ToolCallStartEvent;
|
|
792
800
|
}
|
|
793
801
|
yield {
|
|
794
802
|
id: crypto.randomUUID(),
|
|
795
|
-
|
|
803
|
+
created_at: new Date().toISOString(),
|
|
796
804
|
type: EventType.TOOL_CALL_DELTA,
|
|
797
805
|
delta: block.input,
|
|
798
|
-
|
|
799
|
-
|
|
806
|
+
reply_id: this.replyId,
|
|
807
|
+
tool_call_id: block.id,
|
|
800
808
|
} as ToolCallDeltaEvent;
|
|
801
809
|
}
|
|
802
810
|
}
|
|
@@ -816,10 +824,10 @@ export class Agent {
|
|
|
816
824
|
case 'text':
|
|
817
825
|
yield {
|
|
818
826
|
id: crypto.randomUUID(),
|
|
819
|
-
|
|
827
|
+
created_at: new Date().toISOString(),
|
|
820
828
|
type: EventType.TOOL_RESULT_TEXT_DELTA,
|
|
821
|
-
|
|
822
|
-
|
|
829
|
+
reply_id: this.replyId,
|
|
830
|
+
tool_call_id: toolCall.id,
|
|
823
831
|
delta: block.text,
|
|
824
832
|
} as ToolResultTextDeltaEvent;
|
|
825
833
|
break;
|
|
@@ -828,33 +836,33 @@ export class Agent {
|
|
|
828
836
|
if (block.source.type === 'base64') {
|
|
829
837
|
yield {
|
|
830
838
|
id: crypto.randomUUID(),
|
|
831
|
-
|
|
832
|
-
type: EventType.
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
839
|
+
created_at: new Date().toISOString(),
|
|
840
|
+
type: EventType.TOOL_RESULT_DATA_DELTA,
|
|
841
|
+
reply_id: this.replyId,
|
|
842
|
+
tool_call_id: toolCall.id,
|
|
843
|
+
media_type: block.source.media_type,
|
|
836
844
|
data: block.source.data,
|
|
837
|
-
} as
|
|
845
|
+
} as ToolResultDataDeltaEvent;
|
|
838
846
|
} else if (block.source.type === 'url') {
|
|
839
847
|
yield {
|
|
840
848
|
id: crypto.randomUUID(),
|
|
841
|
-
|
|
842
|
-
type: EventType.
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
849
|
+
created_at: new Date().toISOString(),
|
|
850
|
+
type: EventType.TOOL_RESULT_DATA_DELTA,
|
|
851
|
+
reply_id: this.replyId,
|
|
852
|
+
tool_call_id: toolCall.id,
|
|
853
|
+
media_type: block.source.media_type,
|
|
846
854
|
url: block.source.url,
|
|
847
|
-
} as
|
|
855
|
+
} as ToolResultDataDeltaEvent;
|
|
848
856
|
}
|
|
849
857
|
break;
|
|
850
858
|
}
|
|
851
859
|
}
|
|
852
860
|
yield {
|
|
853
861
|
id: crypto.randomUUID(),
|
|
854
|
-
|
|
862
|
+
created_at: new Date().toISOString(),
|
|
855
863
|
type: EventType.TOOL_RESULT_END,
|
|
856
|
-
|
|
857
|
-
|
|
864
|
+
reply_id: this.replyId,
|
|
865
|
+
tool_call_id: toolCall.id,
|
|
858
866
|
state: toolRes.state,
|
|
859
867
|
} as ToolResultEndEvent;
|
|
860
868
|
}
|
|
@@ -865,7 +873,7 @@ export class Agent {
|
|
|
865
873
|
*/
|
|
866
874
|
public async toJSON() {
|
|
867
875
|
return {
|
|
868
|
-
|
|
876
|
+
reply_id: this.replyId,
|
|
869
877
|
confirmedToolCallIds: this.confirmedToolCallIds,
|
|
870
878
|
curIter: this.curIter,
|
|
871
879
|
};
|