mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-15 11:58:34 +08:00
fix(agent): isolate DSH prompt sessions
This commit is contained in:
parent
98d0bb7780
commit
5660c72e1a
@ -33,6 +33,7 @@ import java.nio.file.Files;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapter for the official DeepSeek Harness SDK JSON-RPC runtime.
|
* Adapter for the official DeepSeek Harness SDK JSON-RPC runtime.
|
||||||
@ -208,6 +209,10 @@ public class DshRuntimeService implements AgentRuntimeProvider {
|
|||||||
modelName,
|
modelName,
|
||||||
Path.of(System.getenv().getOrDefault("DSH_CWD", System.getProperty("user.dir"))),
|
Path.of(System.getenv().getOrDefault("DSH_CWD", System.getProperty("user.dir"))),
|
||||||
Map.of());
|
Map.of());
|
||||||
|
// Each prompt runs in a fresh child process. DSH persists its
|
||||||
|
// own session log, so reusing the MateClaw conversation id
|
||||||
|
// would make the next turn look like a conflicting live session.
|
||||||
|
String dshSessionId = conversationId + "-" + UUID.randomUUID();
|
||||||
Files.createDirectories(session.workingDirectory());
|
Files.createDirectories(session.workingDirectory());
|
||||||
ModelProviderEntity provider = resolveProvider(modelName);
|
ModelProviderEntity provider = resolveProvider(modelName);
|
||||||
String effectiveModelName = resolveModelName(modelName);
|
String effectiveModelName = resolveModelName(modelName);
|
||||||
@ -264,7 +269,7 @@ public class DshRuntimeService implements AgentRuntimeProvider {
|
|||||||
|
|
||||||
String promptId = "prompt-" + conversationId;
|
String promptId = "prompt-" + conversationId;
|
||||||
send(writer, request("session/prompt", promptId, Map.of(
|
send(writer, request("session/prompt", promptId, Map.of(
|
||||||
"sessionId", conversationId,
|
"sessionId", dshSessionId,
|
||||||
"contentBlocks", List.of(Map.of("type", "text", "text", message)))));
|
"contentBlocks", List.of(Map.of("type", "text", "text", message)))));
|
||||||
|
|
||||||
// DSH may emit session events before the JSON-RPC response
|
// DSH may emit session events before the JSON-RPC response
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user