Skip to content

Fix 1349 make default tool emitter public#1387

Open
itxaiohanglover wants to merge 8 commits into
agentscope-ai:mainfrom
itxaiohanglover:fix-1349-make-default-tool-emitter-public
Open

Fix 1349 make default tool emitter public#1387
itxaiohanglover wants to merge 8 commits into
agentscope-ai:mainfrom
itxaiohanglover:fix-1349-make-default-tool-emitter-public

Conversation

@itxaiohanglover
Copy link
Copy Markdown

@itxaiohanglover itxaiohanglover commented May 13, 2026

AgentScope-Java Version

1.0.13-SNAPSHOT

Description

Background: DefaultToolEmitter is package-private, preventing users outside io.agentscope.core.tool from accessing it. When a @Tool method throws ToolSuspendException to suspend execution, users need the toolCallId for asynchronous session restoration (to construct ToolResultBlock.of(toolId, ...) for resumption), but the ToolEmitter interface only exposes emit() — there is no way to access the toolCallId.

Changes:

  • Make DefaultToolEmitter class and constructor public
  • Add getToolUseBlock() getter to expose the ToolUseBlock (which contains toolCallId)
  • Update Javadoc to reflect the new visibility and usage pattern

How to test:

  1. Before fix — test code in external package (io.agentscope.reproduce) fails to compile with 7 errors: DefaultToolEmitter在io.agentscope.core.tool中不是公共的; 无法从外部程序包中对其进行访问
  2. After fix — run mvn test -pl agentscope-core -Dtest="io.agentscope.reproduce.Issue1349ReproduceTest" → 2 tests passed
  3. Existing tests — run mvn test -pl agentscope-core -Dtest="io.agentscope.core.tool.ToolEmitterIntegrationTest" → 8 tests passed, no regression

Fixes #1349

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

@itxaiohanglover itxaiohanglover requested a review from a team May 13, 2026 13:44
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhance]: DefaultToolEmitter.java should be made public for users to be used for asynchronous session restoration.

2 participants