@agentscope-ai/agentscope 0.0.3 → 0.0.5
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/dist/agent/index.d.mts +7 -7
- package/dist/agent/index.d.ts +7 -7
- package/dist/agent/index.js +14 -7
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/index.mjs +14 -7
- package/dist/agent/index.mjs.map +1 -1
- package/dist/{base-Dh5vEBQD.d.mts → base-BB9eTlit.d.mts} +1 -1
- package/dist/{base-D9uCcDjZ.d.mts → base-BDyDUIhj.d.mts} +3 -3
- package/dist/{base-Bo8TzBQq.d.mts → base-BI5s2ksj.d.mts} +2 -2
- package/dist/{base-t7G4uaR_.d.ts → base-CFDeoJRe.d.ts} +2 -2
- package/dist/{base-Co-MzdN5.d.ts → base-DHtZCg94.d.ts} +1 -1
- package/dist/{base-TYjCCv7T.d.ts → base-qmU135_k.d.ts} +3 -3
- package/dist/{block-7fd6byyN.d.mts → block-BqWf-Qcb.d.mts} +19 -3
- package/dist/{block-7fd6byyN.d.ts → block-BqWf-Qcb.d.ts} +19 -3
- package/dist/event/index.d.mts +1 -14
- package/dist/event/index.d.ts +1 -14
- package/dist/formatter/index.d.mts +4 -3
- package/dist/formatter/index.d.ts +4 -3
- package/dist/formatter/index.js.map +1 -1
- package/dist/formatter/index.mjs.map +1 -1
- package/dist/{index-DaopL-Vp.d.ts → index-9YC8onn7.d.ts} +1 -1
- package/dist/{index-BVNbIN62.d.mts → index-DpRGxYeT.d.mts} +1 -1
- package/dist/mcp/index.d.mts +2 -2
- package/dist/mcp/index.d.ts +2 -2
- package/dist/message/index.d.mts +3 -2
- package/dist/message/index.d.ts +3 -2
- package/dist/message/index.js +181 -0
- package/dist/message/index.js.map +1 -1
- package/dist/message/index.mjs +180 -0
- package/dist/message/index.mjs.map +1 -1
- package/dist/{message-CYnHiEVt.d.mts → message-D-LObC06.d.mts} +13 -2
- package/dist/{message-DZN7LetB.d.ts → message-DU0_qm3u.d.ts} +13 -2
- package/dist/model/index.d.mts +6 -5
- package/dist/model/index.d.ts +6 -5
- package/dist/model/index.js +22 -11
- package/dist/model/index.js.map +1 -1
- package/dist/model/index.mjs +22 -11
- 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/tool/index.d.mts +4 -4
- package/dist/tool/index.d.ts +4 -4
- package/dist/{toolkit-BuMTkbGg.d.ts → toolkit-CLGa-xW0.d.ts} +2 -2
- package/dist/{toolkit-CH9qKAy9.d.mts → toolkit-DvER4yhm.d.mts} +2 -2
- package/package.json +1 -1
- package/src/agent/agent.test.ts +41 -8
- package/src/agent/agent.ts +15 -9
- package/src/formatter/dashscope-chat-formatter.test.ts +3 -0
- package/src/formatter/openai-chat-formatter.test.ts +9 -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 +9 -2
- package/src/message/index.ts +3 -0
- package/src/message/message.test.ts +2 -0
- package/src/message/message.ts +227 -0
- 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/storage/file-system.test.ts +1 -0
- package/src/tool/toolkit.test.ts +12 -0
package/dist/agent/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { M as Msg } from '../message-
|
|
3
|
-
import { b as ToolCallBlock, C as ContentBlock,
|
|
4
|
-
import { C as ChatModelBase, a as ChatUsage, b as ChatResponse } from '../base-
|
|
5
|
-
import { a as ToolResponse } from '../index-
|
|
6
|
-
import { T as Toolkit } from '../toolkit-
|
|
2
|
+
import { M as Msg } from '../message-D-LObC06.mjs';
|
|
3
|
+
import { b as ToolCallBlock, C as ContentBlock, d as ToolResultBlock } from '../block-BqWf-Qcb.mjs';
|
|
4
|
+
import { C as ChatModelBase, a as ChatUsage, b as ChatResponse } from '../base-BDyDUIhj.mjs';
|
|
5
|
+
import { a as ToolResponse } from '../index-DpRGxYeT.mjs';
|
|
6
|
+
import { T as Toolkit } from '../toolkit-DvER4yhm.mjs';
|
|
7
7
|
import { UserConfirmResultEvent, ExternalExecutionResultEvent, AgentEvent, EventType, ToolResultTextDeltaEvent, ToolResultDataDeltaEvent, ToolResultEndEvent } from '../event/index.mjs';
|
|
8
8
|
import { a as ToolChoice } from '../index-CAxQAkiP.mjs';
|
|
9
|
-
import { S as StorageBase } from '../base-
|
|
10
|
-
import '../base-
|
|
9
|
+
import { S as StorageBase } from '../base-BB9eTlit.mjs';
|
|
10
|
+
import '../base-BI5s2ksj.mjs';
|
|
11
11
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
12
12
|
import '@modelcontextprotocol/sdk/client/sse.js';
|
|
13
13
|
import '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { M as Msg } from '../message-
|
|
3
|
-
import { b as ToolCallBlock, C as ContentBlock,
|
|
4
|
-
import { C as ChatModelBase, a as ChatUsage, b as ChatResponse } from '../base-
|
|
5
|
-
import { a as ToolResponse } from '../index-
|
|
6
|
-
import { T as Toolkit } from '../toolkit-
|
|
2
|
+
import { M as Msg } from '../message-DU0_qm3u.js';
|
|
3
|
+
import { b as ToolCallBlock, C as ContentBlock, d as ToolResultBlock } from '../block-BqWf-Qcb.js';
|
|
4
|
+
import { C as ChatModelBase, a as ChatUsage, b as ChatResponse } from '../base-qmU135_k.js';
|
|
5
|
+
import { a as ToolResponse } from '../index-9YC8onn7.js';
|
|
6
|
+
import { T as Toolkit } from '../toolkit-CLGa-xW0.js';
|
|
7
7
|
import { UserConfirmResultEvent, ExternalExecutionResultEvent, AgentEvent, EventType, ToolResultTextDeltaEvent, ToolResultDataDeltaEvent, ToolResultEndEvent } from '../event/index.js';
|
|
8
8
|
import { a as ToolChoice } from '../index-CAxQAkiP.js';
|
|
9
|
-
import { S as StorageBase } from '../base-
|
|
10
|
-
import '../base-
|
|
9
|
+
import { S as StorageBase } from '../base-DHtZCg94.js';
|
|
10
|
+
import '../base-CFDeoJRe.js';
|
|
11
11
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
12
12
|
import '@modelcontextprotocol/sdk/client/sse.js';
|
|
13
13
|
import '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
package/dist/agent/index.js
CHANGED
|
@@ -708,7 +708,7 @@ var Agent = class {
|
|
|
708
708
|
agentId: this.name,
|
|
709
709
|
context: this.context,
|
|
710
710
|
metadata: {
|
|
711
|
-
|
|
711
|
+
replyId: this.replyId,
|
|
712
712
|
curIter: this.curIter,
|
|
713
713
|
curSummary: this.curSummary
|
|
714
714
|
}
|
|
@@ -815,13 +815,13 @@ var Agent = class {
|
|
|
815
815
|
const preToolCalls = [];
|
|
816
816
|
for (const [index, toolCall] of pendingToolCalls.entries()) {
|
|
817
817
|
if (this.toolkit.requireUserConfirm(toolCall.name) && !this.confirmedToolCallIds.includes(toolCall.id)) {
|
|
818
|
-
toolCall.
|
|
818
|
+
toolCall.state = "asking";
|
|
819
819
|
let i = index + 1;
|
|
820
820
|
for (; i < pendingToolCalls.length; i++) {
|
|
821
821
|
const nextToolCall = pendingToolCalls[i];
|
|
822
822
|
if (!this.toolkit.requireUserConfirm(nextToolCall.name) || this.confirmedToolCallIds.includes(nextToolCall.id))
|
|
823
823
|
break;
|
|
824
|
-
nextToolCall.
|
|
824
|
+
nextToolCall.state = "asking";
|
|
825
825
|
}
|
|
826
826
|
return {
|
|
827
827
|
awaitingType: "REQUIRE_USER_CONFIRM" /* REQUIRE_USER_CONFIRM */,
|
|
@@ -911,12 +911,19 @@ var Agent = class {
|
|
|
911
911
|
]);
|
|
912
912
|
}
|
|
913
913
|
}
|
|
914
|
-
const
|
|
915
|
-
(
|
|
914
|
+
const confirmedIds = new Set(
|
|
915
|
+
event.confirm_results.filter((r) => r.confirmed).map((r) => r.tool_call.id)
|
|
916
|
+
);
|
|
917
|
+
const deniedIds = new Set(
|
|
918
|
+
event.confirm_results.filter((r) => !r.confirmed).map((r) => r.tool_call.id)
|
|
916
919
|
);
|
|
917
920
|
this.context.at(-1)?.content.forEach((content) => {
|
|
918
|
-
if (content.type === "tool_call"
|
|
919
|
-
|
|
921
|
+
if (content.type === "tool_call") {
|
|
922
|
+
if (confirmedIds.has(content.id)) {
|
|
923
|
+
content.state = "allowed";
|
|
924
|
+
} else if (deniedIds.has(content.id)) {
|
|
925
|
+
content.state = "finished";
|
|
926
|
+
}
|
|
920
927
|
}
|
|
921
928
|
});
|
|
922
929
|
}
|