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;
|
package work.slhaf.partner.core.action.runner;
|
||||||
|
|
||||||
|
import cn.hutool.system.OsInfo;
|
||||||
|
import cn.hutool.system.SystemUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -71,7 +73,8 @@ public class LocalRunnerClient extends RunnerClient implements AutoCloseable {
|
|||||||
McpConfigWatcher configWatcher = null;
|
McpConfigWatcher configWatcher = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ExecutionPolicyRegistry.INSTANCE.registerPolicyProvider(BwrapPolicyProvider.INSTANCE);
|
|
||||||
|
registerPolicyProviders();
|
||||||
|
|
||||||
metaRegistry = new McpMetaRegistry(existedMetaActions);
|
metaRegistry = new McpMetaRegistry(existedMetaActions);
|
||||||
registerMcpClient(clientRegistry, transportFactory, MCP_NAME_DESC, metaRegistry.clientConfig(MCP_NAME_DESC, 10));
|
registerMcpClient(clientRegistry, transportFactory, MCP_NAME_DESC, metaRegistry.clientConfig(MCP_NAME_DESC, 10));
|
||||||
@@ -123,6 +126,13 @@ public class LocalRunnerClient extends RunnerClient implements AutoCloseable {
|
|||||||
setupShutdownHook();
|
setupShutdownHook();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void registerPolicyProviders() {
|
||||||
|
OsInfo os = SystemUtil.getOsInfo();
|
||||||
|
if (os.isLinux()) {
|
||||||
|
ExecutionPolicyRegistry.INSTANCE.registerPolicyProvider(BwrapPolicyProvider.INSTANCE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected RunnerResponse doRun(MetaAction metaAction) {
|
protected RunnerResponse doRun(MetaAction metaAction) {
|
||||||
log.debug("执行行动: {}", metaAction);
|
log.debug("执行行动: {}", metaAction);
|
||||||
|
|||||||
Reference in New Issue
Block a user