Skip to content

Commit de78f5b

Browse files
committed
Add PromptRequest.text() convenience method, fix snapshot versions
Add text() to PromptRequest that returns the first TextContent string from the prompt list, replacing the 5-line stream/filter/map/findFirst boilerplate. README installation section now correctly references 0.9.0-SNAPSHOT with the snapshot repository configuration.
1 parent ce7f1f1 commit de78f5b

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,22 @@ Three API styles for building agents:
2626

2727
## Installation
2828

29-
Published to Maven Central:
29+
Snapshot builds are published to Maven Central Snapshots. Add the snapshot repository and dependency:
3030

3131
```xml
32+
<repositories>
33+
<repository>
34+
<id>central-snapshots</id>
35+
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
36+
<snapshots><enabled>true</enabled></snapshots>
37+
<releases><enabled>false</enabled></releases>
38+
</repository>
39+
</repositories>
40+
3241
<dependency>
3342
<groupId>com.agentclientprotocol</groupId>
3443
<artifactId>acp-core</artifactId>
35-
<version>0.9.0</version>
44+
<version>0.9.0-SNAPSHOT</version>
3645
</dependency>
3746
```
3847

@@ -41,7 +50,7 @@ For annotation-based agent development:
4150
<dependency>
4251
<groupId>com.agentclientprotocol</groupId>
4352
<artifactId>acp-agent-support</artifactId>
44-
<version>0.9.0</version>
53+
<version>0.9.0-SNAPSHOT</version>
4554
</dependency>
4655
```
4756

@@ -50,7 +59,7 @@ For WebSocket server support (agents accepting WebSocket connections):
5059
<dependency>
5160
<groupId>com.agentclientprotocol</groupId>
5261
<artifactId>acp-websocket-jetty</artifactId>
53-
<version>0.9.0</version>
62+
<version>0.9.0-SNAPSHOT</version>
5463
</dependency>
5564
```
5665

@@ -451,10 +460,10 @@ This SDK is part of the [Agent Client Protocol](https://agentclientprotocol.com/
451460
- Capability negotiation
452461
- Structured error handling
453462
- Full protocol compliance (all SessionUpdate types, MCP configs, `_meta` extensibility)
454-
- Snapshot builds published to Maven Central
463+
- Snapshot builds published to Maven Central Snapshots
455464
- 258 tests
456465

457466
### v1.0.0 (Planned)
458-
- Stable release to Maven Central
467+
- Stable release published to Maven Central
459468
- Production hardening
460469
- Performance optimizations

acp-core/src/main/java/com/agentclientprotocol/sdk/spec/AcpSchema.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,21 @@ public record PromptRequest(@JsonProperty("sessionId") String sessionId,
312312
public PromptRequest(String sessionId, List<ContentBlock> prompt) {
313313
this(sessionId, prompt, null);
314314
}
315+
316+
/**
317+
* Returns the text of the first {@link TextContent} block in the prompt, or an empty
318+
* string if no text content is present.
319+
*/
320+
public String text() {
321+
if (prompt == null) {
322+
return "";
323+
}
324+
return prompt.stream()
325+
.filter(c -> c instanceof TextContent)
326+
.map(c -> ((TextContent) c).text())
327+
.findFirst()
328+
.orElse("");
329+
}
315330
}
316331

317332
/**

0 commit comments

Comments
 (0)