@agentscope-ai/agentscope 0.0.4 → 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.
Files changed (43) hide show
  1. package/dist/agent/index.d.mts +7 -7
  2. package/dist/agent/index.d.ts +7 -7
  3. package/dist/agent/index.js.map +1 -1
  4. package/dist/agent/index.mjs.map +1 -1
  5. package/dist/{base-ClilytRZ.d.mts → base-BB9eTlit.d.mts} +1 -1
  6. package/dist/{base-B_MQMHWr.d.mts → base-BDyDUIhj.d.mts} +3 -3
  7. package/dist/{base-1YVBgB4n.d.mts → base-BI5s2ksj.d.mts} +2 -2
  8. package/dist/{base-ChWjyzPL.d.ts → base-CFDeoJRe.d.ts} +2 -2
  9. package/dist/{base-CY4DMBH1.d.ts → base-DHtZCg94.d.ts} +1 -1
  10. package/dist/{base-BherSLRs.d.ts → base-qmU135_k.d.ts} +3 -3
  11. package/dist/{block-B72uPF1H.d.mts → block-BqWf-Qcb.d.mts} +15 -1
  12. package/dist/{block-B72uPF1H.d.ts → block-BqWf-Qcb.d.ts} +15 -1
  13. package/dist/event/index.d.mts +1 -14
  14. package/dist/event/index.d.ts +1 -14
  15. package/dist/formatter/index.d.mts +3 -3
  16. package/dist/formatter/index.d.ts +3 -3
  17. package/dist/formatter/index.js.map +1 -1
  18. package/dist/formatter/index.mjs.map +1 -1
  19. package/dist/{index-BNfyKbQN.d.ts → index-9YC8onn7.d.ts} +1 -1
  20. package/dist/{index-UQCwdfet.d.mts → index-DpRGxYeT.d.mts} +1 -1
  21. package/dist/mcp/index.d.mts +2 -2
  22. package/dist/mcp/index.d.ts +2 -2
  23. package/dist/message/index.d.mts +2 -2
  24. package/dist/message/index.d.ts +2 -2
  25. package/dist/message/index.js +17 -1
  26. package/dist/message/index.js.map +1 -1
  27. package/dist/message/index.mjs +17 -1
  28. package/dist/message/index.mjs.map +1 -1
  29. package/dist/{message-DgpfAaHK.d.mts → message-D-LObC06.d.mts} +1 -1
  30. package/dist/{message-CPZd0NIc.d.ts → message-DU0_qm3u.d.ts} +1 -1
  31. package/dist/model/index.d.mts +5 -5
  32. package/dist/model/index.d.ts +5 -5
  33. package/dist/model/index.js.map +1 -1
  34. package/dist/model/index.mjs.map +1 -1
  35. package/dist/storage/index.d.mts +3 -3
  36. package/dist/storage/index.d.ts +3 -3
  37. package/dist/tool/index.d.mts +4 -4
  38. package/dist/tool/index.d.ts +4 -4
  39. package/dist/{toolkit-DeOlul5Y.d.ts → toolkit-CLGa-xW0.d.ts} +2 -2
  40. package/dist/{toolkit-jwe7NmVJ.d.mts → toolkit-DvER4yhm.d.mts} +2 -2
  41. package/package.json +1 -1
  42. package/src/message/block.ts +3 -0
  43. package/src/message/message.ts +19 -1
@@ -1,7 +1,7 @@
1
- import { S as StorageBase, A as AgentState } from '../base-ClilytRZ.mjs';
2
- import { M as Msg } from '../message-DgpfAaHK.mjs';
1
+ import { S as StorageBase, A as AgentState } from '../base-BB9eTlit.mjs';
2
+ import { M as Msg } from '../message-D-LObC06.mjs';
3
3
  import '../index-CAxQAkiP.mjs';
4
- import '../block-B72uPF1H.mjs';
4
+ import '../block-BqWf-Qcb.mjs';
5
5
  import '../event/index.mjs';
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
- import { S as StorageBase, A as AgentState } from '../base-CY4DMBH1.js';
2
- import { M as Msg } from '../message-CPZd0NIc.js';
1
+ import { S as StorageBase, A as AgentState } from '../base-DHtZCg94.js';
2
+ import { M as Msg } from '../message-DU0_qm3u.js';
3
3
  import '../index-CAxQAkiP.js';
4
- import '../block-B72uPF1H.js';
4
+ import '../block-BqWf-Qcb.js';
5
5
  import '../event/index.js';
6
6
 
