Skip to content

Commit db5e20c

Browse files
authored
Merge branch 'main' into main
2 parents 521786e + a7eb5de commit db5e20c

125 files changed

Lines changed: 12475 additions & 420 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Detailed error messages.
2727

2828
**Environment (please complete the following information):**
2929

30-
- AgentScope-Java Version: [e.g. 1.0.8, check your pom.xml dependency version or run `mvn dependency:tree | grep agentscope-parent:pom`(only mac/linux)]
30+
- AgentScope-Java Version: [e.g. 1.0.9, check your pom.xml dependency version or run `mvn dependency:tree | grep agentscope-parent:pom`(only mac/linux)]
3131
- Java Version: [e.g. 17]
3232
- OS: [e.g. macos, windows]
3333

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## AgentScope-Java Version
22

3-
[The version of AgentScope-Java you are working on, e.g. 1.0.8, check your pom.xml dependency version or run `mvn dependency:tree | grep agentscope-parent:pom`(only mac/linux)]
3+
[The version of AgentScope-Java you are working on, e.g. 1.0.9, check your pom.xml dependency version or run `mvn dependency:tree | grep agentscope-parent:pom`(only mac/linux)]
44

55
## Description
66

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Built for enterprise deployment requirements:
7777
<dependency>
7878
<groupId>io.agentscope</groupId>
7979
<artifactId>agentscope</artifactId>
80-
<version>1.0.8</version>
80+
<version>1.0.9</version>
8181
</dependency>
8282
```
8383

README_zh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ AgentScope 设计上能够与现有企业基础设施集成,无需大规模改
7777
<dependency>
7878
<groupId>io.agentscope</groupId>
7979
<artifactId>agentscope</artifactId>
80-
<version>1.0.8</version>
80+
<version>1.0.9</version>
8181
</dependency>
8282
```
8383

