refactor(agent): introduce AgentBootstrap for startup wiring and simplify app launch

This commit is contained in:
2026-04-30 22:12:04 +08:00
parent 7aab236221
commit 428f133ac3
4 changed files with 186 additions and 28 deletions

View File

@@ -1,15 +1,10 @@
package work.slhaf.partner;
import work.slhaf.partner.common.vector.VectorClientRegistry;
import work.slhaf.partner.framework.agent.Agent;
import work.slhaf.partner.runtime.gateway.WebSocketGatewayRegistration;
public class Main {
public static void main(String[] args) {
boolean launched = Agent.newAgent(Main.class)
.addGatewayRegistration(WebSocketGatewayRegistration.INSTANCE)
.addConfigurable(new VectorClientRegistry())
.launch();
boolean launched = Agent.newAgent(Main.class).launch();
if (!launched) {
System.exit(1);
}

View File

@@ -0,0 +1,18 @@
package work.slhaf.partner.runtime;
import work.slhaf.partner.common.vector.VectorClientRegistry;
import work.slhaf.partner.framework.agent.Agent;
import work.slhaf.partner.runtime.gateway.WebSocketGatewayRegistration;
public final class PartnerAgentBootstrap extends Agent.AgentBootstrap {
public PartnerAgentBootstrap(Agent.AgentApp agentApp) {
super(agentApp);
}
@Override
protected void bootstrap() {
addGatewayRegistration(WebSocketGatewayRegistration.INSTANCE);
addConfigurable(new VectorClientRegistry());
}
}