mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 16:53:04 +08:00
refactor(runner): load different policy provider according to os, now support bwrap sandbox in linux only
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package work.slhaf.partner.core.action.runner;
|
||||
|
||||
import cn.hutool.system.OsInfo;
|
||||
import cn.hutool.system.SystemUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import lombok.val;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -71,7 +73,8 @@ public class LocalRunnerClient extends RunnerClient implements AutoCloseable {
|
||||
McpConfigWatcher configWatcher = null;
|
||||
|
||||
try {
|
||||
ExecutionPolicyRegistry.INSTANCE.registerPolicyProvider(BwrapPolicyProvider.INSTANCE);
|
||||
|
||||
registerPolicyProviders();
|
||||
|
||||
metaRegistry = new McpMetaRegistry(existedMetaActions);
|
||||
registerMcpClient(clientRegistry, transportFactory, MCP_NAME_DESC, metaRegistry.clientConfig(MCP_NAME_DESC, 10));
|
||||
@@ -123,6 +126,13 @@ public class LocalRunnerClient extends RunnerClient implements AutoCloseable {
|
||||
setupShutdownHook();
|
||||
}
|
||||
|
||||
private void registerPolicyProviders() {
|
||||
OsInfo os = SystemUtil.getOsInfo();
|
||||
if (os.isLinux()) {
|
||||
ExecutionPolicyRegistry.INSTANCE.registerPolicyProvider(BwrapPolicyProvider.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RunnerResponse doRun(MetaAction metaAction) {
|
||||
log.debug("执行行动: {}", metaAction);
|
||||
|
||||
Reference in New Issue
Block a user