SKILL.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ public static void main(String[] args) {
100100
<dependency>
101101
<groupId>io.agentscope</groupId>
102102
<artifactId>agentscope</artifactId>
103-
<version>1.0.8</version>
103+
<version>1.0.9</version>
104104
</dependency>
105105
</dependencies>
106106
```
107107

108108
**For local development (if working with source code):**
109109
```xml
110110
<properties>
111-
<agentscope.version>1.0.8</agentscope.version>
111+
<agentscope.version>1.0.9</agentscope.version>
112112
<java.version>17</java.version>
113113
</properties>
114114

@@ -122,8 +122,8 @@ public static void main(String[] args) {
122122
```
123123

124124
**⚠️ IMPORTANT: Version Selection**
125-
- **Use `agentscope:1.0.8`** for production (stable, from Maven Central)
126-
- **Use `agentscope-core:1.0.8`** only if you're developing AgentScope itself
125+
- **Use `agentscope:1.0.9`** for production (stable, from Maven Central)
126+
- **Use `agentscope-core:1.0.9`** only if you're developing AgentScope itself
127127
- **NEVER use version `0.1.0-SNAPSHOT`** - this version doesn't exist
128128

129129
### ⚠️ CRITICAL: Common Dependency Mistakes
@@ -161,7 +161,7 @@ public static void main(String[] args) {
161161
<dependency>
162162
<groupId>io.agentscope</groupId>
163163
<artifactId>agentscope</artifactId>
164-
<version>1.0.8</version> <!-- ✅ CORRECT -->
164+
<version>1.0.9</version> <!-- ✅ CORRECT -->
165165
</dependency>
166166
```
167167

agentscope-core/src/main/java/io/agentscope/core/Version.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
public final class Version {
2525

2626
/** AgentScope Java version */
27-
public static final String VERSION = "1.0.9-SNAPSHOT";
27+
public static final String VERSION = "1.0.10-SNAPSHOT";
2828

2929
private Version() {
3030
// Utility class - prevent instantiation
@@ -35,7 +35,7 @@ private Version() {
3535
*
3636
* <p>Format: {@code agentscope-java/{version}; java/{java_version}; platform/{os}}
3737
*
38-
* <p>Example: {@code agentscope-java/1.0.9-SNAPSHOT; java/17.0.1; platform/Mac OS X}
38+
* <p>Example: {@code agentscope-java/1.0.10-SNAPSHOT; java/17.0.1; platform/Mac OS X}
3939
*
4040
* @return unified User-Agent string
4141
*/

agentscope-core/src/main/java/io/agentscope/core/agent/AgentBase.java

Lines changed: 73 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -160,24 +160,29 @@ public final String getDescription() {
160160
*/
161161
@Override
162162
public final Mono<Msg> call(List<Msg> msgs) {
163-
if (!running.compareAndSet(false, true) && checkRunning) {
164-
return Mono.error(
165-
new IllegalStateException(
166-
"Agent is still running, please wait for it to finish"));
167-
}
168-
resetInterruptFlag();
169-
170-
return TracerRegistry.get()
171-
.callAgent(
172-
this,
173-
msgs,
174-
() ->
175-
notifyPreCall(msgs)
176-
.flatMap(this::doCall)
177-
.flatMap(this::notifyPostCall)
178-
.onErrorResume(
179-
createErrorHandler(msgs.toArray(new Msg[0]))))
180-
.doFinally(signalType -> running.set(false));
163+
return Mono.using(
164+
() -> {
165+
if (checkRunning && !running.compareAndSet(false, true)) {
166+
throw new IllegalStateException(
167+
"Agent is still running, please wait for it to finish");
168+
}
169+
resetInterruptFlag();
170+
return this;
171+
},
172+
resource ->
173+
TracerRegistry.get()
174+
.callAgent(
175+
this,
176+
msgs,
177+
() ->
178+
notifyPreCall(msgs)
179+
.flatMap(this::doCall)
180+
.flatMap(this::notifyPostCall)
181+
.onErrorResume(
182+
createErrorHandler(
183+
msgs.toArray(new Msg[0])))),
184+
resource -> running.set(false),
185+
true);
181186
}
182187

183188
/**
@@ -191,24 +196,33 @@ public final Mono<Msg> call(List<Msg> msgs) {
191196
*/
192197
@Override
193198
public final Mono<Msg> call(List<Msg> msgs, Class<?> structuredOutputClass) {
194-
if (!running.compareAndSet(false, true) && checkRunning) {
195-
return Mono.error(
196-
new IllegalStateException(
197-
"Agent is still running, please wait for it to finish"));
198-
}
199-
resetInterruptFlag();
200-
201-
return TracerRegistry.get()
202-
.callAgent(
203-
this,
204-
msgs,
205-
() ->
206-
notifyPreCall(msgs)
207-
.flatMap(m -> doCall(m, structuredOutputClass))
208-
.flatMap(this::notifyPostCall)
209-
.onErrorResume(
210-
createErrorHandler(msgs.toArray(new Msg[0]))))
211-
.doFinally(signalType -> running.set(false));
199+
return Mono.using(
200+
() -> {
201+
if (checkRunning && !running.compareAndSet(false, true)) {
202+
throw new IllegalStateException(
203+
"Agent is still running, please wait for it to finish");
204+
}
205+
resetInterruptFlag();
206+
return this;
207+
},
208+
resource ->
209+
TracerRegistry.get()
210+
.callAgent(
211+
this,
212+
msgs,
213+
() ->
214+
notifyPreCall(msgs)
215+
.flatMap(
216+
m ->
217+
doCall(
218+
m,
219+
structuredOutputClass))
220+
.flatMap(this::notifyPostCall)
221+
.onErrorResume(
222+
createErrorHandler(
223+
msgs.toArray(new Msg[0])))),
224+
resource -> running.set(false),
225+
true);
212226
}
213227

214228
/**
@@ -222,24 +236,29 @@ public final Mono<Msg> call(List<Msg> msgs, Class<?> structuredOutputClass) {
222236
*/
223237
@Override
224238
public final Mono<Msg> call(List<Msg> msgs, JsonNode schema) {
225-
if (!running.compareAndSet(false, true) && checkRunning) {
226-
return Mono.error(
227-
new IllegalStateException(
228-
"Agent is still running, please wait for it to finish"));
229-
}
230-
resetInterruptFlag();
231-
232-
return TracerRegistry.get()
233-
.callAgent(
234-
this,
235-
msgs,
236-
() ->
237-
notifyPreCall(msgs)
238-
.flatMap(m -> doCall(m, schema))
239-
.flatMap(this::notifyPostCall)
240-
.onErrorResume(
241-
createErrorHandler(msgs.toArray(new Msg[0]))))
242-
.doFinally(signalType -> running.set(false));
239+
return Mono.using(
240+
() -> {
241+
if (checkRunning && !running.compareAndSet(false, true)) {
242+
throw new IllegalStateException(
243+
"Agent is still running, please wait for it to finish");
244+
}
245+
resetInterruptFlag();
246+
return this;
247+
},
248+
resource ->
249+
TracerRegistry.get()
250+
.callAgent(
251+
this,
252+
msgs,
253+
() ->
254+
notifyPreCall(msgs)
255+
.flatMap(m -> doCall(m, schema))
256+
.flatMap(this::notifyPostCall)
257+
.onErrorResume(
258+
createErrorHandler(
259+
msgs.toArray(new Msg[0])))),
260+
resource -> running.set(false),
261+
true);
243262
}
244263

245264
/**

agentscope-core/src/main/java/io/agentscope/core/formatter/dashscope/dto/DashScopeRequest.java

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
*/
1616
package io.agentscope.core.formatter.dashscope.dto;
1717

18+
import com.fasterxml.jackson.annotation.JsonIgnore;
1819
import com.fasterxml.jackson.annotation.JsonInclude;
1920
import com.fasterxml.jackson.annotation.JsonProperty;
21+
import io.agentscope.core.model.EndpointType;
2022

2123
/**
2224
* DashScope API request DTO.
@@ -53,12 +55,23 @@ public class DashScopeRequest {
5355
@JsonProperty("parameters")
5456
private DashScopeParameters parameters;
5557

56-
public DashScopeRequest() {}
58+
/**
59+
* The endpoint type for endpoint selection (not serialized to JSON).
60+
*
61+
* <p>This is an internal field used to determine which DashScope API endpoint to use.
62+
* It does not get sent to the API.
63+
*/
64+
@JsonIgnore private EndpointType endpointType;
65+
66+
public DashScopeRequest() {
67+
this.endpointType = EndpointType.AUTO;
68+
}
5769

5870
public DashScopeRequest(String model, DashScopeInput input, DashScopeParameters parameters) {
5971
this.model = model;
6072
this.input = input;
6173
this.parameters = parameters;
74+
this.endpointType = EndpointType.AUTO;
6275
}
6376

6477
public String getModel() {
@@ -85,6 +98,24 @@ public void setParameters(DashScopeParameters parameters) {
8598
this.parameters = parameters;
8699
}
87100

101+
/**
102+
* Gets the endpoint type for endpoint selection.
103+
*
104+
* @return the endpoint type (defaults to AUTO)
105+
*/
106+
public EndpointType getEndpointType() {
107+
return endpointType;
108+
}
109+
110+
/**
111+
* Sets the endpoint type for endpoint selection.
112+
*
113+
* @param endpointType the endpoint type
114+
*/
115+
public void setEndpointType(EndpointType endpointType) {
116+
this.endpointType = endpointType;
117+
}
118+
88119
public static Builder builder() {
89120
return new Builder();
90121
}
@@ -93,6 +124,7 @@ public static class Builder {
93124
private String model;
94125
private DashScopeInput input;
95126
private DashScopeParameters parameters;
127+
private EndpointType endpointType = EndpointType.AUTO;
96128

97129
public Builder model(String model) {
98130
this.model = model;
@@ -109,8 +141,21 @@ public Builder parameters(DashScopeParameters parameters) {
109141
return this;
110142
}
111143

144+
/**
145+
* Sets the endpoint type for endpoint selection.
146+
*
147+
* @param endpointType the endpoint type
148+
* @return this builder
149+
*/
150+
public Builder endpointType(EndpointType endpointType) {
151+
this.endpointType = endpointType;
152+
return this;
153+
}
154+
112155
public DashScopeRequest build() {
113-
return new DashScopeRequest(model, input, parameters);
156+
DashScopeRequest request = new DashScopeRequest(model, input, parameters);
157+
request.setEndpointType(endpointType);
158+
return request;
114159
}
115160
}
116161
}

0 commit comments

Comments
 (0)