fix: add getBaseUrl(), PolicyDecision record, and decide(String,int) to PolicyClient
GameSession.java references these APIs which were missing from PolicyClient, causing 3 compilation errors. Added: - getBaseUrl() getter - PolicyDecision record (action, confidence) - decide(String, int) overload that delegates to decide(JsonObject)
This commit is contained in:
1 parent
ded79bfde1
commit
f851df6dbf
1 file changed
+16
@@ -276,6 +276,22 @@ public class PolicyClient {
|
||||
public String getLastError() { return lastError; }
|
||||
public int getTotalDecisions() { return totalDecisions; }
|
||||
public int getPolicyDecisions() { return policyDecisions; }
|
||||
public String getBaseUrl() { return baseUrl; }
|
||||
|
||||
/** Decision result record for GameSession integration. */
|
||||
public record PolicyDecision(String action, double confidence) {}
|
||||
|
||||
/**
|
||||
* Decide from a JSON string + seat index. Used by GameSession.
|
||||
* Converts to JsonObject and delegates to decide(JsonObject).
|
||||
*/
|
||||
public PolicyDecision decide(String stateJson, int seat) {
|
||||
JsonObject state = GSON.fromJson(stateJson, JsonObject.class);
|
||||
state.addProperty("seat", seat);
|
||||
String action = decide(state);
|
||||
return new PolicyDecision(action, 1.0);
|
||||
}
|
||||
|
||||
public int getFallbackDecisions() { return fallbackDecisions; }
|
||||
public int getPendingTuples() { return tupleBuffer.size(); }
|
||||
|
||||
|
||||
Reference in new issue
Block a user