mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 19:28:28 +00:00
refactor(src): split oversized modules
This commit is contained in:
34
src/agents/pi-embedded-runner/sandbox-info.ts
Normal file
34
src/agents/pi-embedded-runner/sandbox-info.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import type { ExecElevatedDefaults } from "../bash-tools.js";
|
||||
import type { resolveSandboxContext } from "../sandbox.js";
|
||||
import type { EmbeddedSandboxInfo } from "./types.js";
|
||||
|
||||
export function buildEmbeddedSandboxInfo(
|
||||
sandbox?: Awaited<ReturnType<typeof resolveSandboxContext>>,
|
||||
execElevated?: ExecElevatedDefaults,
|
||||
): EmbeddedSandboxInfo | undefined {
|
||||
if (!sandbox?.enabled) return undefined;
|
||||
const elevatedAllowed = Boolean(
|
||||
execElevated?.enabled && execElevated.allowed,
|
||||
);
|
||||
return {
|
||||
enabled: true,
|
||||
workspaceDir: sandbox.workspaceDir,
|
||||
workspaceAccess: sandbox.workspaceAccess,
|
||||
agentWorkspaceMount:
|
||||
sandbox.workspaceAccess === "ro" ? "/agent" : undefined,
|
||||
browserControlUrl: sandbox.browser?.controlUrl,
|
||||
browserNoVncUrl: sandbox.browser?.noVncUrl,
|
||||
hostBrowserAllowed: sandbox.browserAllowHostControl,
|
||||
allowedControlUrls: sandbox.browserAllowedControlUrls,
|
||||
allowedControlHosts: sandbox.browserAllowedControlHosts,
|
||||
allowedControlPorts: sandbox.browserAllowedControlPorts,
|
||||
...(elevatedAllowed
|
||||
? {
|
||||
elevated: {
|
||||
allowed: true,
|
||||
defaultLevel: execElevated?.defaultLevel ?? "off",
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user