7
7
  /**
@@ -1,13 +1,13 @@
1
- import { a as ToolResponse } from '../index-UQCwdfet.mjs';
2
- export { T as Tool } from '../index-UQCwdfet.mjs';
3
- export { T as Toolkit } from '../toolkit-jwe7NmVJ.mjs';
1
+ import { a as ToolResponse } from '../index-DpRGxYeT.mjs';
2
+ export { T as Tool } from '../index-DpRGxYeT.mjs';
3
+ export { T as Toolkit } from '../toolkit-DvER4yhm.mjs';
4
4
  import { z } from 'zod';
5
5
  import '@modelcontextprotocol/sdk/client/index.js';
6
6
  import '@modelcontextprotocol/sdk/client/sse.js';
7
7
  import '@modelcontextprotocol/sdk/client/streamableHttp.js';
8
8
  import '@modelcontextprotocol/sdk/shared/protocol.js';
9
9
  import '../index-CAxQAkiP.mjs';
10
- import '../block-B72uPF1H.mjs';
10
+ import '../block-BqWf-Qcb.mjs';
11
11
  import '@modelcontextprotocol/sdk/client/stdio.js';
12
12
 
13
13
  /**
@@ -1,13 +1,13 @@
1
- import { a as ToolResponse } from '../index-BNfyKbQN.js';
2
- export { T as Tool } from '../index-BNfyKbQN.js';
3
- export { T as Toolkit } from '../toolkit-DeOlul5Y.js';
1
+ import { a as ToolResponse } from '../index-9YC8onn7.js';
2
+ export { T as Tool } from '../index-9YC8onn7.js';
3
+ export { T as Toolkit } from '../toolkit-CLGa-xW0.js';
4
4
  import { z } from 'zod';
5
5
  import '@modelcontextprotocol/sdk/client/index.js';
6
6
  import '@modelcontextprotocol/sdk/client/sse.js';
7
7
  import '@modelcontextprotocol/sdk/client/streamableHttp.js';
8
8
  import '@modelcontextprotocol/sdk/shared/protocol.js';
9
9
  import '../index-CAxQAkiP.js';
10
- import '../block-B72uPF1H.js';
10
+ import '../block-BqWf-Qcb.js';
11
11
  import '@modelcontextprotocol/sdk/client/stdio.js';
12
12
 
13
13
  /**
@@ -1,6 +1,6 @@
1
- import { T as Tool, H as HTTPMCPClient, S as StdioMCPClient, a as ToolResponse } from './index-BNfyKbQN.js';
1
+ import { T as Tool, H as HTTPMCPClient, S as StdioMCPClient, a as ToolResponse } from './index-9YC8onn7.js';
2
2
  import { T as ToolSchema } from './index-CAxQAkiP.js';
3
- import { b as ToolCallBlock } from './block-B72uPF1H.js';
3
+ import { b as ToolCallBlock } from './block-BqWf-Qcb.js';
4
4
 
5
5
  interface RegisteredTool extends Tool {
6
6
  type: 'function' | 'mcp';
@@ -1,6 +1,6 @@
1
- import { T as Tool, H as HTTPMCPClient, S as StdioMCPClient, a as ToolResponse } from './index-UQCwdfet.mjs';
1
+ import { T as Tool, H as HTTPMCPClient, S as StdioMCPClient, a as ToolResponse } from './index-DpRGxYeT.mjs';
2
2
  import { T as ToolSchema } from './index-CAxQAkiP.mjs';
3
- import { b as ToolCallBlock } from './block-B72uPF1H.mjs';
3
+ import { b as ToolCallBlock } from './block-BqWf-Qcb.mjs';
4
4
 
5
5
  interface RegisteredTool extends Tool {
6
6
  type: 'function' | 'mcp';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentscope-ai/agentscope",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "",
5
5
  "exports": {
6
6
  "./message": {
@@ -1,3 +1,5 @@
1
+ import { PermissionRule } from '../permission';
2
+
1
3
  export interface TextBlock {
2
4
  type: 'text';
3
5
  text: string;
@@ -24,6 +26,7 @@ export interface ToolCallBlock {
24
26
  id: string;
25
27
  input: string;
26
28
  state: ToolCallState;
29
+ suggested_rules?: PermissionRule[];
27
30
  }
28
31
 
29
32
  export type ToolResultState = 'success' | 'error' | 'interrupted' | 'denied' | 'running';
@@ -360,10 +360,28 @@ export function appendEvent(msg: Msg, event: AgentEvent): Msg {
360
360
  break;
361
361
  }
362
362
 
363
+ case EventType.MODEL_CALL_END:
364
+ // Accumulated the input and output tokens here.
365
+ if (msg.usage) {
366
+ msg.usage.inputTokens += event.input_tokens;
367
+ msg.usage.outputTokens += event.output_tokens;
368
+ } else {
369
+ msg.usage = {
370
+ inputTokens: event.input_tokens,
371
+ outputTokens: event.output_tokens,
372
+ };
373
+ }
374
+ break;
375
+
363
376
  case EventType.REQUIRE_USER_CONFIRM:
364
377
  for (const tc of event.tool_calls) {
365
378
  const b = findBlock(msg, 'tool_call', tc.id);
366
- if (b) (b as ToolCallBlock).state = 'asking';
379
+ if (b) {
380
+ (b as ToolCallBlock).state = 'asking';
381
+ if (tc.suggested_rules !== undefined) {
382
+ (b as ToolCallBlock).suggested_rules = tc.suggested_rules;
383
+ }
384
+ }
367
385
  }
368
386
  break;
369
387